
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[ The Cloudflare Blog ]]></title>
        <description><![CDATA[ Get the latest news on how products at Cloudflare are built, technologies used, and join the teams helping to build a better Internet. ]]></description>
        <link>https://blog.cloudflare.com</link>
        <atom:link href="https://blog.cloudflare.com/" rel="self" type="application/rss+xml"/>
        <language>en-us</language>
        <image>
            <url>https://blog.cloudflare.com/favicon.png</url>
            <title>The Cloudflare Blog</title>
            <link>https://blog.cloudflare.com</link>
        </image>
        <lastBuildDate>Tue, 14 Apr 2026 07:52:59 GMT</lastBuildDate>
        <item>
            <title><![CDATA[How "expensive" is crypto anyway?]]></title>
            <link>https://blog.cloudflare.com/how-expensive-is-crypto-anyway/</link>
            <pubDate>Thu, 28 Dec 2017 18:22:17 GMT</pubDate>
            <description><![CDATA[ I wouldn’t be surprised if the title of this post attracts some Bitcoin aficionados, but if you are such, I want to disappoint you. For me crypto means cryptography, not cybermoney, and the price we pay for it is measured in CPU cycles, not USD. ]]></description>
            <content:encoded><![CDATA[ <p>I wouldn’t be surprised if the title of this post attracts some Bitcoin aficionados, but if you are such, I want to disappoint you. For me crypto means cryptography, not cybermoney, and the price we pay for it is measured in CPU cycles, not USD.</p><p>If you got to this second paragraph you probably heard that TLS today is very cheap to deploy. Considerable effort was put to optimize the cryptography stacks of OpenSSL and <a href="/make-ssl-boring-again/">BoringSSL</a>, as well as the hardware that runs them. However, aside for the occasional benchmark, that can tell us how many GB/s a given algorithm can encrypt, or how many signatures a certain elliptic curve can generate, I did not find much information about the cost of crypto in real world TLS deployments.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4GpBJuCjZpnZ4bN5fo6AB5/1d03279839c5d142210fd92278f1c3a0/22100041369_327f9dcfc6_o.jpg" />
            
            </figure><p><a href="https://creativecommons.org/licenses/by-sa/2.0/">CC BY-SA 2.0</a> <a href="https://www.flickr.com/photos/e-coli/22100041369/in/photolist-zEUum2-ER8BYq-5hXtwb-CxiYwX-5hXtvY-5hXtwj-5hFNbs-64fGf6-5hFLPQ-DSoVkq-bwyd2T-wYRxkw-5qW7d2-Vk3SA3-Kz3mo-KmY6zN-56qFgQ-UTiRvS-oEfFVF-dYqdH3-9z5NFC-64r7NG-ps3sX2-21Lx1pJ-CoqCmg-ZDQmP6-Es7Qyu-ZUU2fs-CmLMxz-ZUTF2w-CoqCPa-DU3hpj-64mTPT-56nEXr-Chbu5y-aXWvtK-56mDWX-Kz3mf-nJmMH7-7u5NGZ-jfFAJZ-afaRHw-HixWdX-Kz3mj-nbMprL-thpMu-4mtfnn-56mN4F-ZUUVs3-DSn1A9">image</a> by <a href="https://www.flickr.com/photos/e-coli/">Michele M. F.</a></p><p>As Cloudflare is the largest provider of TLS on the planet, one would think we perform a lot of cryptography related tasks, and one would be absolutely correct. More than half of our external traffic is now TLS, as well as all of our internal traffic. Being in that position means that crypto performance is critical to our success, and as it happens, every now and then we like to profile our production servers, to identify and fix hot spots.</p><p>In this post I want to share the latest profiling results that relate to crypto.</p><p>The profiled server is located in our Frankfurt data center, and sports 2 Xeon Silver 4116 processors. Every geography has a slightly different use pattern of TLS. In Frankfurt 73% of the requests are TLS, and the negotiated cipher-suites break down like so:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5FwOwwcCOKEmKPXC39AKre/65ef57db90078551f6e6f87356acf7dc/Cloudflare--Frankfurt---negotiated-TLS-cipher-suites.png" />
            
            </figure><p>Processing all of those different ciphersuites, BoringSSL consumes just 1.8% of the CPU time. That’s right, mere 1.8%. And that is not even pure cryptography, there is a considerable overhead involved too.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/10fP5b90Te8C5dgLu9niYm/9eecc466e1d99d5c67407ea53e49da5c/Cloudflare-boringssl-profiling.png" />
            
            </figure><p>Let’s take a deeper dive, shall we?</p>
    <div>
      <h3>Ciphers</h3>
      <a href="#ciphers">
        
      </a>
    </div>
    <p>If we break down the negotiated cipher suites, by the AEAD used, we get the following breakdown:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4xAr8QpgNXYb87XWzOaJcZ/baf15d5818d5e5a9335540da5d0ed87d/Cloudflare-boringssl-ciphers-1.png" />
            
            </figure><p>BoringSSL speed tells us that AES-128-GCM, <a href="/it-takes-two-to-chacha-poly/">ChaCha20-Poly1305</a> and AES-128-CBC-SHA1 can achieve encryption speeds of 3,733.3 MB/s, 1,486.9 MB/s and 387.0 MB/s, but this speed varies greatly as a function of the record size. Indeed we see that GCM uses proportionately less CPU time.</p><p>Still the CPU time consumed by encryption and decryption depends on typical record size, as well as the amount of data processed, both metrics we don’t currently log. We do know that ChaCha20-Poly1305 is usually used by older phones, where the connections are short lived to save power, while AES-CBC is used for … well your guess is as good as mine who still uses AES-CBC and for what, but good thing its usage keeps <a href="/aes-cbc-going-the-way-of-the-dodo/">declining</a>.</p><p>Finally keep in mind that 6.8% of BoringSSL usage in the graph translates into 6.8% x 1.8% = 0.12% of total CPU time.</p>
    <div>
      <h3>Public Key</h3>
      <a href="#public-key">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3J8LQ4EYzEy2w7hFqmQRKU/87a4663fc2b28f0903cdb7dcc0a98dd5/Cloudflare-boringssl-pubkey-1.png" />
            
            </figure><p>Public key algorithms in TLS serve two functions.</p><p>The first function is as a key exchange algorithm, the prevalent algorithm here is ECDHE that uses the NIST P256 curve, the runner up is ECDHE using DJB’s x25519 curve. Finally there is a small fraction that still uses RSA for key exchange, the only key exchange algorithm currently used, that does not provide Forward Secrecy guarantees.</p><p>The second function is that of a signature used to sign the handshake parameters and thus authenticate the server to the client. As a signature RSA is very much alive, present in almost one quarter of the connections, the other three quarters using ECDSA.</p><p>BoringSSL speed reports that a single core on our server can perform 1,120 RSA2048 signatures/s, 120 RSA4096 signatures/s, 18,477 P256 ESDSA signatures/s, 9,394 P256 ECDHE operations/s and 9,278 x25519 ECDHE operations/s.</p><p>Looking at the CPU consumption, it is clear that RSA is <i>very</i> expensive. Roughly half the time BoringSSL performs an operation related to RSA. P256 consumes twice as much CPU time as x25519, but considering that it handles twice as much key-exchanges, while also being used as a signature, that is commendable.</p><p>If you want to make the internet a better place, please get an ECDSA signed certificate next time!</p>
    <div>
      <h3>Hash functions</h3>
      <a href="#hash-functions">
        
      </a>
    </div>
    <p>Only two hash function are currently used in TLS: SHA1 and SHA2 (including SHA384). SHA3 will probably debut with TLS1.3. Hash functions serve several purposes in TLS. First, they are used as part of the signature for both the certificate and the handshake, second they are used for key derivation, finally when using AES-CBC, SHA1 and SHA2 are used in HMAC to authenticate the records.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/KdvAh7bAu4nqYOG51WpYM/d2aa3e1a0b9ede77a8e4cf71b38c8707/Cloudflare-boringssl-hash.png" />
            
            </figure><p>Here we see SHA1 consuming more resources than expected, but that is really because it is used as HMAC, whereas most cipher suites that negotiate SHA256 use AEADs. In terms of benchmarks BoringSSL speed reports 667.7 MB/s for SHA1, 309.0 MB/s for SHA256 and 436.0 MB/s for SHA512 (truncated to SHA384 in TLS, that is not visible in the graphs because its usage approaches 0%).</p>
    <div>
      <h3>Conclusions</h3>
      <a href="#conclusions">
        
      </a>
    </div>
    <p>Using TLS is very cheap, even at the scale of Cloudflare. Modern crypto is very fast, with AES-GCM and P256 being great examples. RSA, once a staple of cryptography, that truly made SSL accessible to everyone, is now a dying dinosaur, replaced by faster and safer algorithms, still consumes a disproportionate amount of resources, but even that is easily manageable.</p><p>The future however is less clear. As we approach the era of Quantum computers it is clear that TLS must adapt sooner rather than later. We already support <a href="/sidh-go/">SIDH</a> as a key exchange algorithm for some services, and there is a <a href="https://csrc.nist.gov/Projects/Post-Quantum-Cryptography/Round-1-Submissions">NIST competition</a> in place, that will determine the most likely Post Quantum candidates for TLS adoption, but none of the candidates can outperform P256. I just hope that when I profile our edge two years from now, my conclusion won’t change to “Whoa, crypto is expensive!”.</p> ]]></content:encoded>
            <category><![CDATA[Speed & Reliability]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[SSL]]></category>
            <category><![CDATA[TLS]]></category>
            <category><![CDATA[RSA]]></category>
            <category><![CDATA[Cryptography]]></category>
            <guid isPermaLink="false">6OipoHQSeuRdGuvjIXuLra</guid>
            <dc:creator>Vlad Krasnov</dc:creator>
        </item>
        <item>
            <title><![CDATA[AES-CBC is going the way of the dodo]]></title>
            <link>https://blog.cloudflare.com/aes-cbc-going-the-way-of-the-dodo/</link>
            <pubDate>Fri, 21 Apr 2017 16:44:29 GMT</pubDate>
            <description><![CDATA[ A little over a year ago, Nick Sullivan talked about the beginning of the end for AES-CBC cipher suites, following a plethora of attacks on this cipher mode. ]]></description>
            <content:encoded><![CDATA[ <p>A little over a year ago, Nick Sullivan <a href="/padding-oracles-and-the-decline-of-cbc-mode-ciphersuites/">talked about</a> the beginning of the end for AES-CBC cipher suites, following a plethora of attacks on this cipher mode.</p><p>Today we can safely confirm that this prediction is coming true, as for the first time ever the share of AES-CBC cipher suites on Cloudflare’s edge network dropped below that of <a href="/it-takes-two-to-chacha-poly/">ChaCha20-Poly1305</a> suites, and is fast approaching the 10% mark.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1Nlmap0WYRSOk7Y2UdI8ww/f73d5e7ed173d992dc36ae3f0c9d2579/153059715_fad3b8be43_z.jpg" />
            
            </figure><p><a href="https://creativecommons.org/licenses/by-sa/2.0/">CC BY-SA 2.0</a> <a href="https://www.flickr.com/photos/andreweason/153059715/in/photolist-ewtjB-4DuF2q-7nWzyC-54VpEC-piTG3-e9gFka-47jfK-47jfh-47jfC-47jfq-47jf5-54VpFf-gTEbKu-54VpDJ-KvpMZH-47iKQ-7527ue-49Y6Z6-7dcwjq-6kGs2K-kmBTE-8vEFRq-4NfTAs-5AXLyv-qCxMrX-6Th9Ds-7oN3Zc-59wsSQ-5vyf5e-qHrCWQ-JWpMjc-4BqcyP-qFe6ky-aH51WB-7zxqQ-dsFacY-7uv9Qi-4PMzMv-9WUNfe-7yZJHo-9xVWK-sfqKtc-eHEhYe-qpiFHG-apXNix-9tnNDQ-7jdmAj-8Bwgp7-8UsZhm-55ke5e">image</a> by <a href="https://www.flickr.com/photos/andreweason/">aesop</a></p><p>Over the course of the last six months, AES-CBC shed more than 33% of its “market” share, dropping from 20% to just 13.4%.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3gz1nglJIcaJvAFH5DHWJs/e32c986781b4f816b3edd4301129564a/cipher-ms.png" />
            
            </figure><p>All of that share, went to AES-GCM, that currently encrypts over 71.2% of all connections. <a href="/it-takes-two-to-chacha-poly/">ChaCha20-Poly1305</a> is stable, with 15.3% of all connections opting for that cipher. Surprisingly 3DES is still around, with 0.1% of the connections.</p><p>The internal AES-CBC cipher suite breakdown as follows:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/yeTAZ34KUHiQXPku20xEF/70eb66c65844ca1a6bd5344169bd65f8/CBC.png" />
            
            </figure><p>The majority of AES-CBC connections use ECDHE-RSA or RSA key exchange, and not ECDHE-ECDSA, which implies that we mostly deal with older clients.</p>
    <div>
      <h3>RSA is also dying</h3>
      <a href="#rsa-is-also-dying">
        
      </a>
    </div>
    <p>In other good new, the use of <a href="/ecdsa-the-digital-signature-algorithm-of-a-better-internet/">ECDSA</a> surpassed that of RSA at the beginning of the year. Currently more than 60% of all connections use the ECDSA signature.</p><p>Although 2048-bit RSA is not broken, it is generally considered less secure than 256-bit ECDSA, and is significantly slower to boot.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1Tro9KjStX75FiUaOngQZ/03c7701079026f519e5a2bdaad669ce8/signature.png" />
            
            </figure>
    <div>
      <h3>PFS is king</h3>
      <a href="#pfs-is-king">
        
      </a>
    </div>
    <p>Last, but not least, 98.4% of all connections are PFS, using ECDHE for key exchange. That's up from 97.6% six months ago.</p><p>All in all we see the continuation of the positive trend on the web towards safer and faster cryptography. We believe this trend will continue with the finalization of <a href="/introducing-tls-1-3/">TLS 1.3</a> later this year.</p> ]]></content:encoded>
            <category><![CDATA[RSA]]></category>
            <category><![CDATA[Security]]></category>
            <guid isPermaLink="false">1hf5oN6lFgDIbWL26jQ4x7</guid>
            <dc:creator>Vlad Krasnov</dc:creator>
        </item>
        <item>
            <title><![CDATA[Introducing TLS 1.3]]></title>
            <link>https://blog.cloudflare.com/introducing-tls-1-3/</link>
            <pubDate>Tue, 20 Sep 2016 13:04:52 GMT</pubDate>
            <description><![CDATA[ The encrypted Internet is about to become a whole lot snappier. When it comes to browsing, we’ve been driving around in a beat-up car from the 90s for a while. Little does anyone know, we’re all about to trade in our station wagons for a smoking new sports car.  ]]></description>
            <content:encoded><![CDATA[ <p><b><i>CloudFlare is turbocharging the encrypted internet</i></b></p><p>The encrypted Internet is about to become a whole lot snappier. When it comes to browsing, we’ve been driving around in a beat-up car from the 90s for a while. Little does anyone know, we’re all about to trade in our station wagons for a smoking new sports car. The reason for this speed boost is TLS 1.3, a new encryption protocol that improves both speed and security for Internet users everywhere. As of today, TLS 1.3 is available to all CloudFlare customers.</p>
    <div>
      <h3>The Encrypted Internet</h3>
      <a href="#the-encrypted-internet">
        
      </a>
    </div>
    <p>Many of the major web properties you visit are encrypted, which is indicated by the padlock icon and the presence of “https” instead of “http” in the address bar. The “s” stands for secure. When you connect to an HTTPS site, the communication between you and the website is encrypted, which makes browsing the web dramatically more secure, protecting your communication from prying eyes and the <a href="/an-introduction-to-javascript-based-ddos/">injection of malicious code</a>. HTTPS is not only used by websites, it also secures the majority of APIs and mobile application backends.</p><p>The underlying technology that enables secure communication on the Internet is a protocol called Transport Layer Security (TLS). TLS is an evolution of Secure Sockets Layer (SSL), a protocol developed by Netscape in the 1990s. The Internet Engineering Task Force (IETF), a standards body, has been in charge of defining the protocol, which has gone through several iterations. The last version, TLS 1.2, was standardized in 2008 and is currently supported by the majority of browsers and HTTPS-enabled web services.</p><p>TLS 1.2 can be secure when configured correctly, but its age has begun to show. In the last few years, several high-profile attacks have been published that revealed flaws in the protocol. Eight years is a long time in computer security, so the IETF have been working on a new version of the protocol, TLS 1.3, which should be finalized by the end of 2016.</p><p>TLS 1.3 is a major overhaul and has two main advantages over previous versions:</p><ul><li><p>Enhanced security</p></li><li><p>Improved speed</p></li></ul>
    <div>
      <h3>Enhanced Security</h3>
      <a href="#enhanced-security">
        
      </a>
    </div>
    <p>Most of the attacks on TLS from the last few years targeted vestigial pieces of the protocol left around from the 90s. TLS 1.2 is highly configurable, and vulnerable sites simply failed to disable the older features in hopes of being compatible with old browsers.</p><p>TLS 1.3 embraces the “less is more” philosophy, removing support for older broken forms of cryptography. That means you can’t turn on the potentially vulnerable stuff, even if you try. The list of TLS 1.2 features that have been removed is extensive, and most of the exiled features have been associated with high profile attacks. These include:</p><ul><li><p>RSA key transport — <a href="/staying-on-top-of-tls-attacks/">Doesn’t provide forward secrecy</a></p></li><li><p>CBC mode ciphers — Responsible for <a href="/taming-beast-better-ssl-now-available-across/">BEAST</a>, and <a href="https://en.wikipedia.org/wiki/Lucky_Thirteen_attack">Lucky 13</a></p></li><li><p>RC4 stream cipher — <a href="/killing-rc4-the-long-goodbye/">Not secure for use in HTTPS</a></p></li><li><p>SHA-1 hash function — <a href="/why-its-harder-to-forge-a-sha-1-certificate-than-it-is-to-find-a-sha-1-collision/">Deprecated in favor of SHA-2</a></p></li><li><p>Arbitrary Diffie-Hellman groups — <a href="http://blog.intothesymmetry.com/2016/01/openssl-key-recovery-attack-on-dh-small.html">CVE-2016-0701</a></p></li><li><p>Export ciphers — Responsible for <a href="https://freakattack.com/">FREAK</a> and <a href="/logjam-the-latest-tls-vulnerability-explained/">LogJam</a></p></li></ul>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/49hiXpSgZTn0owXevua6P6/00129c545ce0979a6bab5b34a8da5d32/image02.jpg" />
            
            </figure><p>CC 2.0 Generic <a href="https://www.flickr.com/photos/aquamech-utah/24445365953">Aqua Mechanical</a></p><p>TLS 1.3 removes the “bad crypto smell” of these legacy features, making it less likely that attacks on previous versions of the protocol will affect TLS 1.3. This streamlining also makes TLS 1.3 much simpler to configure for server operators. A secondary side effect of the update is that the protocol can be made much faster, resulting in a better web browsing experience.</p>
    <div>
      <h3>Improved Speed</h3>
      <a href="#improved-speed">
        
      </a>
    </div>
    <p>Fast page load times are critical to the success of web services. Amazon famously <a href="https://www.gigaspaces.com/blog/amazon-found-every-100ms-of-latency-cost-them-1-in-sales/">found that every additional 100ms of page load time decreases sales by 1%</a>. A major component of page load time is latency: the time it takes to send data between the browser and the web server.</p><p>The impact of latency is especially noticeable for:a) users on mobile devicesb) users that geographically far away from the server</p><p>A message from Sydney to New York and back can take over 200ms, enough for <a href="https://hpbn.co/primer-on-web-performance/#speed-performance-and-human-perception">humans to notice</a>. Mobile browsing can also increase latency for a connection. Sending a message over a modern 4G mobile network routinely adds over 100ms of latency to requests. On 3G networks, which are still common in Europe, <a href="https://opensignal.com/blog/2014/03/10/lte-latency-how-does-it-compare-to-other-technologies/">add over 200ms of additional latency</a>. Even home WiFi connections and ISPs add dozens of milliseconds to requests. This additional latency can make mobile browsing feel slow. Unfortunately, encryption can make these slow connections seem slower. TLS 1.3 helps improve this situation.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2vhUThCtQG95GVCJoweEzN/351c7a3163f0404416606e98d24e6301/handshake-1443446541etN.jpg" />
            
            </figure><p>To send a message to an encrypted site, you must first establish shared cryptographic keys. This process is called a cryptographic handshake. It requires special messages to be sent back and forth between the browser and the website. The TLS handshake happens behind the scenes whenever you connect to an encrypted site with your browser.</p><p>With TLS 1.2, two <a href="https://www.cloudflare.com/learning/cdn/glossary/round-trip-time-rtt/">round-trips</a> are needed to complete the handshake before the request can be sent. Accessing a site over a mobile network can add more than half a second to its load time. With TLS 1.3, the initial handshake is cut in half, requiring only one round-trip. That’s like going from a fast station wagon (0-60mph in 10 seconds) to a Tesla Model S (5 seconds).</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/9Dw3e5yPlJrQ54CaR7UE1/842b2e25dee71ce2d6fd49eac1fc7e59/image01.jpg" />
            
            </figure><p>If the round-trip time for a connection is around 100ms, the speed boost from TLS 1.3 is enough to take sites that seem <a href="https://hpbn.co/primer-on-latency-and-bandwidth/#speed-of-light-and-propagation-latency">“sluggish”</a> (over 300ms), and turn them into sites that load comfortably fast (under 300ms).</p><p>The more efficient handshake is only possible because some of the legacy features present in TLS 1.2 were removed from the protocol. TLS 1.3 also has the additional advantage that for sites you’ve visited recently, you can send data on the first message to the server. This is called “zero round trip” mode (0-RTT) and will result in even faster load times. CloudFlare is planning to support TLS 1.3 0-RTT in the coming weeks.</p>
    <div>
      <h3>Live for all</h3>
      <a href="#live-for-all">
        
      </a>
    </div>
    <p>TLS 1.3 is huge step forward for web security and performance. It’s available to all CloudFlare customers, and enabled by default for all Free and Pro customers. You will find the toggle to enable/disable TLS 1.3 in the Crypto tab of the CloudFlare dashboard.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2gBklXLwNX8MsBrkyjoqup/96d12ceb76d73c581d91f75453f20d29/image00.png" />
            
            </figure><p>The TLS 1.3 specification is still being polished, but the IETF is very close to settling on a final version of the protocol. Major browser vendors Firefox and Chrome have implemented preliminary versions of TLS 1.3 in their developer releases (<a href="https://nightly.mozilla.org/">Firefox Nightly</a> and <a href="https://www.google.com/chrome/browser/canary.html">Chrome Canary</a>), and we’re updating our implementation to match the current version in these browsers until the specification is final. Expect a faster, safer web browsing experience as more browsers enable TLS 1.3 by default in the coming months.</p><hr /><p><b>How to enable TLS 1.3 in your browser</b></p><p>Firefox Nightly</p><ul><li><p>Install and run Firefox nightly: <a href="https://nightly.mozilla.org/">https://nightly.mozilla.org/</a></p></li><li><p>Enter "about:config" in the address bar</p></li><li><p>Set security.tls.version.max from 3 to 4</p></li><li><p>Restart the browser</p></li></ul><p>Chrome Canary</p><ul><li><p>Install and run Chrome Canary: <a href="https://www.google.com/chrome/browser/canary.html">https://www.google.com/chrome/browser/canary.html</a></p></li><li><p>Enter "chrome://flags/" in the address bar</p></li><li><p>Go to "Maximum TLS version enabled." and select "TLS 1.3"</p></li><li><p>Restart the browser</p></li></ul> ]]></content:encoded>
            <category><![CDATA[TLS 1.3]]></category>
            <category><![CDATA[TLS]]></category>
            <category><![CDATA[HTTPS]]></category>
            <category><![CDATA[RSA]]></category>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Chrome]]></category>
            <category><![CDATA[Crypto Week]]></category>
            <guid isPermaLink="false">1J6z7Vg0DdDXcGHtmBJuNz</guid>
            <dc:creator>Nick Sullivan</dc:creator>
        </item>
        <item>
            <title><![CDATA[Why it’s harder to forge a SHA-1 certificate than it is to find a SHA-1 collision]]></title>
            <link>https://blog.cloudflare.com/why-its-harder-to-forge-a-sha-1-certificate-than-it-is-to-find-a-sha-1-collision/</link>
            <pubDate>Tue, 22 Dec 2015 16:43:52 GMT</pubDate>
            <description><![CDATA[ It’s well known that SHA-1 is no longer considered a secure cryptographic hash function. Researchers now believe that finding a hash collision (two values that result in the same value when SHA-1 is applied) is inevitable and likely to happen. ]]></description>
            <content:encoded><![CDATA[ <p>It’s well known that SHA-1 is no longer considered a secure cryptographic hash function. Researchers now believe that finding a hash collision (two values that result in the same value when SHA-1 is applied) is inevitable and likely to happen in a matter of months. This poses a potential threat to trust on the web, as many websites use certificates that are digitally signed with algorithms that rely on SHA-1. Luckily for everyone, finding a hash collision is <i>not</i> enough to forge a digital certificate and break the trust model of the Internet.</p><p>We’ll explore how hash collisions have been used to forge digital signatures in the past. We’ll also discuss how certificate authorities can make this significantly harder for attackers in the future by including randomness in certificate serial numbers.</p>
    <div>
      <h3>Digital signatures are the bedrock of trust</h3>
      <a href="#digital-signatures-are-the-bedrock-of-trust">
        
      </a>
    </div>
    <p>The Internet relies on trust. Whether it’s logging in to your bank or reading Reddit, HTTPS protects you by encrypting the data you exchange with a site and authenticating the site's identity with a digital certificate. Browsers visually display the added security of HTTPS as a padlock in the address bar.</p><p>HTTPS can prove a site’s authenticity to a browser when a site owns a digital certificate that asserts the owner’s identity and hostname. Certificates are small files digitally signed by trusted third parties known as Certificate Authorities (CAs). For browsers, digital signatures are the definitive source of trust. If your browser trusts the CA and the digital signature on the certificate is correct, then the browser trusts the certificate. This system of identity is known as the public key infrastructure (PKI), something we’ve covered <a href="/how-to-build-your-own-public-key-infrastructure/">in detail in a previous post</a>.</p><p>This system falls apart if digital signatures can no longer be trusted. If someone can create a certificate for cloudflare.com with a signature from a trusted CA, they can use it to impersonate the cloudflare.com website to visitors (given they can <a href="/dnssec-an-introduction">modify DNS</a>).</p><p>A digital signature is a number cryptographically tied to a message with public key. Every digital signature requires a public-private key pair and a hash function. The hash function is used to take the message and replace it with a unique digest, the private key is used to sign, and the public key to verify signatures.</p><p>For example, to create an RSA signature, you take a hash of the message and encrypt that hash with your private key. Anyone can verify that signature both belongs to you and is valid for the associated message. Take the public key, decrypt the hash and compare it with the hash of the message. If it's a match, the signature is correct. <a href="/ecdsa-the-digital-signature-algorithm-of-a-better-internet/">ECDSA</a> is a more recent algorithm that gets the same job done.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/DECDGDpoEwCG0eHS4QmLn/8df3a6e7d0f0a4ddf9c8351e94f27b08/rsa-signing-1.png" />
            
            </figure><p>There are several ways of obtaining a digitally signed certificate for a website. The standard way is by purchasing a certificate from a certificate authority like GlobalSign or Comodo. CAs follow a set of rules about certificate issuance, governed by CA/Browser Forum’s <a href="https://cabforum.org/baseline-requirements/">Baseline Requirements</a>.</p><p>Another way to get a certificate is to steal a CA’s private key. In addition to being potentially illegal, it is also very hard to do: CA private keys are usually kept in dedicated secure machines called Hardware Security Modules (HSM) designed to protect against key extraction.</p><p>A third more interesting way to obtain a certificate is to create a certificate that has the same hash as an existing trusted certificate. The signature from the trusted certificate can be added to the untrusted certificate, making it appear trusted.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6v5ZRqGjgWN7MI75yf6SBP/09d2a0d7103d40ae775cf46e2157fd31/rsa-signing-2.png" />
            
            </figure><p>If you can find a message that has the same hash value as a signed message, then you can swap in your message and the signature will verify correctly. This can be used to trick anyone into thinking someone signed a message that they didn’t.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7JUU3Fxeaazw6RMm22opTu/c37aa56bd43d5b8102319d8b863fbfb1/rsa-signing-3.png" />
            
            </figure><p>Cryptographic hash functions are designed to resist this sort of thing. They don’t always succeed.</p>
    <div>
      <h3>Security properties of hash functions</h3>
      <a href="#security-properties-of-hash-functions">
        
      </a>
    </div>
    <p>Cryptographic hash functions are designed to satisfy three security properties:</p><ul><li><p>collision resistance</p></li><li><p>second pre-image resistance</p></li><li><p>pre-image resistance</p></li></ul><p>Collision resistance here means there are no known algorithms faster than brute force to find two values that hash to the same value. This is the strongest security requirement, and usually the first one to be broken.</p><p>A hash function has second pre-image resistance when, given a value and its hash, it is computationally infeasible to find a second value that hashes to the same value. On the surface, this would seem like the security property that protects digital signatures on certificates. However, as we’ll explore in the next section, it’s still possible to forge certificates signed with a second pre-image resistant hash.</p><p>Pre-image resistance means that given a hash, it’s computationally infeasible for an attacker to find a value that hashes to it. If you can find a pre-image, you can easily find a second pre-image or a collision.</p><p>In the next section, we’ll describe what happened the last time we used a cryptographic hash function without collision resistance for digital signatures.</p>
    <div>
      <h3>Breaking MD5</h3>
      <a href="#breaking-md5">
        
      </a>
    </div>
    <p>MD5 is an incredibly popular cryptographic hash function; it also happens to be completely broken with respect to collision resistance. MD5 is still widely used, just not for digital signatures.</p><p>The first collision in MD5, discovered in <a href="https://eprint.iacr.org/2004/199.pdf">2004 by a group of Chinese researchers (PDF)</a>, used a lot of math and about an hour of computation by a supercomputer. Today, computing an MD5 collision takes only seconds on a laptop. This was cleverly demonstrated by <a href="http://natmchugh.blogspot.com/2014/10/how-i-created-two-images-with-same-md5.html">Nat McHugh</a>, who used a chosen-prefix hash collision (more on this later) in MD5 to create two images with the same hash—in this case Barry White and James Brown (he later created a three-way collision with <a href="http://natmchugh.blogspot.com/2014/11/three-way-md5-collision.html">Jack Black</a>).</p><p>Three images with the same MD5 hash:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5Y4r54sl9X78iapskroWkw/854aa7c2211ddee02fa67467c641a56b/white.jpg" />
            
            </figure><p></p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3DnAT2RzFjTvssur0eOceu/e84ae3e2ca5c6a35fd3bb034303e286b/brown.jpg" />
            
            </figure><p></p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5hARGIj78j9wtOwXzqetBv/b061d4f5ffd8863c4a81e52dcdeb2966/black.jpg" />
            
            </figure><p>You can verify this yourself via <code>curl</code> and <code>md5</code>:</p>
            <pre><code>$ curl -s https://blog.cloudflare.com/content/images/2015/08/white.jpg | md5
b69dd1fd1254868b6e0bb8ed9fe7ecad
$ curl -s https://blog.cloudflare.com/content/images/2015/08/brown.jpg | md5
b69dd1fd1254868b6e0bb8ed9fe7ecad
$ curl -s https://blog.cloudflare.com/content/images/2015/08/black.jpg | md5
b69dd1fd1254868b6e0bb8ed9fe7ecad</code></pre>
            <p>Despite being relatively trivial to find an MD5 collision, it’s still not known how to perform a second-preimage attack on MD5. For example, given a digitally signed certificate, nobody has been able to create a second certificate with the same hash. Despite this, researchers created a <a href="http://www.win.tue.nl/hashclash/rogue-ca/">certificate</a> with the same signature as a certificate trusted by browsers.</p><p>The technique they used, a chosen-prefix attack, was originally proposed by Marc Stevens in his <a href="http://www.win.tue.nl/hashclash/On%20Collisions%20for%20MD5%20-%20M.M.J.%20Stevens.pdf">Master’s Thesis</a>. It can be used to create a forged certificate as long as you can get a certificate authority to issue a certificate that starts with predictable values.</p>
    <div>
      <h3>Chosen-prefix attacks</h3>
      <a href="#chosen-prefix-attacks">
        
      </a>
    </div>
    <p>If you can find a collision, you can take two different values and append data to each so they hash to the same value. In the original MD5 collision attack, the researchers computed two messages <code>M1</code> and <code>M2</code> such that <code>H(M1) = H(M2)</code>. Stevens extended this research to find a way to make two known values <code>P1</code> and <code>P2</code> collide by appending bytes. With prefixes <code>P1</code> and <code>P2</code>, he was able to demonstrate how to find S1 and S2 so that <code>H(P1|S1) = H(P2|S2)</code>.</p><p>This was enough to allow an attacker to create two certificates with the same hash. Let’s look at the approximate structure of a certificate:</p><ul><li><p>Serial number</p></li><li><p>Validity period</p></li><li><p><a href="https://www.cloudflare.com/learning/dns/glossary/what-is-a-domain-name/">Domain name</a></p></li><li><p>Public key</p></li><li><p>X.509 extensions</p></li><li><p>Signature</p></li></ul><p>If the attacker knows every value before the domain, then they can take</p>
            <pre><code>P1 = Serial number | Validity period | real domain name</code></pre>
            <p>and</p>
            <pre><code>P2 = Serial number | Validity period | forged domain name</code></pre>
            <p>and apply the attack to get S1 and S2 that fit into the public key section. If the serial number and validity period can be predicted, a collision can be found using the following steps:</p><ol><li><p>Guess when the certificate will be issued;</p></li><li><p>Predict the serial number for certificates issued in that time period; and</p></li><li><p>Compute matching prefixes for several guesses covering the expected serial numbers and issuance dates</p></li></ol>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/79PwdrVZnzNpdV3JWdnUdw/c4407fb3b97a6384778d10df999ea8d7/sha-1-certificate-forgery-1.png" />
            
            </figure><p>The attacker precomputes chosen-prefix collisions for the choices for each of these values, where one prefix has a domain name that is under the requester’s control (e.g. for attacker.com) and one for the target domain (e.g. google.com). The "collision bits" that cause the two certificates to collide end up aligning with first few bytes of the public key of the certificate.</p><p>Once the collisions are computed, the attacker has to convince a CA to issue a certificate with the correct serial number at the correct time for a verifiable domain and a public key that corresponds to the collision bits. If they're lucky, the certificate the CA returns will have the same hash as the malicious certificate. They can then transpose the valid signature onto the malicious certificate to make it trusted.</p><p>Colliding the domain name is the simplest type of chosen-prefix collision attack. It is also possible to prepare the collision in such a way that the RSA public key from the trusted certificate lines up with the X.509 extensions of the forged certificate. This is much more dangerous since it allows the forged certificate to set the "Is CA" bit. As long as the <a href="https://technet.microsoft.com/en-us/library/cc737026(v=ws.10).aspx">path length constraint</a> of the signing CA is large enough, this forged CA would be able to issue trusted certificates for any domain.</p>
    <div>
      <h3>Forging MD5 certificates in practice</h3>
      <a href="#forging-md5-certificates-in-practice">
        
      </a>
    </div>
    <p>In 2008, several researchers (including Marc Stevens and Alex Sotirov) used chosen prefix collision techniques to <a href="http://www.win.tue.nl/hashclash/rogue-ca/">forge a certificate authority</a> trusted by browsers. This proof of concept was presented at the Chaos Communication Congress in 2008 and required only a few days of computation.</p><p>In 2012, a piece of malware called Flame was discovered. Flame was able infect computers by hijacking Microsoft’s Windows Update mechanism. At the time, Windows Update validated updates by checking code signatures using certificates signed by Microsoft using a MD5-based signature. The authors of Flame used a forged Microsoft certificate. According to an <a href="http://blog.trailofbits.com/2012/06/11/analyzing-the-md5-collision-in-flame/">analysis of this certificate</a>, it was likely the chosen-prefix technique was used to create Flame’s forged certificate.</p><p>Forbes declared this <a href="http://www.forbes.com/sites/richardstiennon/2012/06/14/flames-md5-collision-is-the-most-worrisome-security-discovery-of-2012/">the most worrisome security discovery of 2012</a> since it demonstrated it was feasible for attackers to forge any website’s certificate using an MD5 hash collision when the client trusts MD5-signed certificates.</p>
    <div>
      <h3>SHA-1 vs MD5</h3>
      <a href="#sha-1-vs-md5">
        
      </a>
    </div>
    <p>SHA-1 is supposedly more secure than MD5 for use in digital signatures. The National Security Agency published SHA-1 (SHA stands for Secure Hash Algorithm) in 1995 as a standard for cryptographically secure hashing. Designed to be collision resistant up to 2<sup>80</sup> bits, SHA-1 has had a long and useful life, and a collision has not been published as of this blog post. Even though a collision has never been published, several theoretical attacks (the <a href="http://gauss.ececs.uc.edu/Courses/c653/lectures/Hashing/sha1-crypto-auth-new-2-yao.pdf">first in 2005</a>, improved <a href="http://2012.sharcs.org/slides/stevens.pdf">in 2012</a>) indicate that SHA-1 is not as secure as its bit length implies. The latest research suggests that its collision resistance is <a href="https://marc-stevens.nl/research/papers/PhD%20Thesis%20Marc%20Stevens%20-%20Attacks%20on%20Hash%20Functions%20and%20Applications.pdf">at best 265</a> — within the realm of feasibility for some governments. In fact, researchers published a freestart collision (a precursor to a full collision) for SHA-1 <a href="https://eprint.iacr.org/2015/967.pdf">earlier this year</a>.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/dR7YVWkazh7VY1IGSz8tb/e171383cbc753cb8fefcbf911b525eb3/Sharks_outside_cage.jpg" />
            
            </figure><p><a href="https://en.wikipedia.org/wiki/Shark_proof_cage#/media/File:Sharks_outside_cage.jpg">CC BY-SA 2.0</a></p><p>Academic cryptanalysts are like sharks. If there's blood in the water, they swarm. It took nine years to get from the first published weakness in MD5 (<a href="http://cseweb.ucsd.edu/~bsy/dobbertin.ps">1996</a>) to a hash collision (<a href="https://www.schneier.com/blog/archives/2005/06/more_md5_collis.html">2005</a>), and then another three years to forge a trusted digital signature (<a href="http://www.win.tue.nl/hashclash/rogue-ca/">2008</a>). They might be slow, but they're relentless.</p><p>Attacks always improve and computers get more powerful. It was nine years from first weakness to hash collision in MD5; it's been ten years for SHA-1. If history is any guide, a public collision for SHA-1 could be published at any moment, with chosen-prefix collisions arriving soon after.</p>
    <div>
      <h3>Preventing chosen-prefix attacks by requiring serial number entropy</h3>
      <a href="#preventing-chosen-prefix-attacks-by-requiring-serial-number-entropy">
        
      </a>
    </div>
    <p>One way to improve the security of digital signatures against a chosen-prefix attack is to make the prefix less predictable.</p><p>As described above, the chosen prefix attack requires the attacker to predict both the serial number and the validity period. Certificates used on the web have serial numbers up to 160 bits long. Requiring CAs to make the serial number unpredictable instead of sequential, it is possible to make the chosen-prefix attack significantly more expensive.</p><p>For example, if a CA ensures the serial number contains 20 bits of entropy, then the attacker will need to compute 220 chosen-prefixes in order to guess the serial number correctly.</p><p>This makes the attack over a <i>million times</i> more difficult.</p><p>Computing a SHA-1 collision might be feasible in 2016, and there's a chance that chosen-prefix attacks also become feasible. Nevertheless, choosing partially randomized serial can make certificate forgery significantly more difficult for attackers. Barring a breakthrough in hash collision techniques, it's unlikely we'll see a certificate collision for long time.</p>
    <div>
      <h3>Conclusion</h3>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>The SHA-1 hash function, widely used for everything from file integrity to digital signatures, is at the end of its useful life. Some browsers even show security warnings when websites use certificates signed using a SHA-1 based digital signature. A hash collision in SHA-1 is bad, but it’s not what matters for web security. Digital signature forgery is more problematic for trust on the Web. Requiring CAs to randomize serial numbers will significantly increase the cost of such forgeries, allowing potentially weak algorithms like SHA-1 to be useful for longer. This is why we make it <b>mandatory</b> for CAs to use serial numbers that include at least 20 bits of entropy in our proposal to the CA/B Forum <a href="https://cabforum.org/pipermail/public/2015-December/006488.html">for Legacy Verified (LV) SHA-1 certificates</a>.</p> ]]></content:encoded>
            <category><![CDATA[Certificate Authority]]></category>
            <category><![CDATA[Reliability]]></category>
            <category><![CDATA[Programming]]></category>
            <category><![CDATA[RSA]]></category>
            <guid isPermaLink="false">4iswx07chNyDPHmCyRPrne</guid>
            <dc:creator>Nick Sullivan</dc:creator>
        </item>
        <item>
            <title><![CDATA[Contributing back to the security community]]></title>
            <link>https://blog.cloudflare.com/contributing-back-to-the-security-community/</link>
            <pubDate>Tue, 21 Apr 2015 22:14:26 GMT</pubDate>
            <description><![CDATA[ This Friday at the RSA Conference in San Francisco, along with Marc Rogers, Principal Security Researcher at CloudFlare, I'm speaking about a version of The Grugq's PORTAL, an open source network security device designed to make life easier and safer. ]]></description>
            <content:encoded><![CDATA[ <p>This <a href="https://www.rsaconference.com/events/us15/agenda/sessions/1689/portal-open-source-secure-travel-router-for">Friday at the RSA Conference</a> in San Francisco, along with <a href="https://marcrogers.org/">Marc Rogers, Principal Security Researcher at CloudFlare</a>, I'm speaking about a version of <a href="https://github.com/grugq/portal">The Grugq's PORTAL</a>, an open source network security device designed to make life easier and safer for anyone traveling, especially internationally, with phones, tablets, laptops, and other network-connected devices.</p><p>Portal uses open-source software and services to take inexpensive, commodity travel routers and turn them into powerful security devices. Since this is pretty far from CloudFlare's core business, it warrants a brief digression into why we support projects like this.</p><p>Computer security was for a very long time only of interest to hobbyists, academics, and obscure government agencies. Cryptography was an interesting offshoot of number theory, a foundational but very abstract part of mathematics, and many of the early infrastructure components of the Internet didn't include security at all -- there was an assumption that anyone who could gain access would be responsible and well-intentioned, a consequence of the academic origins; after all, why would they want to break or steal things which were freely available.</p><p>Before the "cambrian explosion" of commercial computer security, there was still a lot of great security research -- it was just done by academics and by individuals in the "security community", who were motivated by a desire to understand how things worked, and to make tools because they loved the technology and wanted to solve their own problems. Some of the most interesting and powerful security tools available today trace their origins to rather humble open-source, hobbyist, or academic beginnings -- <a href="http://www.openpgp.org/">PGP</a>, <a href="https://www.torproject.org/">Tor</a>, <a href="https://otr.cypherpunks.ca/">OTR</a>, various forms of <a href="https://books.google.com/books?id=QKjhgCNu1D4C&amp;pg=PA239&amp;lpg=PA239&amp;dq=electronic+cash+cypherpunks&amp;source=bl&amp;ots=2tCBInnMLD&amp;sig=9cH2JVoStquYxVQQbMvO9xujO_0&amp;hl=en&amp;sa=X&amp;ei=QEk2Va_TGM_2oATVtYCgDQ&amp;ved=0CEwQ6AEwCA#v=onepage&amp;q=electronic%20cash%20cypherpunks&amp;f=false">electronic cash</a>, and many others. Many of today's most respected people in computer security entered the field during this period, out of personal curiosity or academic interest.</p><p>While CloudFlare is an eager participant in the commercial security world (we're the easiest and fastest way to set up TLS for any website, and we provide edge security and performance to millions of sites, including some of the largest sites on the Internet -- both with free service and paid services in various tiers), we are also very aware of the broad and deep foundation of security tools and research on which we're built.</p><p>CloudFlare makes extensive use of open source software, such as the <a href="http://wiki.nginx.org/Main">Nginx</a> web server, community collections of Web Application Firewall (WAF) rules originally generated by <a href="https://www.owasp.org/index.php/Main_Page">OWASP</a>, and powerful cryptographic algorithms developed in academia and implemented by open source efforts such as the OpenSSL Project.</p><p>Where possible, CloudFlare also contributes back to the community in those areas. We contribute bugfixes and new functionality back to open source packages, and we employ developers who in their spare time make additional contributions to open source software. <a href="https://cloudflare.github.io/">CloudFlare's GitHub Open Source</a> page is a great collection of many of our contributions to open source.</p><p>One of our biggest contributions to date has been <a href="https://github.com/cloudflare/cfssl">CFSSL</a>, CloudFlare's PKI toolkit. We're constantly hearing from various projects and companies how CFSSL has been helpful to them -- one of the most exciting being the <a href="https://letsencrypt.org/">Let's Encrypt</a> community Certificate Authority project. Nick Sullivan has written in the <a href="/introducing-cfssl/">CloudFlare blog announcing CFSSL</a>, and exciting things are continuing to happen with that software.</p><p>CloudFlare, like many other companies in computer security, makes other contributions to the security community. One of the most interesting is that we, like some other companies, values having employees participate in the security community in a variety of ways. Encouraging side projects independent of work -- research, finding new vulnerabilities and responsibly disclosing them, creating new tools, participating in conferences or working groups, running tutorials, and being active in standards bodies -- sometimes doesn't have a direct connection to the company's products, but contributes to a vibrant security ecosystem. There are often unforeseen benefits of these collaborations -- learning about new tools, finding great engineers -- <a href="https://www.cloudflare.com/join-our-team">we're actively hiring for a variety of roles</a> -- and many others.</p><p>Marc and I are grateful to CloudFlare for the time to work on this open source tool and to present it to the world, and we're looking forward to presenting at RSA.</p> ]]></content:encoded>
            <category><![CDATA[CFSSL]]></category>
            <category><![CDATA[RSA]]></category>
            <category><![CDATA[Events]]></category>
            <category><![CDATA[Security]]></category>
            <guid isPermaLink="false">1xwrvpki4ppkGolv6DWRvc</guid>
            <dc:creator>Ryan Lackey</dc:creator>
        </item>
        <item>
            <title><![CDATA[How to ensure your server's software stays secure?]]></title>
            <link>https://blog.cloudflare.com/how-to-ensure-your-servers-software-stays-secure/</link>
            <pubDate>Mon, 17 Mar 2014 10:37:00 GMT</pubDate>
            <description><![CDATA[ At CloudFlare, security is on the top of our minds. We are always looking for ways to better secure the data we are entrusted with and improve the security of our customers' websites.  ]]></description>
            <content:encoded><![CDATA[ <p>At CloudFlare, security is on the top of our minds. We are always looking for ways to better secure the data we are entrusted with and improve the security of our customers' websites. With this in mind, Nick Sullivan, one of our system engineers, will hold a security-themed webcast this Thursday. Some of you may remember that Nick has <a href="/author/nick-sullivan">blogged</a> extensively about web encryption, cryptography and DDoS prevention. Also, he recently spoke about server software protection at the <a href="http://www.rsaconference.com/speakers/nicholas_sullivan">RSA</a> Conference, one of the largest security conferences in the world.</p><p>During Thursday's webcast, Nick will discuss ways that ensure your server's software stays secure. In today's world, you may not know if the hardware you are running software on is secure or not. So, how can you ensure that, regardless of the hardware security, the software stays protected? Nick will discuss advanced techniques on how to protect your server software. These techniques include anti-reverse engineering methods, secure key management and designing a system for renewal.</p><p>To learn more about various ways to secure your server's software, join us at the upcoming webcast on Thursday, March 20th, 2014 at 11AM PDT (2PM EDT). If you have questions you want Nick to address, leave them in the comments below. <a href="https://attendee.gotowebinar.com/register/8861145984722374914">Register here</a>.</p> ]]></content:encoded>
            <category><![CDATA[DDoS]]></category>
            <category><![CDATA[RSA]]></category>
            <category><![CDATA[Events]]></category>
            <guid isPermaLink="false">19Z4cpSsAHXE8rhOwnaTuu</guid>
            <dc:creator>Elenitsa Staykova</dc:creator>
        </item>
        <item>
            <title><![CDATA[ECDSA: The digital signature algorithm of a better internet]]></title>
            <link>https://blog.cloudflare.com/ecdsa-the-digital-signature-algorithm-of-a-better-internet/</link>
            <pubDate>Mon, 10 Mar 2014 16:30:00 GMT</pubDate>
            <description><![CDATA[ This blog post is dedicated to the memory of Dr. Scott Vanstone, popularizer of elliptic curve cryptography and inventor of the ECDSA algorithm. He passed away on March 2, 2014. ]]></description>
            <content:encoded><![CDATA[ <p></p><p><i>This blog post is dedicated to the memory of </i><a href="http://en.wikipedia.org/wiki/Scott_Vanstone"><i>Dr. Scott Vanstone</i></a><i>, popularizer of elliptic curve cryptography and inventor of the ECDSA algorithm. He passed away on March 2, 2014.</i></p><p>At CloudFlare we are constantly working on ways to make the Internet better. An important part of this is enabling our customers to serve their sites encrypted over SSL/TLS. There are some interesting technical challenges in serving sites over TLS at CloudFlare’s scale. The computational cost of the cryptography required on our servers is one of those challenges. <a href="/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography">Elliptic curve cryptography (ECC)</a> is one of the more promising technologies in this area. ECC-enabled TLS is faster and more scalable on our servers and provides the same or better security than the default cryptography in use on the web.</p><p>In this blog post we will explore how one elliptic curve algorithm, the <a href="https://www.cloudflare.com/learning/dns/dnssec/ecdsa-and-dnssec/">elliptic curve digital signature algorithm (ECDSA)</a>, can be used to improve performance on the Internet. The tl;dr is: CloudFlare now supports custom ECDSA certificates for our customers and that’s good for everybody using the Internet.</p>
    <div>
      <h3>Websites and Certificates</h3>
      <a href="#websites-and-certificates">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4q6xtdkaVXcC8o2MH9uvXS/25a359d0170be30953747a1a841cea6f/image01-fs8.png" />
            
            </figure><p>When you visit a site that starts with https:// instead of http://, your browser connects to that site over an encrypted connection. The browser also validates that the site is who it claims to be using public key cryptography and a digital certificate.</p><p>In public key cryptography each person has a pair of keys: a public key and a private key. These are typically numbers that are chosen to have a specific mathematical relationship. In RSA, the public key is a large number that is a product of two primes, plus a smaller number. The private key is a related number. In ECC, the public key is an equation for an elliptic curve and a point that lies on that curve. The private key is a number. See our previous blog post on <a href="/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography">elliptic curve cryptography</a> for more details.</p><p>The private key can be used to create a digital signature for any piece of data using a digital signature algorithm. This typically involves taking a cryptographic hash of the data and operating on it mathematically using the private key. Anyone with the public key can check that this signature was created using the private key and the appropriate signature validation algorithm. A digital signature is a powerful tool because it allows you to publicly vouch for any message.</p><p>A website certificate usually contains two things:</p><ul><li><p>Identity information: Typically who owns the certificate and which domains the certificate is valid for.</p></li><li><p>A public key: The public half of a key pair, the site owner controls and keeps secret the associated private key.</p></li></ul><p>The certificate is digitally signed by a trusted certificate authority who validates the identity of the site owner.</p><p>Since the introduction of SSL by Netscape in 1994, certificates for web sites have typically used a public/private key pair based on the RSA algorithm. As the SSL specification evolved into TLS, support for different public key algorithms were added. One of the supported algorithms is ECDSA which is based on elliptic curves.</p><p>Despite the number of options available in TLS, almost all certificates used on the web today are RSA-based. Web sites have been slow to adopt new algorithms because they want to maintain support for legacy browsers that don’t support the new algorithms. Even as late as 2012, out of 13 million TLS certificates found in a <a href="https://scans.io/study/umich-https">scan of the internet</a>, fewer than 50 use an ECDSA key pair.</p>
    <div>
      <h3>The Popular Choice</h3>
      <a href="#the-popular-choice">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7Gb8DrUFgem6aMVnL5cUxu/fac6fbaacd9a68eb508558e08fa8f24d/popular.jpg" />
            
            </figure><p>Although ECDSA has not taken off on the web, it has become the digital signature scheme of choice for new cryptographic non-web applications.</p><p>Bitcoin is a good example of a system that relies on ECDSA for security. Every Bitcoin address is a cryptographic hash of an ECDSA public key. The ownership of the account is determined by who controls the ECDSA private key. To transfer an amount of Bitcoin to another person, you create a message that says something along the lines of “I give this Bitcoin to address X”, sign it with your private key and submit it to the Bitcoin system. The linchpin of the security and consistency of the Bitcoin system is the security of ECDSA private keys.</p><p>Elliptic curves and ECDSA in particular are also used in messaging and systems security. In Apple’s recent <a href="http://images.apple.com/ipad/business/docs/iOS_Security_Feb14.pdf">white paper on iOS security</a>, they relayed how they use ECDSA extensively in the Apple ecosystem. Messages through iMessage are signed with ECDSA and iCloud keychain syncing relies on ECDSA. More and more technologies are using ECDSA for security, including end-to-end encrypted messaging services <a href="https://github.com/WhisperSystems/TextSecure/">TextSecure</a> and <a href="https://crypto.cat">CryptoCat</a>.</p>
    <div>
      <h3>ECDSA vs RSA</h3>
      <a href="#ecdsa-vs-rsa">
        
      </a>
    </div>
    <p>Why is ECDSA the algorithm of choice for new protocols when RSA is available and has been the gold standard for asymmetric cryptography since 1977? It boils down to the fact that we are better at breaking RSA than we are at breaking ECC.</p><p>As we described in a previous blog post, <a href="/why-are-some-keys-small">the security of a key depends on its size and its algorithm</a>. Some algorithms are easier to break than others and require larger keys for the same level of security. Breaking an RSA key requires you to factor a large number. We are pretty good at factoring large numbers and <a href="http://bristolcrypto.blogspot.com/2013/02/discrete-logarithms.html">getting better all the time</a>. Breaking an ECDSA key requires you to solve the Elliptic Curve Discrete Logarithm Problem (ECDLP). The mathematical community has not made any major progress in improving algorithms to solve this problem since is was independently introduced by Koblitz and Miller in 1985.</p><p>This means that with ECDSA you can get the same level of security as RSA but with smaller keys. Smaller keys are better than larger keys for several reasons. Smaller keys have faster algorithms for generating signatures because the math involves smaller numbers. Smaller public keys mean smaller certificates and less data to pass around to establish a TLS connection. This means quicker connections and faster loading times on websites.</p><p>According to the <a href="http://www.keylength.com/en/3/">ECRYPT II recommendations</a> on key length, a 256-bit elliptic curve key provides as much protection as a 3,248-bit asymmetric key. Typical RSA keys in website certificates are 2048-bits. If we compare the portion of the TLS handshake that happens on the server for 256-bit ECDSA keys against the cryptographically much weaker 2048-bit RSA keys we get the following:</p>
            <pre><code>                        sign/s</code></pre>
            <p>256 bit ecdsa (nistp256)    9516.8
rsa 2048 bits               1001.8</p><p>(openssl 1.0.2 beta on x86_64 with enable-ec_nistp_64_gcc_128)</p><p>That table shows the number of ECDSA and RSA signatures possible per second. On our servers, using an ECDSA certificate reduces the cost of the private key operation by a factor of 9.5x, saving a lot of CPU cycles.</p>
    <div>
      <h3>Hello Future</h3>
      <a href="#hello-future">
        
      </a>
    </div>
    <p>I mentioned earlier that fewer than fifty ECDSA certificate are being used on the web. You can now count <a href="/">https://blog.cloudflare.com</a> among them. If you don't see a lock icon, click <a href="/ecdsa-the-digital-signature-algorithm-of-a-better-internet">here</a> for the HTTPS version of the site. Once you are viewing this site over HTTPS, take a look at the TLS information bar (click on the lock icon in your address bar). You should see the key exchange mechanism listed as ECDHE_ECDSA, which means the certificate is using ECDSA. If the HTTPS version site does not load, your browser probably does not support ECDSA.</p><p>This is an image taken from the Chrome browser under the green lock icon for this page under the connection tab:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4KiZh0xRodKrxYNWsSVhP6/e7fe34d9c6ed24506c500e38edd215fa/image00-fs8.png" />
            
            </figure><p>This blog post is our first experiment using an <a href="https://www.cloudflare.com/application-services/products/ssl/">SSL certificate</a> based on elliptic curves. Our blog is being served by the standard CloudFlare service (yes, we <a href="http://en.wikipedia.org/wiki/Eating_your_own_dog_food">eat our own dog food</a>), and is the first site on CloudFlare that uses an ECDSA certificate. We are happy to annouce that we now support custom ECDSA certificates for all CloudFlare business customers.</p><p>In the near future we will enable code that will allow sites to have a fallback certificate so that visitors with old browsers without ECDSA support can still view their site over HTTPS. Because ECDSA is so much more efficient for our servers, supporting these certificates is an essential step for enabling <a href="/2013-refactoring-2014-stepping-on-the-gas">SSL for free in 2014</a>.</p>
    <div>
      <h3>Danger Zone?</h3>
      <a href="#danger-zone">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1Q8hFV8t9DNdc6Oza80Agd/47f66e312e25003b02a83e3885ff5a1d/image03-fs8.png" />
            
            </figure><p>We can be relatively confident about the mathematical security of ECDSA (save for some questions about the <a href="http://safecurves.cr.yp.to">choice of curve</a>). The history of cryptography shows us that good cryptography has been repeatedly defeated not because of bad math, but because of bad implementations of good math.</p><p>One interesting quirk of the ECDSA algorithm is that every signature requires some random or unpredictable data as input. If the source of randomness is predictable to an attacker, then they can figure out the private key. Hackers have exploited this vulnerability in several high-profile incidents.</p><p>In 2010, a flaw in the way random numbers were used in ECDSA on Sony’s Playstation 3 resulted in a <a href="http://www.exophase.com/20540/hackers-describe-ps3-security-as-epic-fail-gain-unrestricted-access/">private key being leaked</a>. More recently, some Android devices were found to be incorrectly generating random values, resulting in a <a href="https://bitcoin.org/en/alert/2013-08-11-android">massive theft</a> of Bitcoins from devices running Bitcoin software.</p><p>There are other more esoteric attacks against specific ECDSA implementations. Last week, <a href="http://eprint.iacr.org/2014/161.pdf">a paper was published</a> by researchers from Australia and the UK describing an attack on OpenSSL’s implementation of ECDSA for curve secp256k1 (the one used by the Bitcoin protocol). Luckily, this attack is not a threat against busy remote servers.</p><p>The danger of key leakage via poor random data or <a href="http://en.wikipedia.org/wiki/Side_channel_attack">side channel attacks</a> is a concern but is manageable with proper preparation. At CloudFlare we ensure that the system random number generator <a href="/ensuring-randomness-with-linuxs-random-number-generator">has enough entropy</a>. Even if there is a problem with the system PRNG, OpenSSL 1.0.2 has included a fix to reduce the chance of compromise. Cryptography is hard to implement correctly, especially in the context of a complex protocol like TLS as evidenced in some famous <a href="https://www.imperialviolet.org/2014/02/22/applebug.html">recent</a> <a href="http://arstechnica.com/security/2014/03/critical-crypto-bug-leaves-linux-hundreds-of-apps-open-to-eavesdropping/">bug fixes</a>. That said, the benefits seem to outweigh the risks in this case.</p>
    <div>
      <h3>Conclusion</h3>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>On a personal note, Dr. Vanstone was one of my professors at the University of Waterloo. He was passionate about mathematics and cryptography and he was one of the reasons I decided to pursue security engineering as a career. The book he co-authored, <a href="http://cacr.uwaterloo.ca/hac/">The Handbook of Applied Cryptography</a>, is still one of the classics in the field.</p><p>From his <a href="http://www.bulletin.uwaterloo.ca/2014/mar/06th.html">memorial page</a> at the Waterloo Daily Bulletin: "I had studied it enough to believe in it," Vanstone told Silicon Valley North in 2003. "It was the rest of the world that didn't believe in it." He will be missed.</p><p>Elliptic curve cryptography is a powerful technology that can enable faster and more secure cryptography across the Internet. The time has come for ECDSA to be widely deployed on the web, just as Dr. Vanstone hoped. We are taking the first steps towards that goal by enabling customers to use ECDSA certificates on their CloudFlare-enabled sites.</p> ]]></content:encoded>
            <category><![CDATA[TLS]]></category>
            <category><![CDATA[HTTPS]]></category>
            <category><![CDATA[Elliptic Curves]]></category>
            <category><![CDATA[RSA]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Cryptography]]></category>
            <guid isPermaLink="false">5TRiYUEbwT1lwmtUm4G1dE</guid>
            <dc:creator>Nick Sullivan</dc:creator>
        </item>
        <item>
            <title><![CDATA[Red October: CloudFlare’s Open Source Implementation of the Two-Man Rule]]></title>
            <link>https://blog.cloudflare.com/red-october-cloudflares-open-source-implementation-of-the-two-man-rule/</link>
            <pubDate>Thu, 21 Nov 2013 09:00:00 GMT</pubDate>
            <description><![CDATA[ At CloudFlare, we are always looking for better ways to secure the data we’re entrusted with. This means hardening our system against outside threats such as hackers, but it also means protecting against insider threats.  ]]></description>
            <content:encoded><![CDATA[ <p></p><p>At CloudFlare, we are always looking for better ways to secure the data we’re entrusted with. This means hardening our system against outside threats such as hackers, but it also means protecting against insider threats. According to a <a href="http://www.verizonenterprise.com/DBIR/2013/">recent Verizon report</a>, insider threats account for around 14% of data breaches in 2013. While we perform background checks and carefully screen team members, we also implement technical barriers to protect the data with which we are entrusted.</p><p>One good information security practice is known as the “two-man rule.” It comes from military history, where a nuclear missile couldn’t be launched unless two people agreed and turned their launch keys simultaneously. This requirement was introduced in order to prevent one individual from accidentally (or intentionally) starting World War III.</p><p>To prevent the risk of rogue employees misusing sensitive data we built a service in Go to enforce the two-person rule. We call the service Red October after the famous scene from “The Hunt for Red October.” In line with <a href="/a-note-about-kerckhoffs-principle">our philosophy on security software</a>, we are open sourcing the technology so you can use it in your own organization (<a href="https://github.com/cloudflare/redoctober">here’s a link</a> to the public Github repo). If you are interested in the nitty-gritty details, read on.</p>
    <div>
      <h3>What it is</h3>
      <a href="#what-it-is">
        
      </a>
    </div>
    <p>Red October is a cryptographically-secure implementation of the two-person rule to protect sensitive data. From a technical perspective, Red October is a software-based encryption and decryption server. The server can be used to encrypt a payload in such a way that no one individual can decrypt it. The encryption of the payload is cryptographically tied to the credentials of the authorized users.</p><p>Authorized persons can delegate their credentials to the server for a period of time. The server can decrypt any previously-encrypted payloads as long as the appropriate number of people have delegated their credentials to the server.</p><p>This architecture allows Red October to act as a convenient decryption service. Other systems, including CloudFlare’s build system, can use it for decryption and users can delegate their credentials to the server via a simple web interface. All communication with Red October is encrypted with TLS, ensuring that passwords are not sent in the clear.</p>
    <div>
      <h3>How to use it</h3>
      <a href="#how-to-use-it">
        
      </a>
    </div>
    <p>Setting up a Red October server is simple; all it requires is a locally-readable path and an SSL key pair. After that, all control is handled remotely through a set of JSON-based APIs.</p><p>Red October is backed by a database of accounts stored on disk in a portable password vault. The server never stores the account password there, only a <a href="/keeping-passwords-safe-by-staying-up-to-date">salted hash of the password</a> for each account. For each user, the server creates an RSA key pair and encrypts the private key with a key derived from the password and a randomly generated salt using a secure derivation function.</p><p>Any administrator can encrypt any piece of data with the encrypt API. This request takes a list of users and the minimum number of users needed to decrypt it. The server returns a somewhat larger piece of data that contains an encrypted version of this data. The encrypted data can then be stored elsewhere.</p><p>This data can later be decrypted with the decrypt API, but only if enough people have delegated their credentials to the server. The delegation API lets a user grant permission to a server to use their credentials for a limited amount of time and a limited number of uses.</p>
    <div>
      <h3>Cryptographic Design</h3>
      <a href="#cryptographic-design">
        
      </a>
    </div>
    <p>Red October was designed from cryptographic first principles, combining trusted and understood algorithms in known ways. CloudFlare is also opening the source of the server to allow others to analyze its design.</p><p>Red October is based on combinatorial techniques and trusted cryptographic primitives. We investigated using complicated secret primitives like <a href="http://en.wikipedia.org/wiki/Shamir's_Secret_Sharing">Shamir's sharing scheme</a>, but we found that a simpler combinatorial approach based on primitives from Go's standard library was preferable to implementing a mathematical algorithm from scratch. Red October uses <a href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard">128-bit AES</a>, <a href="http://en.wikipedia.org/wiki/RSA_(algorithm)">2048-bit RSA</a> and <a href="http://en.wikipedia.org/wiki/Scrypt">scrypt</a> as its cryptographic primitives.</p>
    <div>
      <h4>Creating an account</h4>
      <a href="#creating-an-account">
        
      </a>
    </div>
    <p>Each user is assigned a unique, randomly-generated RSA key pair when creating an account on a Red October server. The private key is encrypted with a password key derived from the user’s password and salt using scrypt. The public key is stored unencrypted in the vault with the encrypted private key.</p>
    <div>
      <h4>Encrypting data</h4>
      <a href="#encrypting-data">
        
      </a>
    </div>
    <p>When asked to encrypt a piece of data, the server generates a random 128-bit AES key. This key is used to encrypt the data. For each user that is allowed to decrypt the data, a user-specific key encryption key is chosen. For each unique pair of users, the data key is doubly encrypted, once with the key encryption key of each user. The key encryption keys are then encrypted with the public RSA key associated with their account. The encrypted data, the set of doubly-encrypted data keys, and the RSA-encrypted key encryption keys are all bundled together and returned. The encrypted data is never stored on the server.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/38JLECxsa5YaGcwkkJnhEn/3054808bc0b25afda9d7c3be1fdc8f6b/cryptography1.png" />
            
            </figure><p>Delegating credentials to the server</p><p>When a user delegates their key to the server, they submit their username and password over TLS using the delegate JSON API. For each account, the password is verified against the salted hash. If the password is correct, a password key is derived from the password and used to decrypt the user’s RSA private key. This key is now “Live” for the length of time and number of decryptions chosen by the user.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/Jefh1rq4DwCnifHejHJNe/c10f4e6420354b9c16f3f8f12ff15ae8/cryptography3.png" />
            
            </figure><p>Decrypting data</p><p>To decrypt a file, the server validates that the requesting user is an administrator and has the correct password. If two users of the list of valid users have delegated their keys, then decryption can occur. First the RSA private key is used to decrypt the key encryption key for these two users, then the key encryption keys are used to decrypt the doubly encrypted data key, which is then used to decrypt the data.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6nvlGuGFWguhaebYbrsY9n/1432bb6989d6b48631c7271d95bd12a6/cryptography2.png" />
            
            </figure><p>Some other key points:</p><ol><li><p>Cryptographic security. The Red October server does not have the ability to decrypt user keys without their password. This prevents someone with access to the vault from decrypting data.</p></li><li><p>Password flexibility. Passwords can be changed without changing the encryption of a given file. Key encryption keys ensure that password changes are decoupled from data encryption keys.</p></li></ol>
    <div>
      <h3>Looking ahead</h3>
      <a href="#looking-ahead">
        
      </a>
    </div>
    <p>The version of Red October we are releasing to GitHub is in beta. It is licensed under the <a href="http://opensource.org/licenses/BSD-3-Clause">3-clause BSD license</a>. We plan to continue to release our improvements to the open source community. Here is the project on GitHub: <a href="https://github.com/cloudflare/redoctober">Red October</a>.</p><p>Writing the server in Go allowed us to design the different components of this server in a modular way. Our hope is this modularity will make it easy for anyone to build in support for different authentication methods that are not based on passwords (for example, TLS client certificates, time-based one-time-passwords) and new core cryptographic primitives (for example, elliptic curve cryptography).</p><p>CloudFlare is always looking to improve the state of security on the Internet. It is important to us to share our advances with the world and <a href="/open-source-two-way-street">contribute back to the community</a>. See the <a href="http://cloudflare.github.io/">CloudFlare GitHub page</a> for the list of our open source projects and initiatives.</p> ]]></content:encoded>
            <category><![CDATA[Open Source]]></category>
            <category><![CDATA[Encryption]]></category>
            <category><![CDATA[RSA]]></category>
            <category><![CDATA[GitHub]]></category>
            <category><![CDATA[TLS]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Cryptography]]></category>
            <category><![CDATA[Salt]]></category>
            <guid isPermaLink="false">6tG7fMY0ykeCo1uPglwZFn</guid>
            <dc:creator>Nick Sullivan</dc:creator>
        </item>
        <item>
            <title><![CDATA[Why some cryptographic keys are much smaller than others]]></title>
            <link>https://blog.cloudflare.com/why-are-some-keys-small/</link>
            <pubDate>Fri, 20 Sep 2013 06:00:00 GMT</pubDate>
            <description><![CDATA[ If you connect to CloudFlare's web site using HTTPS the connection will be secured using one of the many encryption schemes supported by SSL/TLS.  ]]></description>
            <content:encoded><![CDATA[ <p>If you connect to <a href="https://www.cloudflare.com/">CloudFlare's web site</a> using HTTPS the connection will be secured using one of the many encryption schemes supported by SSL/TLS. When I connect using Chrome I get an RC4_128 connection (with a 128-bit key) which used the ECDHE_RSA key exchange mechanism (with a 2,048-bit key) to set the connection up.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7G4da35qbg9auSgeT2YClg/94a14cd2d77227b4a74d532131b8b52c/cloudflare-tls.png" />
            
            </figure><p>If you're not familiar with the cryptographic protocols involved you might be wondering why one part uses a 128-bit key and another a 2,048-bit key. And you'd be forgiven for wondering why a large key wasn't used throughout and whether a 128-bit key is weaker than a 2,048-bit key. This blog post will explain why a 128-bit <i>symmetric</i> key is, in fact, a bit more secure than a 2,048-bit <i>asymmetric</i> key; you have to look at both the type of encryption being used (symmetric or asymmetric) and the key length to understand the strength of the encryption.</p><p>My connection above used a symmetric cipher (RC4_128) with a 128-bitkey and an asymmetric cipher (ECDHE_RSA) with a 2,048-bit key.</p><p>You might also have seen other key lengths in use. For example, when I connect to the British Government portal <a href="https://www.gov.uk/">gov.uk</a> I get a TLS connection that uses AES_256_CBC (with a 256-bit key) set up using RSA with a 2,048-bit key. It's not uncommon to see RSA with a 1,024-bit key as well.</p><p>To understand these key lengths it's necessary to understand a little about the actual encryption schemes they are used with.</p>
    <div>
      <h3>Symmetric Cryptography</h3>
      <a href="#symmetric-cryptography">
        
      </a>
    </div>
    <p>The RC4_128 and AES_256_CBC schemes mentioned above are <a href="https://en.wikipedia.org/wiki/Symmetric-key_algorithm">symmetric cryptographic schemes</a>. Symmetric simply means that the same key is used to encipher and decipher the encrypted web traffic. In one case, a 128-bit key is used, in another a 256-bit key.</p><p>Symmetric cryptography is the oldest form there is. When children use a <a href="https://en.wikipedia.org/wiki/Caesar_cipher">Caesar Cipher</a> (shifting each letter in the alphabet some fixed number of places) they are performing symmetric cryptography. In that case, the key is the number of places to shift letters and there are 26 possible keys (which is roughly like saying the Caesar Cipher has a roughly 5-bit key).</p><p>Here's a Caesar Shift with a key of 7 (each letter is moved up in the alphabet 7 places):</p><p>ISTHE BESTT HATCO RPORA LBOBB YSHAF TOECA NDOON SHORT NOTIC E
PZAOL ILZAA OHAJV YWVYH SIVII FZOHM AVLJH UKVVU ZOVYA UVAPJ L</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4QAkwOHHM2r0OUPElBkBpv/ed81bf8342b3b74d2c701e8094b340ff/caesar-cipher.png" />
            
            </figure><p>There are lots of ways to break the Caesar Cipher, but one way is to try out all 26 possible keys. That's really not that hard since there are only 26 possible solutions:</p>
            <pre><code>PZAOL ILZAA OHAJV YWVYH SIVII FZOHM AVLJH UKVVU ZOVYA UVAPJ L
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -</code></pre>
            <p>0: PZAOL ILZAA OHAJV YWVYH SIVII FZOHM AVLJH UKVVU ZOVYA UVAPJ L
1: OYZNK HKYZZ NGZIU XVUXG RHUHH EYNGL ZUKIG TJUUT YNUXZ TUZOI K
2: NXYMJ GJXYY MFYHT WUTWF QGTGG DXMFK YTJHF SITTS XMTWY STYNH J
3: MWXLI FIWXX LEXGS VTSVE PFSFF CWLEJ XSIGE RHSSR WLSVX RSXMG I
4: LVWKH EHVWW KDWFR USRUD OEREE BVKDI WRHFD QGRRQ VKRUW QRWLF H
5: KUVJG DGUVV JCVEQ TRQTC NDQDD AUJCH VQGEC PFQQP UJQTV PQVKE G
6: JTUIF CFTUU IBUDP SQPSB MCPCC ZTIBG UPFDB OEPPO TIPSU OPUJD F
7: ISTHE BESTT HATCO RPORA LBOBB YSHAF TOECA NDOON SHORT NOTIC E
8: HRSGD ADRSS GZSBN QONQZ KANAA XRGZE SNDBZ MCNNM RGNQS MNSHB D
9: GQRFC ZCQRR FYRAM PNMPY JZMZZ WQFYD RMCAY LBMML QFMPR LMRGA C
10: FPQEB YBPQQ EXQZL OMLOX IYLYY VPEXC QLBZX KALLK PELOQ KLQFZ B
11: EOPDA XAOPP DWPYK NLKNW HXKXX UODWB PKAYW JZKKJ ODKNP JKPEY A
12: DNOCZ WZNOO CVOXJ MKJMV GWJWW TNCVA OJZXV IYJJI NCJMO IJODX Z
13: CMNBY VYMNN BUNWI LJILU FVIVV SMBUZ NIYWU HXIIH MBILN HINCW Y
14: BLMAX UXLMM ATMVH KIHKT EUHUU RLATY MHXVT GWHHG LAHKM GHMBV X
15: AKLZW TWKLL ZSLUG JHGJS DTGTT QKZSX LGWUS FVGGF KZGJL FGLAU W
16: ZJKYV SVJKK YRKTF IGFIR CSFSS PJYRW KFVTR EUFFE JYFIK EFKZT V
17: YIJXU RUIJJ XQJSE HFEHQ BRERR OIXQV JEUSQ DTEED IXEHJ DEJYS U
18: XHIWT QTHII WPIRD GEDGP AQDQQ NHWPU IDTRP CSDDC HWDGI CDIXR T
19: WGHVS PSGHH VOHQC FDCFO ZPCPP MGVOT HCSQO BRCCB GVCFH BCHWQ S
20: VFGUR ORFGG UNGPB ECBEN YOBOO LFUNS GBRPN AQBBA FUBEG ABGVP R
21: UEFTQ NQEFF TMFOA DBADM XNANN KETMR FAQOM ZPAAZ ETADF ZAFUO Q
22: TDESP MPDEE SLENZ CAZCL WMZMM JDSLQ EZPNL YOZZY DSZCE YZETN P
23: SCDRO LOCDD RKDMY BZYBK VLYLL ICRKP DYOMK XNYYX CRYBD XYDSM O
24: RBCQN KNBCC QJCLX AYXAJ UKXKK HBQJO CXNLJ WMXXW BQXAC WXCRL N
25: QABPM JMABB PIBKW ZXWZI TJWJJ GAPIN BWMKI VLWWV APWZB VWBQK M</p>
    <div>
      <h3>How long?</h3>
      <a href="#how-long">
        
      </a>
    </div>
    <p>The goal of modern symmetric cryptography is to make this sort of'trying out all the possible keys' the only approach to breaking a symmetric cipher. Algorithms like <a href="https://en.wikipedia.org/wiki/RC4">RC4</a> and <a href="https://en.wikipedia.org/wiki/Advanced_Encryption_Standard">AES</a> scramble data based on a key. The key itself is, ideally, randomly chosen from the set of all possible keys.</p><p>On a side note, there are now <a href="/staying-on-top-of-tls-attacks">serious problems with RC4</a> and as better replacements come along (such as ciphersuites based on AES) CloudFlare will update the ciphersuites it uses to provide the best level of protection.</p><p>That said the basic idea is that the only way to break into a connection secured with a symmetric cipher is to try out all the keys. Which brings us to 128-bit and 256-bit keys.</p><p>A 128-bit key means there are 340,282,366,920,938,463,463,374,607,431,768,211,456 possible keys to try. A 256-bit key has the square of that many keys to try: a hugenumber.</p><p>To put that in context imagine trying to test all the keys for a 128-bit AES encryption using the <a href="http://en.wikipedia.org/wiki/AES_instruction_set">special AES instructions</a> added to the latest Intel microprocessors. These instructions are designed to be very fast and according to Intel's own data decrypting a block of AES encrypted data would take 5.6 cycles on <a href="http://ark.intel.com/products/47932">Intel i7 Processor</a> with 4 cores.</p><p>Put another way, that processor could try out one key on one block of data in about 1.7 nanoseconds. At that speed it would take it about <b>1.3 * 10^12 * the age of the universe</b> to check all the keys (you'd probably only have to check half before finding the right one so divide that incredibly long time by two).</p><p>Since personal computers became available roughly 1 billion of them have been sold. Imagine that they all had the same top-of-the-line processor and were used to attack a 128-bit key. You'd manage to get the time down to <b>660 * the age of the universe</b>.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1w5RgPJRr4Gnxk4E2rWqFu/cbc76d09e7671de7fe3731c38fcfdb8a/milliways.png" />
            
            </figure><p>Image (c) BBC TV</p><p>So, breaking 128-bit keys by brute force just isn't practical. And breaking 256-bit is even less possible. So, for symmetric ciphers, keys of these lengths make sense.</p><p>But that's not the case for asymmetric cryptography.</p>
    <div>
      <h3>Asymmetric Key Lengths</h3>
      <a href="#asymmetric-key-lengths">
        
      </a>
    </div>
    <p><a href="https://en.wikipedia.org/wiki/Public-key_cryptography">Asymmetric cryptography</a> works by having two different keys, one for encryption and one for decryption. It's also often called 'public key cryptography' because it's possible to make one key public (allowing someone to encrypt a message) while keeping the other private (only the holder of the private key can decrypt the message encrypted with its related public key).</p><p>In order to have these special properties the public and private keys are related by some mathematical process. Aside: in the symmetric examples there's only one key and it's just any value of the right number of bits. This randomness of a symmetric key means it can be relatively short as we saw.</p><p>For example, in the popular RSA scheme used with SSL/TLS the public and private keys consist in part of the product of two large prime numbers. Making an RSA key starts with picking two random prime numbers. The security of RSA relies (in part) on the fact that it's easy to choose two random prime numbers, but it's very hard to discover what they are when just given the product of them.</p><p>Suppose there are two prime numbers picked at random called p0 and p1. Part of the RSA public (and private) key is called the modulus and it is just p0*p1. If an attacker can decompose (or factor) the modulus into p0 and p1 they can break RSA because they can work out the private key. Mathematicians believe that it is very hard to factor a product of two primes and the security of web transactions relies, in part, on that belief.</p><p>Typical RSA key sizes are 1,024 or 2,048 or 4,096 bits. That number is the number of bits in the modulus. For each there will be a pair of primes of roughly 512 bits or 1,024 bits or 2,048 bits depending on the key size picked. Those primes are chosen by some random process (highlighting once again the <a href="/why-randomness-matters">importance of random number generators</a>).</p><p>But we still haven't answered the question of why these key sizes are so large. Just as in the symmetric key case, attacks on say 2,048-bit RSA are based on trying out all keys of a certain size, but unlike the symmetric key scheme not every 2,048-bit number is an RSA key (because it has to be the product of two primes).</p><p>So, although the key size is larger there are actually fewer possible RSA keys for any given number of bits that there are for the same symmetric key size. That's because there are only so many prime numbers of that size and below. The RSA scheme can only use pairs of prime numbers, whereas the symmetric schemes can use any number at all of the same size.</p><p>This diagram (called an <a href="https://en.wikipedia.org/wiki/Ulam_spiral">Ulam Spiral</a>) shows the numbers from 1 to 40,000 as black or white dots. The black dots are the primes</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3VIXrzzZVLON430lnHxCPO/940bf5e06b1965d20e0f6371c695ca06/ulam-spiral.png" />
            
            </figure><p>Image from <a href="https://en.wikipedia.org/wiki/File:Ulam_1.png">Wikipedia</a></p><p>If you used a 256-bit RSA key (roughly consisting of two 128-bit prime numbers multiplied together) you'd quickly find that your encryption had been broken by someone using a fast home PC. There are only so many 128-bit prime numbers and there are fast ways of attacking the factorization problem (such as the <a href="https://en.wikipedia.org/wiki/General_number_field_sieve">General Number Field Sieve</a> that actually make breaking RSA keys a little easier than trying out every single key).</p><p>Any time there's a pattern in a cryptographic key it represents a chink in the crytography's armor. For example, in a perfect world, people would pick completely random passwords. Because they don't there are patterns in the passwords and they can be guessed or broken without trying out every possible password.</p><p>RSA keys have a distinctive pattern: they are the product of two prime numbers. That provides the chink; today that chink is best exploited by the General Number Field Sieve. In the symmetric key case there are no such patterns: the keys are just large randomly-chosen numbers. (Of course, if you don't pick your symmetric key randomly you might actually be helping an attacker find a way to break your encrypted messages.)</p><p>A few years ago the 512-bit RSA key used to sign software for TIcalculators was broken by <a href="https://en.wikipedia.org/wiki/Texas_Instruments_signing_key_controversy">an individual</a> using a PC that ran for 73 days using the open source <a href="http://www.boo.net/~jasonp/qs.html">msieve and ggnfs</a> prorgrams.</p><p>So, asymmetric keys have to be much larger than symmetric keys because there are less of them for a given number of bits, and because there are patterns within the keys themselves.</p>
    <div>
      <h3>Recommendations</h3>
      <a href="#recommendations">
        
      </a>
    </div>
    <p>The <a href="http://www.keylength.com/en/3/">ECRYPT II recommendations</a> on key length say that a 128-bit symmetric key provides the same strength of protection as a 3,248-bit asymmetric key. And that those key lengths provide long term protection of data encrypted with them.</p><p>The length of time a key is good for is also important. Over time computers get faster and techniques for breaking encryption schemes (particuarly techniques for breaking asymmetric encryption) get better. That 512-bit key used for TI calculators probably looked pretty safe when it was first chosen. And in 1999 a key of that length took a <a href="https://en.wikipedia.org/wiki/Cray_C90">supercomputer</a> to break.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/43FhANStq4MmuxKjgUXS6Y/70e7ba13b64f49f60eec15570a1f037a/sneakers.png" />
            
            </figure><p>We keep an eye on these reports when choosing ciphers and key lengths to secure our and our customers' communications.</p><p>Because of the importance of protecting our customers' communications CloudFlare has also opted to roll out <a href="/staying-on-top-of-tls-attacks">forward secrecy</a> for our SSL/TLS connections. That means that the public/private keys used for connections are generated freshly each time. That prevents bulk attacks where a single public/private key (such as the one used in simple RSA-based certificates) is broken revealing all of the symmetric keys used to secure HTTPS for a web site.</p>
    <div>
      <h3>Forward Secrecy and Elliptic Curves</h3>
      <a href="#forward-secrecy-and-elliptic-curves">
        
      </a>
    </div>
    <p>Returning to the HTTPS connection I made to CloudFlare at the start, the key negotiation was done using ECDHE_RSA. That's the ephemeral version of the Diffie-Hellman key exchange mechanism that uses elliptic curves and RSA for authentication. That's quite amouthful. It breaks down like this:</p><ol><li><p>The public/private key pair used to this connection was ephemeral: it was only created for this connection. That's what gives 'forward secrecy'.</p></li><li><p>The actual public-key encryption scheme used was <a href="https://en.wikipedia.org/wiki/Elliptic_curve_Diffie%E2%80%93Hellman">Elliptic Curve Diffie-Hellman</a>. Elliptic Curve Cryptography uses a different branch of mathematics than RSA. Looking at the ECRYPT II report shows that a 128-bit symmetric key is as strong as a 3,248-bit asymmetric key; to get the equivalent strength from an Elliptic Curve Cryptographic scheme requires a key with 256-bits.</p></li><li><p>So, Google Chrome set up an ephemeral <a href="https://www.imperialviolet.org/2011/11/22/forwardsecret.html">256-bit</a> Elliptic Curve Diffie Hellman public/private key pair and used it to agree on a 128-bit symmetric key for the rest of the communication.</p></li><li><p>To prove that the web site really was <a href="http://www.cloudflare.com">www.cloudflare.com</a> the 2,048-bit RSA key was used along with the web site's certificate.</p></li></ol><p>So, three different key lengths were used: 128-bit (with RC4), 256-bit (with ECDHE) and 2,048-bit (with RSA). All three key lengths provide similar levels of security.</p> ]]></content:encoded>
            <category><![CDATA[Chrome]]></category>
            <category><![CDATA[Google]]></category>
            <category><![CDATA[RSA]]></category>
            <guid isPermaLink="false">47tSgx3GbC9M36Jv0ftTSZ</guid>
            <dc:creator>John Graham-Cumming</dc:creator>
        </item>
    </channel>
</rss>