
<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>Wed, 15 Apr 2026 20:10:12 GMT</lastBuildDate>
        <item>
            <title><![CDATA[Chaos in Cloudflare’s Lisbon office: securing the Internet with wave motion]]></title>
            <link>https://blog.cloudflare.com/chaos-in-cloudflare-lisbon-office-securing-the-internet-with-wave-motion/</link>
            <pubDate>Mon, 17 Mar 2025 12:00:00 GMT</pubDate>
            <description><![CDATA[ Cloudflare is now using a wall of waves in our Lisbon, Portugal office to create entropy and strengthen Internet security, turning liquid chaos into secure, unpredictable encryption. ]]></description>
            <content:encoded><![CDATA[ <p>Over the years, Cloudflare has gained fame for many things, including our technical blog, but also as <a href="https://www.wired.com/story/cloudflare-lava-lamps-protect-from-hackers/"><u>a tech company securing the Internet using </u><b><u>lava lamps</u></b></a>, a story that began as a research/science project almost 10 years ago. In March 2025, we added another layer to its legacy: a "wall of entropy" made of 50 <b>wave machines </b>in constant motion at our Lisbon office, the company's European HQ. </p><p>These wave machines are a new source of entropy, joining <b>lava lamps</b> in San Francisco, <b>suspended rainbows</b> in Austin, and <b>double chaotic pendulums </b>in London. The entropy they generate contributes to securing the Internet <a href="#lavarand-origins-and-walls-of-entropy"><u>through LavaRand</u></a>.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6sp4ZXYnpwUGAabVB0fRKW/f56edd916efeb49173c623e99b87bc70/DSC00336.JPG" />
          </figure>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1D1cayhBpPyuUNKV4JCcvF/e6d493a71e41c3622dd4f895505a3f43/DSC00450.JPG" />
          </figure>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/EE2gOFRrXCGM5ASh3uCl7/b282e0ed651cb5c354b183bc33aff116/image4.jpg" />
          </figure><p><sup><i>The new waves wall at Cloudflare’s Lisbon office sits beside the Radar Display of global Internet insights, with the 25th of April Bridge overlooking the Tagus River in the background.</i></sup></p><p>It’s exciting to see waves in Portugal now playing a role in keeping the Internet secure, especially given Portugal’s deep maritime history.</p><p>The installation honors Portugal’s passion for the sea and exploration of the unknown, famously beginning over 600 years ago, in 1415, with pioneering vessels like <a href="https://en.wikipedia.org/wiki/Caravel"><u>caravels</u></a> and naus/carracks, precursors to galleons and other ships. Portuguese sea exploration was driven by navigation schools and historic voyages <i>“through seas never sailed before”</i> (<i>“Por mares nunca dantes navegados” </i>in Portuguese), as described by Portugal’s famous poet, Luís Vaz de Camões, born 500 years ago (1524).</p><p>Anyone familiar with Portugal knows the <a href="https://en.wikipedia.org/wiki/History_of_Portugal#Naval_exploration_and_Portuguese_Empire_(15th%E2%80%9316th_centuries)"><u>sea is central</u></a> to its identity. The small country has 980 km of coastline, where most of its main cities are located. Maritime areas make up 90% of its territory, including the mid-Atlantic Azores. In 1998, Lisbon’s <a href="https://en.wikipedia.org/wiki/Expo_%2798"><u>Expo 98</u></a> celebrated the oceans and this maritime heritage. Since 2011, the small town of Nazaré also became globally <a href="https://allwaves.surf/waves-explained-nazare/"><u>famous among the surfing community</u></a> for its <a href="https://earthobservatory.nasa.gov/images/149486/monster-waves-of-nazare"><u>giant waves</u></a>.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2zN2XfhmWnjbFmkXfTiYGw/fa321c61b54e676136f93d050364ee8b/image6.jpg" />
          </figure>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/Tyu4Wlgn1NMihceYSCUvI/45905ee3820880371b508dc13c32f11b/image2.jpg" />
          </figure><p><sup><i>Nazaré’s waves, famous since Garrett McNamara’s 23.8 m (78 ft) ride in 2011, hold </i></sup><a href="https://www.guinnessworldrecords.com/world-records/78115-largest-wave-surfed-unlimited"><sup><i><u>Guinness World Records</u></i></sup></a><sup><i> for the biggest waves ever surfed. Photos: Sam Khawasé &amp; Beatriz Paula, from Cloudflare.</i></sup></p><p>Portugal’s maritime culture also inspired literature and music, including poet Fernando Pessoa, who referenced it in his 1934 book <a href="https://en.wikipedia.org/wiki/Mensagem"><u>Mensagem</u></a>, and musician Rui Veloso, who dedicated his 1990s album <a href="https://open.spotify.com/album/2mzMuD3bxwFaFgfjU2vigY"><u>Auto da Pimenta</u></a> to Portugal’s historic connection to the sea.</p>
    <div>
      <h3>How this chaos came to be</h3>
      <a href="#how-this-chaos-came-to-be">
        
      </a>
    </div>
    <p>As Cloudflare’s CEO, Matthew Prince, <a href="https://x.com/eastdakota/status/1899226252956827846"><u>said</u></a> recently, this new wall of entropy began with an idea back in 2023: “What could we use for randomness that was like our lava lamp wall in San Francisco but represented our team in Portugal?”</p><p>The original inspiration came from wave motion machine desk toys, which were popular among some of our team members. Waves and the ocean not only provide a source of movement and randomness, but also align with Portugal’s maritime history and the office’s scenic view.</p><p>However, this was easier said than done. It turns out that making a wave machine wall is a real challenge, given that these toys are not as popular as they were in the past,  and aren’t being manufactured in the size we needed any more. We scoured eBay and other sources but couldn't find enough, consistent in style and in working order wave machines. We also discovered that off-the-shelf models weren’t designed to run 24/7, which was a critical requirement for our use.</p>
    <div>
      <h4>Artistry to create wave machines</h4>
      <a href="#artistry-to-create-wave-machines">
        
      </a>
    </div>
    <p>Undaunted, <a href="https://blog.cloudflare.com/cloudflare-top-100-most-loved-workplaces-in-2022"><u>Cloudflare’s Places team</u></a>, which ensures our offices reflect our values and culture, found a <a href="https://wavemotionmachines.com/"><u>U.S.-based artisan</u></a> that specializes in ocean wave displays to create the wave machines for us. Since 2009, his one-person business, <a href="https://wavemotionmachines.com/"><u>Hughes Wave Motion Machines</u></a>, has blended artistry, engineering, and research, following his transition from Lockheed Martin Space Systems, where he designed military and commercial satellites.</p><div>
  
</div>
<p></p><p><sup><i>Timelapse of the mesmerizing office waves, set to the tune of an AI-generated song.</i></sup></p><p>Collaborating closely, we developed a custom rectangular wave machine (18 inches/45 cm long) that runs nonstop — not an easy task — which required hundreds of hours of testing and many iterations. Featuring rotating wheels, continuous motors, and a unique fluid formula, these machines create realistic ocean-like waves in green, blue, and Cloudflare’s signature orange. </p><p>Here’s a quote from the artist himself about these wave machines:</p><blockquote><p><i>“The machine’s design is a balancing act of matching components and their placement to how the fluid responds in a given configuration. There is a complex yet delicate relationship between viscosity, specific gravity, the size and design of the vessel, and the placement of each mechanical interface. Everything must be precisely aligned, centered around the fluid like a mathematical function. I like to say it’s akin to ’balancing a checkerboard on a beach ball in the wind.’”</i></p></blockquote>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3K9fpTU0D0xi831MHFOFBj/570b8c307fea1078f3c0262e13447bf6/image7.jpg" />
          </figure><p><sup><i>The Cloudflare Places Team with Lisbon office architects and contractor testing wave machine placement, shelves, lighting, and mirrors to enhance movement and reflection, March 2024.</i></sup></p><p>Despite delays, the Lisbon wave machines finally debuted on March 10, 2025 — an incredibly exciting moment for the Places team.</p><p><b>Some numbers about our wave-machine entropy wall:</b></p><ul><li><p>50 wave machines, 50 motion wheels &amp; motors, 50 acrylic containers filled with Hughes Wave Fluid Formula (two <a href="https://www.sciencedirect.com/topics/engineering/immiscible-liquid"><u>immiscible liquids</u></a>)</p></li><li><p>3 liquid colors: blue, green, and orange</p></li><li><p>15 months from concept to completion</p></li><li><p>14 flips (side-to-side balancing movements) per minute — over 20,000 per day</p></li><li><p>Over 15 waves per minute</p></li><li><p>~0.5 liters of liquid per machine</p></li></ul>
    <div>
      <h3>LavaRand origins and walls of entropy</h3>
      <a href="#lavarand-origins-and-walls-of-entropy">
        
      </a>
    </div>
    <p>Cloudflare’s servers handle 71 million HTTP requests per second on average, with 100 million HTTP requests per second at peak. <a href="https://radar.cloudflare.com/adoption-and-usage#http-vs-https"><u>Most of these requests are secured via TLS</u></a>, which relies on secure randomness for cryptographic integrity. A Cryptographically Secure Pseudorandom Number Generator (<a href="https://www.cloudflare.com/learning/ssl/lava-lamp-encryption/"><u>CSPRNG</u></a>) ensures unpredictability, but only when seeded with high-quality entropy. Since chaotic movement in the real world is truly random, Cloudflare designed a system to harness it. Our <a href="https://blog.cloudflare.com/harnessing-office-chaos/"><u>2024 blog post</u></a> expands on this topic in a more technical way, but here’s a quick summary.</p><p>In <a href="https://blog.cloudflare.com/randomness-101-lavarand-in-production/"><u>2017</u></a>, Cloudflare launched LavaRand, inspired by <a href="https://www.wired.com/1997/03/lava-lites-easy-to-break-hard-to-crack/"><u>Silicon Graphics’ 1997 concept</u></a> However, the need for randomness in security was already a hot topic on our blog before that, such as in our discussions of <a href="https://blog.cloudflare.com/why-randomness-matters/"><u>securing systems</u></a> and <a href="https://blog.cloudflare.com/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/"><u>cryptography</u></a>. Originally, LavaRand collected entropy from a wall of lava lamps in our San Francisco office, feeding an internal API that servers periodically query to include in their entropy pools. Over time, we expanded LavaRand beyond lava lamps, incorporating <a href="https://blog.cloudflare.com/harnessing-office-chaos/#londons-unpredictable-pendulums"><u>new sources of office chaos</u></a> while maintaining the same core method.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2v6Wvde8j8R7482QjBsSrV/89b37c652654e27c13d328e9acac6489/image9.png" />
          </figure><p>A camera captures images of dynamic, unpredictable randomness displays. Shadows, lighting changes, and even sensor noise contribute entropy. Each image is then processed into a compact hash, converting it into a sequence of random bytes. These, combined with the previous seed and local system entropy, serve as input for a Key Derivation Function (<a href="https://en.wikipedia.org/wiki/Key_derivation_function"><u>KDF</u></a>), which generates a new seed for a CSPRNG — capable of producing virtually unlimited random bytes upon request. The waves in our Lisbon office are now contributing to this pool of randomness.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1XFFjr4jhRMQlz6akHKZm4/44759c4e879de3792cd21b4ce2525c90/image5.png" />
          </figure><p>Cloudflare’s LavaRand API makes this randomness accessible internally, strengthening cryptographic security across our global infrastructure. For example, when you use <i>Math.random()</i> in <a href="https://workers.cloudflare.com/"><u>Cloudflare Workers</u></a>, part of that randomness comes from LavaRand. Similarly, querying our <a href="https://blog.cloudflare.com/harnessing-office-chaos/#drand-distributed-and-verifiable-public-randomness"><u>drand API</u></a> taps into LavaRand as well. Cloudflare offers this API to enable anyone to generate random numbers and even seed their own systems.</p>
    <div>
      <h3>Our new Lisbon office space</h3>
      <a href="#our-new-lisbon-office-space">
        
      </a>
    </div>
    
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5ivPkCfTkGxfo6Swt6p9qY/e7414a14b88bef7ac7e0ef6f737b58c6/image8.jpg" />
          </figure><p><sup><i>Photo of the view from our Lisbon office, featuring ceiling lights arranged in a wave-like pattern.</i></sup></p><p>Entropy also inspired the design ethos of our new Lisbon office, given that the wall of waves and the office are part of the same project. As soon as you enter, you're greeted not only by the motion of the entropy wall but also by the constant movement of planet Earth on our Cloudflare Radar Display screen that stands next to it. But the waves don’t stop there — more elements throughout the space mimic the dynamic flow of the Internet itself. Unlike ocean tides, however, Internet traffic ebbs and flows with the motion of the Sun, not the Moon.</p><p>As you walk through the office, waves are everywhere — in the ceiling lights, the architectural contours, and even the floor plan, thoughtfully designed by our architect to reflect the fluid movement of water. The visual elements create a cohesive experience, reinforcing a sense of motion. Each meeting room embraces this maritime theme, named after famous Portuguese beaches — including, naturally, Nazaré.</p><p>We partnered with an incredible group of local Portuguese vendors for this construction project, where all the leads were women — something incredibly rare for the industry. The local teams worked with passion, proudly wore Cloudflare t-shirts, and fostered a warm, family-like atmosphere. They openly expressed pride in the project, sharing how it stood out from anything they had worked on before.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7lpuurEtWfpIPKvHVqmD0L/0b0561097859f286d6b5e98db82f1e0f/image3.jpg" />
          </figure><p><sup><i>Our amazing third-party team and internal Places team, proudly rocking Cloudflare shirts after bringing this project to life.</i></sup></p>
    <div>
      <h3>Help us select a name for our new wall of entropy</h3>
      <a href="#help-us-select-a-name-for-our-new-wall-of-entropy">
        
      </a>
    </div>
    <p>Next, we have several name options for this new wall of entropy. Help us decide the best one, and register your vote using <a href="https://forms.gle/L2gAqoJTwQmJFkmy8"><u>this form</u></a>.</p><blockquote><p><b>The Surf Board</b></p><p><b>Chaos Reef</b></p><p><b>Waves of Entropy</b></p><p><b>Wall of Waves</b></p><p><b>Whirling Wave Wall</b></p><p><b>Chaotic Wave Wall</b></p><p><b>Waves of Chaos</b></p></blockquote><p>If you’re interested in working in Cloudflare’s Lisbon office, we’re hiring! Our <a href="https://www.cloudflare.com/careers/jobs/"><b><u>career page</u></b></a> lists our open roles in Lisbon, as well as our other locations in the U.S., Mexico, Europe and Asia.</p><p><sup><i>Acknowledgements: This project was only possible with the effort, vision and help of John Graham-Cumming, Caroline Quick, Jen Preston, Laura Atwall, Carolina Beja, Hughes Wave Motion Machines, P4 Planning and Project Management, Gensler Europe, Openbook Architecture, and Vector Mais.</i></sup></p> ]]></content:encoded>
            <category><![CDATA[LavaRand]]></category>
            <category><![CDATA[Entropy]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Randomness]]></category>
            <category><![CDATA[Cryptography]]></category>
            <category><![CDATA[Portugal]]></category>
            <category><![CDATA[Life at Cloudflare]]></category>
            <category><![CDATA[Lisbon]]></category>
            <category><![CDATA[Offices]]></category>
            <guid isPermaLink="false">1QYrEI6OwTmFuhZNnURL95</guid>
            <dc:creator>João Tomé</dc:creator>
            <dc:creator>Caroline Quick</dc:creator>
        </item>
        <item>
            <title><![CDATA[Harnessing chaos in Cloudflare offices]]></title>
            <link>https://blog.cloudflare.com/harnessing-office-chaos/</link>
            <pubDate>Fri, 08 Mar 2024 14:00:24 GMT</pubDate>
            <description><![CDATA[ This blog post will cover the new sources of “chaos” that have been added to LavaRand and how you can make use of that harnessed chaos in your next application ]]></description>
            <content:encoded><![CDATA[ <p></p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6VAXGAjHjvvY5IAEG63gPu/4c199f8bb127b03fe613ab8dc6c0016f/image12-1.png" />
            
            </figure><p>In the children’s book <a href="https://en.wikipedia.org/wiki/The_Snail_and_the_Whale">The Snail and Whale</a>, after an unexpectedly far-flung adventure, the principal character returns to declarations of “How time’s flown” and “Haven’t you grown?” It has been about four years since we last wrote about LavaRand and during that time the story of how Cloudflare uses physical sources of entropy to add to the security of the Internet has continued to travel and be a source of interest to many. What was initially just a single species of physical entropy source – lava lamps – has grown and diversified. We want to catch you up a little on the story of LavaRand. This blog post will cover the new sources of “chaos” that have been added to LavaRand and how you can make use of that harnessed chaos in your next application. We’ll cover how public randomness can open up uses of publicly trusted randomness — imagine not needing to take the holders of a “random draw” at their word when they claim the outcome is not manipulated in some way. And finally we’ll discuss timelock encryption which is a way to ensure that a message cannot be decrypted until some chosen time in the future.</p>
    <div>
      <h2>LavaRand origins</h2>
      <a href="#lavarand-origins">
        
      </a>
    </div>
    <p>The entropy sourced from our wall of lava lamps in San Francisco has long played its part in the randomness that secures connections made through Cloudflare.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5XdIuQkEWKat2c9YanaCY0/aa873b127b5eea8cea19982f3552ccc2/image11-3.png" />
            
            </figure><p>Lava lamps with flowing wax.</p><p>Cloudflare’s servers collectively handle upwards of 55 million HTTP requests per second, the <a href="https://radar.cloudflare.com/adoption-and-usage#http-vs-https">vast majority of which are secured via the TLS protocol</a> to ensure authenticity and confidentiality. Under the hood, cryptographic protocols like TLS require an underlying source of secure randomness – otherwise, the security guarantees fall apart.</p><p>Secure randomness used in cryptography needs to be computationally indistinguishable from “true” randomness. For this, it must both pass <a href="https://en.wikipedia.org/wiki/Randomness_test">statistical randomness tests</a>, and the output needs to be unpredictable to any computationally-bounded adversary, no matter how much previous output they’ve already seen. The typical way to achieve this is to take some random ‘seed’ and feed it into a <a href="https://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator"><i>Cryptographically Secure Pseudorandom Number Generator</i></a> (CSPRNG) that can produce an essentially-endless stream of unpredictable bytes upon request. The properties of a CSPRNG ensure that all outputs are practically indistinguishable from truly random outputs to anyone that does not know its internal state. However, this all depends on having a secure random seed to begin with. Take a look at <a href="/lavarand-in-production-the-nitty-gritty-technical-details">this blog</a> for more details on true randomness versus pseudorandomness, and this blog for some great examples of <a href="/why-randomness-matters">what can go wrong with insecure randomness</a>.</p><p>For many years, Cloudflare’s servers relied on local sources of entropy (such as the precise timing of packet arrivals or keyboard events) to seed their entropy pools. While there’s no reason to believe that the local entropy sources on those servers are insecure or could be easily compromised, we wanted to hedge our bets against that possibility. Our solution was to set up a system where our servers could periodically refresh their entropy pools with true randomness from an external source.</p><p>That brings us to LavaRand. “Lavarand” has long been the name given to <a href="https://en.wikipedia.org/wiki/Lavarand">systems used for the generation of randomness</a> (first by Silicon Graphics in 1997). Cloudflare <a href="/randomness-101-lavarand-in-production/">launched its instantiation of a LavaRand</a> system in 2017 as a system that collects entropy from the wall of lava lamps in our San Francisco office and makes it available via an internal API. Our servers then periodically query the API to retrieve fresh randomness from LavaRand and incorporate it into their entropy pools. The contributions made by LavaRand can be considered spice added to the entropy pool mix! (For more technical details on <a href="/lavarand-in-production-the-nitty-gritty-technical-details">contributions made by LavaRand</a>, read our previous blog post.)</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1IPp9Lizp0pL83clLWGGNa/19d397787b5a5adbb337f581d9639fce/image10.jpg" />
            
            </figure><p>Lava lamps in Cloudflare’s San Francisco office.</p>
    <div>
      <h2>Adding to the office chaos</h2>
      <a href="#adding-to-the-office-chaos">
        
      </a>
    </div>
    <p>Our lava lamps in San Francisco have been working tirelessly for years to supply fresh entropy to our systems, but they now have siblings across the world to help with their task! As Cloudflare has grown, so has the variety of entropy sources found in and sourced from our offices. <a href="/cloudflare-top-100-most-loved-workplaces-in-2022">Cloudflare’s Places team works hard</a> to ensure that our offices reflect aspects of our values and culture. Several of our larger office locations include installations of physical systems of entropy, and it is these installations that we have worked to incorporate into LavaRand over time. The tangible and exciting draw of these systems is their basis in physical mechanics that we intuitively consider random. The gloops of warmed ascending “lava” floating past cooler sinking blobs within lava lamps attract our attention just as other unpredictable (and often beautiful) dynamic systems capture our interest.</p>
    <div>
      <h3>London’s unpredictable pendulums</h3>
      <a href="#londons-unpredictable-pendulums">
        
      </a>
    </div>
    <p>Visible to visitors of our London office is a wall of double pendulums whose beautiful swings translate to another source of entropy to LavaRand and to the pool of randomness that Cloudflare’s servers pull from.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1JjgKso6GgfvLX74LEyYsE/7688dcdd10f3f3219f0c569724cb42ab/image8.jpg" />
            
            </figure><p>Close-up of double pendulum display in Cloudflare’s London office.</p><p>To the untrained eye the shadows of the pendulum stands and those cast by the rotating arms on the rear wall might seem chaotic. If so, then this installation should be labeled a success! Different light conditions and those shadows add to the chaos that is captured from this entropy source.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2JWrKSqoaPJQC2VSbHygj/e87c2936282e55730a1db4af7d4f7e7f/Screenshot-2024-03-08-at-13.13.12.png" />
            
            </figure><p>Double pendulum display in Cloudflare’s London office with changing light conditions.</p><p>Indeed, even with these arms restricted to motion in two dimensions, the path traced by the arms is mesmerizingly varied, and can be shown to be <a href="https://en.wikipedia.org/wiki/Double_pendulum">mathematically chaotic</a>. Even if we forget air resistance, temperature, and the environment, and then assume that the mutation is completely deterministic, still the resulting long-term motion is hard to predict. In particular the system is very sensitive to initial conditions, this initial state – how they are set in motion – paired with deterministic behavior produces a unique path that is traced until the pendulum comes to rest, and the system is set in motion by a Cloudflare employee in London once again.</p>
    <div>
      <h3>Austin’s mesmerizing mobiles</h3>
      <a href="#austins-mesmerizing-mobiles">
        
      </a>
    </div>
    <p>The beautiful new Cloudflare office in Austin, Texas recently celebrated its first year since opening. This office contributes its own spin on physical entropy: suspended above the entrance of the Cloudflare office in downtown Austin is an installation of translucent rainbow mobiles. These twirl, reflecting the changing light, and cast coloured patterns on the enclosing walls. The display of hanging mobiles and their shadows are very sensitive to a physical environment which includes the opening and closing of doors, HVAC changes, and ambient light. This chaotic system’s mesmerizing and changing scene is captured periodically and fed into the stream of LavaRand randomness.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5mfXP2V8pX0C0CoheE369Q/83fe1b4bdba232b8c8c722bc49987bfe/Screenshot-2024-03-08-at-13.14.22.png" />
            
            </figure><p>Hanging rainbow mobiles in Cloudflare’s Austin office.</p>
    <div>
      <h2>Mixing new sources into LavaRand</h2>
      <a href="#mixing-new-sources-into-lavarand">
        
      </a>
    </div>
    <p>We incorporated the new sources of office chaos into the LavaRand system (still called LavaRand despite including much more than lava lamps) in the same way as the existing lava lamps, which we’ve previously <a href="/lavarand-in-production-the-nitty-gritty-technical-details">described in detail</a>.</p><p>To recap, at repeated intervals, a camera captures an image of the current state of the randomness display. Since the underlying system is truly random, the produced image contains true randomness. Even shadows and changing light conditions play a part in producing something unique and unpredictable! There is another secret that we should share: at a base level, image sensors in the real world are often a source of sufficient noise that even images taken without the lens cap removed could work well as a source of entropy! We consider this added noise to be a serendipitous addition to the beautiful chaotic motion of these installations.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7zrgpZA2xosqvTzU6dk8V/6e1f061640192f7de4585d7f2959f4a7/Screenshot-2024-03-08-at-13.16.23.png" />
            
            </figure><p>Close-up of hanging rainbow mobiles in Cloudflare’s Austin office.</p><p>Once we have a still image that captures the state of the randomness display at a particular point in time, we compute a compact representation – a hash – of the image to derive a fixed-sized output of truly random bytes.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1VjuWFkK83t3EkTjPxYGc6/2ddc9da8c2553a8a1dbb04513de6acbd/image4-26.png" />
            
            </figure><p>Process of converting physical entropy displays into random byte strings.</p><p>The random bytes are then used as an input (along with the previous seed and some randomness from the system’s local entropy sources) to a <i>Key Derivation Function</i> (KDF) to compute a new randomness seed that is fed into a <a href="https://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator"><i>Cryptographically Secure Pseudorandom Number Generator</i></a> (CSPRNG) that can produce an essentially-endless stream of unpredictable bytes upon request. The properties of a CSPRNG ensure that all outputs are practically indistinguishable from truly random outputs to anyone that does not know its internal state. LavaRand then exposes this stream of randomness via a simple internal API where clients can request fresh randomness.</p>
            <pre><code>seed = KDF(new image || previous seed || system randomness)
rng = CSPRNG(seed)
…
rand1 = rng.random()
rand2 = rng.random()</code></pre>
            
    <div>
      <h2>How can I use LavaRand?</h2>
      <a href="#how-can-i-use-lavarand">
        
      </a>
    </div>
    <p>Applications typically use secure randomness in one of two flavors: private and public.</p><p><b>Private randomness</b> is used for generating passwords, cryptographic keys, user IDs, and other values that are meant to stay secret forever. As we’ve <a href="/lavarand-in-production-the-nitty-gritty-technical-details">previously described</a>, our servers periodically request fresh private randomness from LavaRand to help to update their entropy pools. Because of this, randomness from LavaRand is essentially available to the outside world! One easy way for developers to tap into private randomness from LavaRand is to use the <a href="https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#methods">Web Crypto API’s getRandomValues function</a> from a Cloudflare Worker, or use one that someone has already built, like <a href="https://csprng.xyz/">csprng.xyz</a> (<a href="https://github.com/ejcx/csprng.xyz">source</a>).</p><p><b>Public randomness</b> consists of unpredictable and unbiased random values that are made available to everyone once they are published, and for this reason <b><i>should not be used for generating cryptographic keys</i></b>. The winning lottery numbers and the coin flip at the start of a sporting event are some examples of public random values. A double-headed coin would <i>not</i> be an unbiased and unpredictable source of entropy and would have drastic impacts on the sports betting world.</p><p>In addition to being unpredictable and unbiased, it’s also desirable for public randomness to be <i>trustworthy</i> so that consumers of the randomness are assured that the values were faithfully produced. Not many people would buy lottery tickets if they believed that the winning ticket was going to be chosen unfairly! Indeed, there are known cases of corrupt insiders subverting public randomness for personal gain, like the <a href="https://www.nytimes.com/interactive/2018/05/03/magazine/money-issue-iowa-lottery-fraud-mystery.html">state lottery employee</a> who co-opted the lottery random number generator, allowing his friends and family to win millions of dollars.</p><p>A fundamental challenge of public randomness is that one must trust the authority producing the random outputs. Trusting a well-known authority like <a href="https://beacon.nist.gov/home">NIST</a> may suffice for many applications, but could be problematic for others (especially for applications where decentralization is important).</p>
    <div>
      <h2>drand: distributed and verifiable public randomness</h2>
      <a href="#drand-distributed-and-verifiable-public-randomness">
        
      </a>
    </div>
    <p>To help solve this problem of trust, Cloudflare joined forces with seven other independent and geographically distributed organizations back in 2019 to form the <a href="/league-of-entropy/">League of Entropy</a> to launch a public randomness beacon using the <a href="/inside-the-entropy">drand</a> (pronounced dee-rand) protocol. Each organization contributes its own unique source of randomness into the joint pool of entropy used to seed the drand network – with Cloudflare using randomness from LavaRand, of course!</p><p>While the League of Entropy started out as an experimental network, with the guidance and support from the drand team at <a href="https://protocol.ai/">Protocol Labs</a>, it’s become a reliable and production-ready core Internet service, relied upon by applications ranging from <a href="https://spec.filecoin.io/libraries/drand/">distributed file storage</a> to <a href="https://twitter.com/etherplay/status/1734875536608882799">online gaming</a> to <a href="https://medium.com/tierion/tierion-joins-the-league-of-entropy-replaces-nist-randomness-beacon-with-drand-in-chainpoint-9f3c32f0cd9b">timestamped proofs</a> to <a href="https://drand.love/docs/timelock-encryption/">timelock encryption</a> (discussed further below). The League of Entropy has also grown, and there are now 18 organizations across four continents participating in the drand network.</p><p>The League of Entropy’s drand beacons (each of which runs with different parameters, such as how frequently random values are produced and whether the randomness is <i>chained</i> – more on this below) have two important properties that contribute to their trustworthiness: they are <i>decentralized</i> and <i>verifiable</i>. Decentralization ensures that one or two bad actors cannot subvert or bias the randomness beacon, and verifiability allows anyone to check that the random values are produced according to the drand protocol and with participation from a threshold (at least half, but usually more) of the participants in the drand network. Thus, with each new member, the trustworthiness and reliability of the drand network continues to increase.</p><p>We give a brief overview of how drand achieves these properties using distributed key generation and threshold signatures below, but for an in-depth dive see our <a href="/inside-the-entropy">previous blog post</a> and some of the <a href="https://drand.love/blog/">excellent posts</a> from the drand team.</p>
    <div>
      <h3>Distributed key generation and threshold signatures</h3>
      <a href="#distributed-key-generation-and-threshold-signatures">
        
      </a>
    </div>
    <p>During the initial setup of a drand beacon, nodes in the network run a distributed key generation (DKG) protocol based on the <a href="https://en.wikipedia.org/wiki/Distributed_key_generation">Pedersen commitment scheme</a>, the result of which is that each node holds a “share” (a keypair) for a distributed group key, which remains fixed for the lifetime of the beacon. In order to do something useful with the group secret key like signing a message, at least a threshold (for example 7 out of 9) of nodes in the network must participate in constructing a <a href="https://en.wikipedia.org/wiki/BLS_digital_signature">BLS threshold signature</a>. The group information for the <a href="https://drand.love/blog/2023/10/16/quicknet-is-live/">quicknet</a> beacon on the League of Entropy’s mainnet drand network is shown below:</p>
            <pre><code>curl -s https://drand.cloudflare.com/52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971/info | jq
{
  "public_key": "83cf0f2896adee7eb8b5f01fcad3912212c437e0073e911fb90022d3e760183c8c4b450b6a0a6c3ac6a5776a2d1064510d1fec758c921cc22b0e17e63aaf4bcb5ed66304de9cf809bd274ca73bab4af5a6e9c76a4bc09e76eae8991ef5ece45a",
  "period": 3,
  "genesis_time": 1692803367,
  "hash": "52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971",
  "groupHash": "f477d5c89f21a17c863a7f937c6a6d15859414d2be09cd448d4279af331c5d3e",
  "schemeID": "bls-unchained-g1-rfc9380",
  "metadata": {
    "beaconID": "quicknet"
  }
}</code></pre>
            <p>(The hex value 52db9b… in the URL above is the hash of the beacon’s configuration. Visit <a href="https://drand.cloudflare.com/chains">https://drand.cloudflare.com/chains</a> to see all beacons supported by our mainnet drand nodes.)</p><p>The nodes in the network are configured to periodically (every 3s for quicknet) work together to produce a signature over some agreed-upon message, like the current round number and previous round signature (more on this below). Each node uses its share of the group key to produce a partial signature over the current round message, and broadcasts it to other nodes in the network. Once a node has enough partial signatures, it can aggregate them to produce a group signature for the given round.</p>
            <pre><code>curl -s https://drand.cloudflare.com/52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971/public/13335 | jq
{
  "round": 13335,
  "randomness": "f4eb2e59448d155b1bc34337f2a4160ac5005429644ba61134779a8b8c6087b6",
  "signature": "a38ab268d58c04ce2d22b8317e4b66ecda5fa8841c7215bf7733af8dbaed6c5e7d8d60b77817294a64b891f719bc1b40"
}</code></pre>
            <p>The group signature for a round <i>is</i> the randomness (in the output above, the randomness value is simply the sha256 hash of the signature, for applications that prefer a shorter, fixed-sized output). The signature is unpredictable in advance as long as enough (at least a majority, but can be configured to be higher) of the nodes in the drand network are honest and do not collude. Further, anyone can validate the signature for a given round using the beacon’s group public key. It’s recommended that developers use the drand client <a href="https://drand.love/developer/clients/">libraries</a> or <a href="https://drand.love/developer/drand-client/">CLI</a> to perform verification on every value obtained from the beacon.</p>
    <div>
      <h3>Chained vs unchained randomness</h3>
      <a href="#chained-vs-unchained-randomness">
        
      </a>
    </div>
    <p>When the League of Entropy launched its first generation of drand beacons in 2019, the per-round message over which the group signature was computed included the previous round’s signature. This creates a chain of randomness rounds all the way to the first “genesis” round. Chained randomness provides some nice properties for single-source randomness beacons, and is included as a requirement in <a href="https://csrc.nist.gov/projects/interoperable-randomness-beacons">NIST’s spec for interoperable public randomness beacons</a>.</p><p>However, back in 2022 the drand team introduced the notion of <a href="https://drand.love/blog/2022/02/21/multi-frequency-support-and-timelock-encryption-capabilities/#unchained-randomness-timed-encryption">unchained randomness</a>, where the message to be signed is <i>predictable</i> and doesn’t depend on any randomness from previous rounds, and showed that it provides the same security guarantees as chained randomness for the drand network (both require an honest threshold of nodes). In the implementation of unchained randomness in the <a href="https://drand.love/blog/2023/10/16/quicknet-is-live/">quicknet</a>, the message to be signed simply consists of the round number.</p>
            <pre><code># chained randomness
signature = group_sign(round || previous_signature)

# unchained randomness
signature = group_sign(round)</code></pre>
            <p>Unchained randomness provides some powerful properties and usability improvements. In terms of usability, a consumer of the randomness beacon does not need to reconstruct the full chain of randomness to the genesis round to fully validate a particular round – the only information needed is the current round number and the group public key. This provides much more flexibility for clients, as they can choose how frequently they consume randomness rounds without needing to continuously follow the randomness chain.</p><p>Since the messages to be signed are known in advance (since they’re just the round number), unchained randomness also unlocks a powerful new property: timelock encryption.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5PVw1hyLALNYG3p20U2f2D/eeac0fd2fe805cabc1b75055cc0b0076/image7-7.png" />
            
            </figure><p>Rotating double pendulums.</p>
    <div>
      <h2>Timelock encryption</h2>
      <a href="#timelock-encryption">
        
      </a>
    </div>
    <p>Timelock (or “timed-release”) encryption is a method for encrypting a message such that it cannot be decrypted until a certain amount of time has passed. Two basic approaches to timelock encryption were described by <a href="https://dspace.mit.edu/bitstream/handle/1721.1/149822/MIT-LCS-TR-684.pdf">Rivest, Shamir, and Wagner</a>:</p><p> There are two natural approaches to implementing timed release cryptography:</p><p>  - Use “time-lock puzzles” – computational problems that cannot be solved without running a computer continuously for at least a certain amount of time.</p><p>  - Use trusted agents who promise not to reveal certain information until a specified date.</p><p>Using trusted agents has the obvious problem of ensuring that the agents are trustworthy. Secret sharing approaches can be used to alleviate this concern.</p><p>The drand network is a group of independent agents using secret sharing for trustworthiness, and the ‘certain information’ not to be revealed until a specified date sounds a lot like the per-round randomness! We describe next how timelock encryption can be implemented on top of a drand network with unchained randomness, and finish with a practical demonstration. While we don’t delve into the bilinear groups and pairings-based cryptography that make this possible, if you’re interested we encourage you to read <a href="https://eprint.iacr.org/2023/189">tlock: Practical Timelock Encryption from Threshold BLS</a> by Nicolas Gailly, Kelsey Melissaris, and Yolan Romailler.</p>
    <div>
      <h3>How to timelock your secrets</h3>
      <a href="#how-to-timelock-your-secrets">
        
      </a>
    </div>
    <p>First, identify the randomness round that, once revealed, will allow your timelock-encrypted message to be decrypted. An important observation is that since drand networks produce randomness at fixed intervals, each round in a drand beacon is closely tied to a specific timestamp (modulo small delays for the network to actually produce the beacon) which can be easily computed taking the beacon’s genesis timestamp and then adding the round number multiplied by the beacon’s period.</p><p>Once the round is decided upon, the properties of bilinear groups allow you to encrypt your message to some round with the drand beacon’s group public key.</p>
            <pre><code>ciphertext = EncryptToRound(msg, round, beacon_public_key)</code></pre>
            <p>After the nodes in the drand network cooperate to derive the randomness for the round (really, just the signature on the round number using the beacon’s group secret key), <i>anyone</i> can decrypt the ciphertext (this is where the magic of bilinear groups comes in).</p>
            <pre><code>random = Randomness(round)
message = Decrypt(ciphertext,random)</code></pre>
            <p>To make this practical, the timelocked message is actually the secret key for a symmetric scheme. This means that we encrypt the message with a symmetric key and encrypt the key with timelock, allowing for a decryption in the future.</p><p>Now, for a practical demonstration of timelock encryption, we use a tool that one of our own engineers built on top of Cloudflare Workers. The <a href="https://github.com/thibmeu/tlock-worker">source code</a> is publicly available if you’d like to take a look under the hood at how it works.</p>
            <pre><code># 1. Create a file
echo "A message from the past to the future..." &gt; original.txt

# 2. Get the drand round 1 minute into the future (20 rounds) 
BEACON="52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971"
ROUND=$(curl "https://drand.cloudflare.com/$BEACON/public/latest" | jq ".round+20")

# 3. Encrypt and require that round number
curl -X POST --data-binary @original.txt --output encrypted.pem https://tlock-worker.crypto-team.workers.dev/encrypt/$ROUND

# 4. Try to decrypt it (and only succeed 20 rounds x 3s later)
curl -X POST --data-binary @encrypted.pem --fail --show-error https://tlock-worker.crypto-team.workers.dev/decrypt</code></pre>
            
    <div>
      <h2>What’s next?</h2>
      <a href="#whats-next">
        
      </a>
    </div>
    <p>We hope you’ve enjoyed revisiting the tale of LavaRand as much as we have, and are inspired to visit one of Cloudflare’s offices in the future to see the randomness displays first-hand, and to use verifiable public randomness and timelock encryption from drand in your next project.</p><p>Chaos is required by the encryption that secures the Internet. LavaRand at Cloudflare will continue to turn the chaotic beauty of our physical world into a randomness stream – even as new sources are added – for novel uses all of us explorers – just like that snail – have yet to dream up.</p><p>And she gazed at the sky, the sea, the landThe waves and the caves and the golden sand.She gazed and gazed, amazed by it all,And she said to the whale, “I feel so small.”</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/aUx8oEz7t6W649nYlAmzD/f4658fe8a6b467804f2e6c21c9dec2cb/image1-30.png" />
            
            </figure><p>A snail on a whale.</p><div>
  
</div><p>Tune in for more news, announcements and thought-provoking discussions! Don't miss the full <a href="https://cloudflare.tv/shows/security-week">Security Week hub page</a>.</p> ]]></content:encoded>
            <category><![CDATA[Security Week]]></category>
            <category><![CDATA[Randomness]]></category>
            <category><![CDATA[LavaRand]]></category>
            <category><![CDATA[Research]]></category>
            <guid isPermaLink="false">2V4nElKOJ2taKnxH7Q9pw6</guid>
            <dc:creator>Cefan Daniel Rubin</dc:creator>
            <dc:creator>Luke Valenta</dc:creator>
            <dc:creator>Thibault Meunier</dc:creator>
        </item>
        <item>
            <title><![CDATA[Securing Cloudflare Using Cloudflare]]></title>
            <link>https://blog.cloudflare.com/securing-cloudflare-using-cloudflare/</link>
            <pubDate>Fri, 18 Mar 2022 21:04:00 GMT</pubDate>
            <description><![CDATA[ Cloudflare is committed to bolstering our security posture with best-in-class solutions — which is why we often turn to our own products as any other Cloudflare customer would. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>When a new security threat arises — a publicly exploited vulnerability (like <a href="/tag/log4j/">log4j</a>) or the shift from corporate-controlled environments to remote work or a potential threat actor — it is the Security team’s job to respond to protect Cloudflare’s network, customers, and employees. And as security threats evolve, so should our defense system. Cloudflare is committed to bolstering our security posture with best-in-class solutions — which is why we often turn to our own products as any other Cloudflare customer would.</p><p>We’ve written about using <a href="/dogfooding-from-home/">Cloudflare Access to replace our VPN</a>, <a href="/access-purpose-justification/">Purpose Justification</a> to create granular access controls, and <a href="/using-cloudflare-one-to-secure-iot-devices/">Magic + Gateway</a> to prevent lateral movement from in-house. We experience the same security needs, wants, and concerns as security teams at enterprises worldwide, so we rely on the same solutions as the Fortune 500 companies that trust Cloudflare for improved security, performance, and speed. Using our own products is embedded in our team’s culture.</p>
    <div>
      <h3>Security Challenges, Cloudflare Solutions</h3>
      <a href="#security-challenges-cloudflare-solutions">
        
      </a>
    </div>
    <p>We’ve built the muscle to think Cloudflare-first when we encounter a security threat. In fact, many security problems we encounter have a Cloudflare solution.</p><ul><li><p><b>Problem</b>: <a href="https://www.cloudflare.com/products/zero-trust/remote-workforces/">Remote work</a> creates a security blind spot of remote devices and networks.</p></li><li><p><b>Solution</b>: Deploying Cloudflare Gateway and WARP to shield users and devices from threats, no matter their device or network connection.</p></li></ul><p>Our Detection &amp; Response team has regained visibility into security threats by connecting corporate devices to Gateway through our Cloudflare WARP application. These <a href="https://www.cloudflare.com/learning/security/glossary/what-is-zero-trust/">Zero Trust</a> products shield users and devices from security threats like malware, phishing, shadow IT and more, as well as enable our Security team to instantly block threats and prevent sensitive data from leaving our organization — with no performance impact for our employees, no matter their location.</p><ul><li><p><b>Problem</b>: Larger company footprint (in size and location) increases the complexity of internal tooling.</p></li><li><p><b>Solution</b>: Deploying Cloudflare Access and Purpose Justification to give network administrators granular and contextual application access controls.</p></li></ul><p>Our Identity and Access Management team uses Access to create policies that minimize data access, ensuring that our employees only have access to what they need. Flexibility and instantaneous application of policies allow for ease of scalability as our internal tooling and teams evolve. With Purpose Justification Capture, employees must also justify their use case for visiting domains with particularly sensitive data — which not only solves an internal need for Cloudflare, but helps our customers meet data policy requirements (like GDPR).</p><ul><li><p><b>Problem</b>: Engineering and Product teams move at a rapid pace. Conducting a manual review of every pull request is not scalable.</p></li><li><p><b>Solution</b>: A tool built on top of Workers that enables scanning of PRs for security bugs.</p></li></ul><p>Our Product Security Engineering team uses Cloudflare’s development platform Workers to seamlessly deploy a code review assist framework to flag secrets, vulnerability dependencies, and binary security flags. The flexibility of Workers enables the Security team to evolve the tool depending on security concerns and scale it to the hundreds of PRs the company generates per week.</p><p>These are just some of the ways the Security team has used Cloudflare’s products to block malicious domains, streamline access management, provide visibility into threats, and harden our overall security posture. To give a sense of how we think about these challenges technically, we will dive into the implementation of a use of Cloudflare to secure Cloudflare.</p>
    <div>
      <h3>Phish-proof websites using Cloudflare Access</h3>
      <a href="#phish-proof-websites-using-cloudflare-access">
        
      </a>
    </div>
    <p>Two-factor authentication is one of the most important security controls that can be implemented. Not all second factors provide the same level of security though. Time-based One-time password (TOTP) apps like Google Authenticator are a strong second factor, but are <a href="https://www.cloudflare.com/learning/email-security/what-is-email-fraud/">vulnerable to phishing</a> via man-in-the-middle attacks. A successful phishing attack on an employee with privileged access is a terrifying thought, and it is a risk we wanted to completely eliminate.</p><p><a href="https://fidoalliance.org/specs/fido-v2.0-rd-20161004/fido-client-to-authenticator-protocol-v2.0-rd-20161004.html">FIDO2</a> was developed to provide simple UX and complete protection against phishing attacks. We decided to fully embrace FIDO2 supported security keys in all contexts, but FIDO2 support is not yet ubiquitous and there are many challenging compatibility issues. Cloudflare Access allowed us to enforce that FIDO2 was the only second factor that can be used when reaching systems protected by Cloudflare Access.</p><p>In order to manage our <a href="https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/access_policy">Cloudflare Access policies</a> we check each one into source control as terraform code. Group based access control is enforced for our applications.</p>
            <pre><code>resource "cloudflare_access_policy" "prod_cloudflare_users" {
  application_id = cloudflare_access_application.prod_sandbox_access_application.id
  zone_id        = cloudflare_zone.prod_sandbox.id
  name           = "Allow "
  decision       = "allow"

  include {
    email_domain = ["cloudflare.com"]
    okta {
      # Require membership in Sandbox group
      name                 = ["ACL-ACCESS-sandbox"]
      identity_provider_id = cloudflare_access_identity_provider.okta_prod.id
    }
  }

  # Require a security key
  require {
    auth_method = "swk"
  }
}</code></pre>
            <p>The <code>require</code> section enforces that Cloudflare employees are using their FIDO2 supported security keys to access all of our internal and external applications that are protected by Access. More deeply described in <a href="https://datatracker.ietf.org/doc/rfc8176/">RFC8176</a>, auth_method is enforcing specific values are returned during the login flow from our OIDC provider within the <code>amr</code> field. The enforced <code>swk</code> is “Proof of possession of a software-secured key” which corresponds to logins using a security key.</p><p>The ability to enforce the use of security keys when accessing internal sites caused a massive improvement in our security posture. Prior to implementing this change, for many of our internal services we allowed both soft tokens like TOTP with Google Authenticator, along with WebAuthn because of a small number of systems that still didn’t support FIDO2. You’ll see that our use of soft tokens dropped to near zero after enforcing this change.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2v54nwYAAdgGpHURpaCgUs/dab84ed2d142d749cc47442c1ae06e60/QyHA5DUMOGgeLpD3qvfe-Qr4OnMSMi8n6-hbaeWVvsgZx6ZN0OpDtf72CwAbNY1t1Q1RrRgCdsHuFhJjfkX9WXYr8IM2ctzZPqFVz1o6zGMpCou2bH8l6Ze0ijoX.png" />
            
            </figure>
    <div>
      <h3>A Continued Practice</h3>
      <a href="#a-continued-practice">
        
      </a>
    </div>
    <p>Not only does the Security team deploy Cloudflare’s products, but we test them first too. We work directly with Product to “dog food” our own products first. It’s our mission to help build a better Internet — and that means testing our products and collecting valuable feedback from our internal teams before every launch. As the number one consumer of Cloudflare’s products, the Security team is not only helping keep the company safer, but also contributing to build better products for our customers.</p><p>To learn more about examples and technical implementation of our use of Cloudflare products at Cloudflare, please check out this recent Cloudflare TV segment on <a href="https://cloudflare.tv/event/3XVzDuzBL7TZ5HMB9Ni4b0">Securing Cloudflare with Cloudflare</a><b>.</b></p><p>And for more information on the products mentioned in this document, reach out to our Sales team to find out how we can help you secure your business, teams, and users.</p> ]]></content:encoded>
            <category><![CDATA[Security Week]]></category>
            <category><![CDATA[Dogfooding]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[LavaRand]]></category>
            <guid isPermaLink="false">7fbUy117ZxyBwWgcprLz1l</guid>
            <dc:creator>Molly Cinnamon</dc:creator>
            <dc:creator>Evan Johnson</dc:creator>
        </item>
        <item>
            <title><![CDATA[Pwned Passwords Padding (ft. Lava Lamps and Workers)]]></title>
            <link>https://blog.cloudflare.com/pwned-passwords-padding-ft-lava-lamps-and-workers/</link>
            <pubDate>Wed, 04 Mar 2020 13:00:00 GMT</pubDate>
            <description><![CDATA[ Starting today, we are offering a new security advancement in the Pwned Passwords API - API clients can receive responses padded with random data. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>The Pwned Passwords API (part of Troy Hunt’s <a href="https://haveibeenpwned.com/">Have I Been Pwned</a> service) is used tens of millions of times each day, to alert users if their credentials are breached in a variety of online services, browser extensions and applications. Using Cloudflare, the API cached around 99% of requests, making it very efficient to run.</p><p>From today, we are offering a new security advancement in the Pwned Passwords API - API clients can receive responses padded with random data. This exists to effectively protect from any potential attack vectors which seek to use passive analysis of the size of API responses to identify which anonymised bucket a user is querying. I am hugely grateful to security researcher Matt Weir who I met at <a href="https://passwordscon.org/">PasswordsCon</a> in Stockholm and has explored <a href="https://github.com/lakiw/pwnedpasswords_padding">proof-of-concept</a> analysis of unpadded API responses in Pwned Passwords and has driven some of the work to consider the addition of padded responses.</p><p>Now, by passing a header of “Add-Padding” with a value of “true”, Pwned Passwords API users are able to request padded API responses (to a minimum of 800 entries with additional padding of a further 0-200 entries). The padding consists of randomly generated hash suffixes with the usage count field set to “0”.</p><p>Clients using this approach should seek to exclude 0-usage hash suffixes from breach validation. Given most implementations of PwnedPasswords simply do string matching on the suffix of a hash, there is no real performance implication of searching through the padding data. The false positive risk if a hash suffix matches a randomly generated response is very low, 619/(2<sup>35*4</sup>) ≈ 4.44 x 10<sup>-40</sup>. This means you’d need to do about 10<sup>40</sup> queries (roughly a query for every two atoms in the universe) to have a 44.4% probability of a collision.</p><p>In the future, non-padded responses will be deprecated outright (and all responses will be padded) once clients have had a chance to update.</p><p>You can see an example padded request by running the following curl request:</p>
            <pre><code>curl -H Add-Padding:true https://api.pwnedpasswords.com/range/FFFFF</code></pre>
            
    <div>
      <h2>API Structure</h2>
      <a href="#api-structure">
        
      </a>
    </div>
    <p>The high level structure of the Pwned Passwords API is discussed in my original blog post “<a href="/validating-leaked-passwords-with-k-anonymity/">Validating Leaked Passwords with k-Anonymity</a>”. In essence, a client queries the API for the first 5 hexadecimal characters of a SHA-1 hashed password (amounting to 20 bits), a list of responses is returned with the remaining 35 hexadecimal characters of the hash (140 bits) of every breached password in the dataset. Each hash suffix is appended with a colon (“:”) and the number of times that given hash is found in the breached data.</p><p>An example query for <i>FFFFF</i> can be seen below, with the structure represented:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3NE4abRyEojOo5caiuNQ0D/9d824a10e4a833f7b8acc10dd52eeb5b/pwned_passwords_curl.png" />
            
            </figure><p>Without padding, the message length varies given the amount of hash suffixes in the bucket that is queried. It is known that it is possible to fingerprint TLS traffic based on the encrypted message length - fortunately this padding can be inserted in the API responses themselves (in the HTTP content). We can see the difference in download size between two unpadded buckets by running:</p>
            <pre><code>$ curl -so /dev/null https://api.pwnedpasswords.com/range/E0812 -w '%{size_download} bytes\n'
17022 bytes
$ curl -so /dev/null https://api.pwnedpasswords.com/range/834EF -w '%{size_download} bytes\n'
25118 bytes</code></pre>
            <p>The randomised padded entries can be found with with the “:0” suffix (indicating usage count); for example, below the top three entries are real entries whilst the last 3 represent padding data:</p>
            <pre><code>FF1A63ACC70BEA924C5DBABEE4B9B18C82D:10
FF8A0382AA9C8D9536EFBA77F261815334D:12
FFEE791CBAC0F6305CAF0CEE06BBE131160:2
2F811DCB8FF6098B838DDED4D478B0E4032:0
A1BABA501C55ACB6BDDC6D150CF585F20BE:0
9F31397459FF46B347A376F58506E420A58:0</code></pre>
            
    <div>
      <h2>Compression and Randomisation</h2>
      <a href="#compression-and-randomisation">
        
      </a>
    </div>
    <p>Cloudflare supports both GZip and Brotli for compression. Compression benefits the PwnedPasswords API as responses are hexadecimal represented in ASCII. That said, compression is somewhat limited given the Avalanche Effect in hashing algorithms (that a small change in an input results in a completely different hash output) - each range searched has dramatically different input passwords and the remaining 35 characters of the SHA-1 hash are similarly different and have no expected similarity between them.</p><p>Accordingly, if one were to simply pad messages with null messages (say “000...”), the compression could mean that values padded to the same could be differentiated after compression. Similarly, even without compression, padding messages with the same data could still yield credible attacks.</p><p>Accordingly, padding is instead generated with randomly generated entries. In order to not break clients, such padding is generated to effectively look like legitimate hash suffixes. It is possible, however, to identify such messages as randomised padding. As the PwnedPasswords API contains a count field (distinguished by a colon after the remainder of the hex followed by a numerical count), randomised entries can be distinguished with a 0 usage.</p>
    <div>
      <h2>Lava Lamps and Workers</h2>
      <a href="#lava-lamps-and-workers">
        
      </a>
    </div>
    <p>I’ve written before about how <a href="/optimising-caching-on-pwnedpasswords/">cache optimisation of Pwned Passwords</a> (including using Cloudflare Workers). Cloudflare Workers has an additional benefit that Workers run before elements are pulled from cache.</p><p>This allows for randomised entries to be generated dynamically on a request-to-request basis instead of being cached. This means the resulting randomised padding can differ from request-to-request (thus the amount of entries in a given response and the size of the response).</p><p>Cloudflare Workers supports the <a href="https://developers.cloudflare.com/workers/reference/apis/web-crypto/">Web Crypto API</a>, providing for exposure of a cryptographically sound random number generator. This random number generator is used to decide the variable amount of padding added to each response. Whilst a cryptographically secure random number generator is used for determining the amount of padding, as the random hexadecimal padding does not need to be indistinguishable from the real hashes, for computational performance we use the non-cryptographically secure <i>Math.random()</i> to generate the actual content of the padding.</p><p>Famously, one of the sources of entropy used in Cloudflare servers is <a href="/lavarand-in-production-the-nitty-gritty-technical-details/">sourced from Lava Lamps</a>. By filming a wall of lava lamps in our San Francisco office (with individual photoreceptors picking up on random noise beyond the movement of the lava), we are able to generate random seed data used in servers (complimented by other sources of entropy along the way). This lava lamp entropy is used alongside the randomness sources on individual servers. This entropy is used to seed <i>cryptographically secure pseudorandom number generators</i> (CSPRNG) algorithms when generating random numbers. Cloudflare Workers runtime uses the <a href="https://developers.cloudflare.com/workers/about/how-it-works/">v8 engine</a> for JavaScript, with randomness <a href="https://github.com/v8/v8/blob/master/src/base/utils/random-number-generator.cc#L63">sourced</a> from <i>/dev/urandom</i> on the server itself.</p><p>Each response is padded to a minimum of 800 hash suffixes and a randomly generated amount of additional padding (from 200 entries).</p><p>This can be seen in two ways, firstly we can see that repeating the same responses to the same endpoint (with the underlying response being cached), yields a randomised amount of lines between 800 and 1000:</p>
            <pre><code>$ for run in {1..10}; do curl -s -H Add-Padding:true https://api.pwnedpasswords.com/range/FFFFF | wc -l; done
     831
     956
     870
     980
     932
     868
     856
     961
     912
     827</code></pre>
            <p>Secondly, we can see a randomised download size in each response:</p>
            <pre><code>$ for run in {1..10}; do curl -so /dev/null -H Add-Padding:true https://api.pwnedpasswords.com/range/FFFFF -w '%{size_download} bytes\n'; done
35572 bytes
37358 bytes
38194 bytes
33596 bytes
32304 bytes
37168 bytes
32532 bytes
37928 bytes
35154 bytes
33178 bytes</code></pre>
            
    <div>
      <h2>Future Work and Conclusion</h2>
      <a href="#future-work-and-conclusion">
        
      </a>
    </div>
    <p>There has been a considerable amount of research that has complemented the anonymity approach in Pwned Passwords. For example; Google and Stanford have written a paper about their approach implemented in Google Password Checkup, “Protecting accounts from credential stuffing with password breach alerting” [<a href="https://www.usenix.org/system/files/sec19-thomas.pdf">Usenix</a>].</p><p>We have done a significant amount of work exploring more advanced protocols for Pwned Passwords, some of this work can be found in a paper we worked on with academics at Cornell University, “Protocols for Checking Compromised Credentials” [<a href="https://dl.acm.org/doi/abs/10.1145/3319535.3354229">ACM</a> or <a href="https://arxiv.org/pdf/1905.13737.pdf">arXiv preprint</a>]. This research offers two new protocols (FSB, frequency smoothing bucketization, and IDB, identifier-based bucketization) to further reduce information leakage in the APIs.</p><p>Further work is needed before these protocols gain the production worthiness that we’d like before they are shipped - but, as always, we’ll keep you updated here on our blog.</p> ]]></content:encoded>
            <category><![CDATA[Passwords]]></category>
            <category><![CDATA[Serverless]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Cryptography]]></category>
            <category><![CDATA[Cloudflare Workers]]></category>
            <category><![CDATA[LavaRand]]></category>
            <guid isPermaLink="false">3ikC6g6s6oo3MKLxFvsn3h</guid>
            <dc:creator>Junade Ali</dc:creator>
        </item>
        <item>
            <title><![CDATA[How Cloudflare and Wall Street Are Helping Encrypt the Internet Today]]></title>
            <link>https://blog.cloudflare.com/how-cloudflare-and-wall-street-are-helping-encrypt-the-internet-today/</link>
            <pubDate>Fri, 13 Sep 2019 23:00:00 GMT</pubDate>
            <description><![CDATA[ Today has been a big day for Cloudflare, as we became a public company on the New York Stock Exchange (NYSE: NET). To mark the occasion, we decided to bring our favorite entropy machines to the floor of the NYSE. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Today has been a big day for Cloudflare, as we became a public company on the New York Stock Exchange (NYSE: NET). To mark the occasion, we decided to bring our favorite entropy machines to the floor of the NYSE. Footage of these lava lamps is being used as an additional seed to our <a href="/randomness-101-lavarand-in-production/"><b>entropy-generation system LavaRand</b></a> — bolstering Internet encryption for over 20 million Internet properties worldwide.</p><p><i>(This is mostly for fun. But when’s the last time you saw a lava lamp on the trading floor of the New York Stock Exchange?)</i></p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2g2vH1hZmjN2EcjCIV8wfi/94702da9614d3dd97ddae35c5f8eeff8/NYSE-Lava-Lamps-Cropped.jpg" />
            
            </figure><p>A little context: generating truly random numbers using computers is impossible, because code is inherently deterministic (i.e. predictable). To compensate for this, engineers draw from pools of randomness created by entropy generators, which is a fancy term for "things that are truly unpredictable".</p><p>It turns out that lava lamps are fantastic sources of entropy, as was first shown by Silicon Graphics in the 1990s. It’s a torch we’ve been proud to carry forward: today, Cloudflare uses lava lamps to generate entropy that helps make millions of Internet properties more secure.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/ah3LRVUaM1zY6dND64ghZ/18ce5b07b000d6d951d97cc5753abe81/LavaRand1.png" />
            
            </figure><p>Housed in our San Francisco headquarters is a wall filled with dozens of lava lamps, undulating with mesmerizing randomness. We capture these lava lamps on video via a camera mounted across the room, and feed the resulting footage into an algorithm — called <a href="/lavarand-in-production-the-nitty-gritty-technical-details/"><b>LavaRand</b></a> — that amplifies the pure randomness of these lava lamps to dizzying extremes (computers can't create seeds of pure randomness, but they can massively amplify them).</p><p>Shortly before we rang the opening bell this morning, we recorded footage of our lava lamps in operation on the trading room floor of the New York Stock Exchange, and we're ingesting the footage into our LavaRand system. The resulting entropy is mixed with the myriad additional sources of entropy that we leverage every day, creating a cryptographically-secure source of randomness — fortified by Wall Street.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2i4n94z75iXaoZZFgXxg7y/f8cb4be9c50b4b4ff48b3f3aff354ff7/League-Of-Entropy.png" />
            
            </figure><p>We recently took our enthusiasm for randomness a step further by facilitating the <a href="/league-of-entropy/"><b>League of Entropy</b></a>, a consortium of global organizations and individual contributors, generating verifiable randomness via a globally distributed network. As one of the founding members of the League, LavaRand (pictured above) plays a key role in empowering developers worldwide with a pool of randomness with extreme entropy and high reliability.</p><p>And today, she’s enjoying the view from the podium!</p><hr /><p><i>One caveat: the lava lamps we run in our San Francisco headquarters are recorded in real-time, 24/7, giving us an ongoing stream of entropy. For reasons that are understandable, the NYSE doesn't allow for live video feeds from the exchange floor while it is in operation. But this morning they did let us record footage of the lava lamps operating shortly before the opening bell. The video was recorded and we're ingesting it into our LavaRand system (alongside many other entropy generators, including the lava lamps back in San Francisco).</i></p> ]]></content:encoded>
            <category><![CDATA[LavaRand]]></category>
            <category><![CDATA[Entropy]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Encryption]]></category>
            <guid isPermaLink="false">5cmkZ6Tia2iUD2yBBnQAOb</guid>
            <dc:creator>Nick Sullivan</dc:creator>
        </item>
        <item>
            <title><![CDATA[League of Entropy: Not All Heroes Wear Capes]]></title>
            <link>https://blog.cloudflare.com/league-of-entropy/</link>
            <pubDate>Mon, 17 Jun 2019 13:01:00 GMT</pubDate>
            <description><![CDATA[ Everything from cryptography to big money lottery to quantum mechanics requires some form of randomness. But what exactly does it mean for a number to be randomly generated and where does the randomness come from? ]]></description>
            <content:encoded><![CDATA[ <p></p><p>To kick-off <a href="/welcome-to-crypto-week-2019/">Crypto Week 2019</a>, we are really excited to announce a new solution to a long-standing problem in cryptography. To get a better understanding of the technical side behind this problem, please refer to the next <a href="/inside-the-entropy">post</a> for a deeper dive.</p><p>Everything from cryptography to big money lottery to <a href="https://arxiv.org/pdf/1611.02176.pdf">quantum mechanics</a> requires some form of randomness. But what exactly does it mean for a number to be randomly generated and where does the randomness come from?</p><p>Generating randomness dates back three thousand years, when the ancients rolled “the bones” to determine their fate. Think of lotteries-- seems simple, right? Everyone buys their tickets, chooses six numbers, and waits for an official to draw them randomly from a basket. Sounds like a foolproof solution. And then in 1980, the host of the Pennsylvania lottery drawing was <a href="https://www.nytimes.com/1981/05/21/us/2-guilty-of-bid-to-rig-pennsylvania-lottery.html">busted for using weighted balls</a> to choose the winning number. This lesson, along with the need of other complex systems for generating random numbers spurred the creation of random number generators.</p><p>Just like a lottery game selects random numbers unpredictably, a random number generator is a device or software responsible for generating sequences of numbers in an unpredictable manner. As the need for randomness has increased, so has the need for constant generation of substantially large, unpredictable numbers. This is why organizations developed <a href="https://csrc.nist.gov/Projects/Interoperable-Randomness-Beacons">publicly available randomness beacons</a> -- servers generating completely unpredictable 512-bit strings (about 155-digit numbers) at regular intervals.</p><p>Now, you might think using a randomness beacon for random generation processes, such as those needed for lottery selection, would make the process resilient against adversarial manipulation, but that’s not the case. Single-source randomness has been exploited to generate biased results.</p><p>Today, randomness beacons generate numbers for lotteries and election audits -- both affect the lives and fortunes of millions of people. Unfortunately, exploitation of the single point of origin of these beacons have created dishonest results that benefited one <a href="https://www.nytimes.com/interactive/2018/05/03/magazine/money-issue-iowa-lottery-fraud-mystery.html">corrupt insider</a>. To thwart exploitation efforts, Cloudflare and other randomness-beacon providers have joined forces to bring users a <b>quorum of decentralized randomness beacons</b>. After all, eight independent globally distributed beacons can be much more trustworthy than one!</p><p>We’re happy to introduce you to ....</p><p>THE LEAGUE …. OF …. ENTROPY !!!!!!</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3u6pMN9g1KQu3ZvwMTwkmb/d90c484cfb789a728cd8fdcc0f002324/image8-1.png" />
            
            </figure>
    <div>
      <h3>What is a randomness beacon?</h3>
      <a href="#what-is-a-randomness-beacon">
        
      </a>
    </div>
    <p>A randomness beacon is a public service that provides unpredictable random numbers at regular intervals.</p><p><a href="https://github.com/dedis/drand">drand</a> (pronounced dee-rand) is a <i>distributed randomness</i> beacon developed by <a href="https://twitter.com/nikkolasg1">Nicolas Gailly</a>; with the help of <a href="https://twitter.com/daeinar">Philipp Jovanovic</a>, and <a href="https://github.com/PizzaWhisperer">Mathilde Raynal</a>. The drand project originated from the research paper <a href="https://www.ieee-security.org/TC/SP2017/papers/413.pdf">Scalable Bias-Resistant Distributed Randomness</a> published at the <a href="https://ieeexplore.ieee.org/abstract/document/7958592">2017 IEEE Symposium on Security and Privacy</a> by <a href="http://ewa.syta.us/">Ewa Syta</a>, <a href="https://philipp.jovanovic.io">Philipp Jovanovic</a>, <a href="https://lefteriskk.github.io/">Eleftherios Kokoris Kogias</a>, <a href="https://github.com/nikkolasg/">Nicolas Gailly</a>, <a href="https://people.epfl.ch/linus.gasser">Linus Gasser</a>, <a href="https://ismailkhoffi.com/">Ismail Khoffi</a>, <a href="http://www.cs.yale.edu/homes/fischer/">Michael J. Fischer</a>, <a href="https://bford.info/">Bryan Ford</a>, from the <a href="https://dedis.epfl.ch/">Decentralized/Distributed Systems (DEDIS) lab</a> at <a href="https://www.epfl.ch/">EPFL</a>, <a href="https://www.yale.edu/">Yale University</a>, and <a href="https://www.trincoll.edu/">Trinity College Hartford</a>, with support from <a href="https://researchinstitute.io/">Research Institute</a>.</p><p>For every randomness generation round, drand provides the following properties, as specified in the <a href="https://www.ieee-security.org/TC/SP2017/papers/413.pdf">research paper</a>:</p><ul><li><p><b>Availability</b> - The distributed randomness generation completes successfully with high probability.</p></li><li><p><b>Unpredictability</b> - No party learns anything about the random output of the current round, except with negligible probability, until a sufficient number of drand nodes reveals their contributions in the randomness generation protocol.</p></li><li><p><b>Unbiasability</b> - The random output represents an unbiased, uniformly random value, except with negligible probability.</p></li><li><p><b>Verifiability</b> - The random output is third-party verifiable against the collective public key computed during drand's setup. This serves as the unforgettable attestation that the documented set of drand nodes ran the protocol to produce the one-and-only random output, except with negligible probability.</p></li></ul><p><i>Entropy</i> measures the unpredictable nature of a number. For randomness, the more entropy the better, so naturally it’s where we got our name, the League of Entropy.</p><p>Our founding members are contributing their individual high-entropy sources to provide a more random and unpredictable beacon to generate publicly verifiable random values every sixty seconds. The fact that the drand beacon is decentralized and built using appropriate, provably-secure cryptographic primitives, increases our confidence that it possesses all the aforementioned properties.</p><p>This global network of servers generating randomness ensures that even if a few servers are offline, the beacon continues to produce new numbers by using the remaining online servers.  Even if one or two of the servers or their entropy sources were to be compromised, the rest will still ensure that the jointly-produced entropy is fully unpredictable and unbiasable.</p><p>Who exactly is running this beacon? Currently, The League of Entropy is a consortium of global organizations and individual contributors, including: Cloudflare, Protocol Labs researcher Nicolas Gailly, University of Chile, École polytechnique fédérale de Lausanne  (EPFL), Kudelski Security, and EPFL researchers, Philipp Jovanovic and Ludovic Barman.</p>
    <div>
      <h3>Meet the League of Entropy</h3>
      <a href="#meet-the-league-of-entropy">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/BWt5ZDGMydRLWX7xttadU/47daf5fed2017f4359b6354938faca5d/image4-3.png" />
            
            </figure><p>Cloudflare’s <b>LavaRand</b>: <a href="/lavarand-in-production-the-nitty-gritty-technical-details/">LavaRand</a> sources her high entropy from Cloudflare’s wall of lava lamps at our San Francisco Headquarters. The unpredictable flow of “lava” inside the lamps is used as an input to a camera feed into a CSPRNG (Cryptographically Secure PseudoRandom Number Generator) that generates the random value.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1rPgrKMIvEhDQcA9mb96Xg/69c52f8b49ab3d5f4a75097db174491c/3R-uEem_pwlr_yfXEVJJiub0eiVTPEX01rBof0SB1xopcgbzgfOFsH4BLRXKfdnwqpAkXlJbBFG6PUQRBK-UJBqTEGIFKQxQaRaq-5FoZG8ny6WhkahwAMjSTD9X.png" />
            
            </figure><p><a href="https://www.epfl.ch">EPFL</a>’s <b>URand</b>: URand’s power comes from the local randomness generator present on every computer at /dev/urandom. The randomness input is collected from inputs such as keyboard presses, mouse clicks, network traffic, etc. URand bundles these random inputs to produce a continuous stream of randomness.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2MG8iT5EJUNbvBMRnIs0jL/5e874cbd8522463cd841550a3ce6a735/image5-2.png" />
            
            </figure><p><a href="https://random.uchile.cl/en/">UChile</a>’s <b>Seismic Girl</b>: Seismic Girl extracts super verifiable randomness from five sources queried every minute. These sources include: seismic measurements of shakes and earthquakes in Chile; a stream from a local radio station; a selection of Twitter posts; data from the Ethereum blockchain; and their own off-the-shelf RNG card.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3yqHoYjeD9Bc2rqw64Z0AI/2b2913dc2ffbcf95bca4c91e7b43db40/Sg4AYv1L_bjeQyXri7ksWM9w13hQrghD-seBI2ErHx_k4XL5Cm0f2xXZsvDRNEu3ZQCX0klZevk8Y6U3BdS_XU7AaC1VWYeL34ZSjSa1fZXKYg1I7AP6IaxkmAOH.png" />
            
            </figure><p><a href="https://www.kudelskisecurity.com/">Kudelski Security</a>’s <b>ChaChaRand</b>: ChaChaRand uses a CRNG (Cryptographic Random Number Generator) based on the <a href="https://tools.ietf.org/html/rfc7539">ChaCha20</a> stream cipher.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6wjCZoEtdvwmp3n89CMvgM/7aaf481355bad193d251013c1b8466fc/image3-3.png" />
            
            </figure><p><a href="https://protocol.ai/">Protocol Labs</a>’ <b>InterplanetaryRand</b>: InterplanetaryRand uses the power of entropy to ensure protocol safety across space and time by using environmental noise and the Linux PRNG, supplemented by CPU-sourced randomness (<a href="/ensuring-randomness-with-linuxs-random-number-generator/">RdRand</a>).</p><p>Together, our heroes are committed to #savetheinternet by combining their randomness to form a globally distributed and cryptographically verifiable randomness beacon.  </p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/oq8NHvjmXXlKoLJrhmDq9/63750368c5a8c280e05365de5789bef2/pTiFdLtxsabqbVpczCBKVT4dzbP9e9WxeU4lOPbiUIecOR5ER9QlRZG196PfYvJvF_Sbm-DTlUphCBWBMIOtqiTTKmTmRDumoCUlges8uEmNxJh75unUdnP2xobX.png" />
            
            </figure>
    <div>
      <h3>Public versus Private Randomness</h3>
      <a href="#public-versus-private-randomness">
        
      </a>
    </div>
    <p>Different types of randomness are needed for different types of applications.</p><p>The trick to generating secure cryptographic keys is to use large, privately-generated random numbers that no one else can predict. With randomness beacons publicly generating and announcing random numbers, <b>users should NOT be using the output of a randomness beacon for their secret keys</b>, as these numbers are accessible by anyone. If an attacker can guess the random number that a user’s private cryptographic key was derived from, they can crack their system and decrypt confidential information. This simply means that random numbers generated by a public beacon are not safe to use for encryption keys: not because there’s anything wrong with the randomness, but simply because the randomness is public.</p><p>Clients using the drand beacon can request private randomness from some or all of the drand nodes if they would like to generate a random value that will not be publicly announced.  For more information on how to do this, check the <a href="https://developers.cloudflare.com/randomness-beacon/">developer docs.</a></p><p>On the other hand, public randomness is often employed by users requiring a randomness value that is not supposed to be secret but whose generation must be transparent, fair, and unbiased. This is perfect for many purposes such as games, lotteries, and election auditing, where the auditor and the public require transparency into when and how and how fairly the random value was generated.The League of Entropy provides <b>public randomness</b> that any user can retrieve from <a href="https://leagueofentropy.com">leagueofentropy.com</a>. Users will be able to view the 512-bit string value that is generated every 60 seconds. Why 60 seconds? No particular reason. Theoretically, the randomness generation can go as fast as the hardware allows, but it’s not necessary for most use cases. Values generated every 60 seconds give users 1440 random values in one 24-hour period.</p><p>*FRIENDLY REMINDER: THIS RANDOMNESS IS PUBLIC. DO NOT USE IT FOR PRIVATE CRYPTOGRAPHIC KEYS*</p>
    <div>
      <h3>Why does public randomness matter?</h3>
      <a href="#why-does-public-randomness-matter">
        
      </a>
    </div>
    
    <div>
      <h4>Election auditing</h4>
      <a href="#election-auditing">
        
      </a>
    </div>
    <p>In the US, most elections are followed by an audit to verify they were unbiased and conducted fairly. Robust auditing systems increase voter confidence by improving election officials’ ability to respond effectively to allegations of fraud, and to detect bugs in the system.</p><p>Currently, most election ballots and precincts are randomly chosen by election officials. This approach is potentially vulnerable to bias by a corrupt insider who might select certain precincts to present a preferred outcome. Even in a situation where every voter district was tampered with, by using a robust, distributed, and most importantly, <i>unpredictable and unbiasable</i> beacon, election auditors can trust that a small sample of districts is enough to audit, as long as an attacker cannot predict district selection.</p><p>In Chile, election poll workers are randomly selected from a pool of eligible voters. The University of Chile’s Random UChile <a href="https://random.uchile.cl/en/">project</a> has been working on a prototype that uses their randomness beacon for this process. Alejandro Hevia, leader of Random UChile, believes that for election auditing, public randomness is important for transparency and distributed randomness gives people the ability to trust the unlikeliness that <i>multiple</i> contributors to the beacon colluded, as opposed to trusting a single entity.</p>
    <div>
      <h4>Lotteries</h4>
      <a href="#lotteries">
        
      </a>
    </div>
    <p>From 2005 to 2014, the information security director for the Multi-State Lottery Association, Eddie Tipton, <a href="https://www.nytimes.com/interactive/2018/05/03/magazine/money-issue-iowa-lottery-fraud-mystery.html">rigged a random number generator</a> and won the lottery <b>six</b> times!</p><p>Tipton could predict the winning numbers by skipping the standard random seeding process. He was able to insert into the function of the random number generator code that checked the date, day of the week, and time. If these three variables did not align, the random number generator used radioactive material and a Geiger counter to generate a random seed. If the variables aligned as surreptitiously programmed, which usually only happened once a year, then it would generate the seed using a 7-variable formula fed into a <a href="https://en.wikipedia.org/wiki/Mersenne_Twister">Mersenne Twister</a>, a <i>pseudo</i> random-number generator.</p><p>Tipton knew these 7 variables. He knew the small pool of numbers that might be the seed. This knowledge allowed him to predict the results of the Mersenne Twister. This is a scam which a <b>distributed randomness beacon</b> can make substantially more difficult, if not impossible.</p><p>Rob Sand, the former Iowa Assistant Attorney General and current Iowa State Auditor who prosecuted the Tipton cases, is also an advocate for improved controls. He said:</p><p><i>“There is no excuse for an industry that rakes in $80 billion in annual revenue not to use the most sophisticated, truly random means available to ensure integrity.”</i></p>
    <div>
      <h4>Distributed ledger platforms</h4>
      <a href="#distributed-ledger-platforms">
        
      </a>
    </div>
    <p>In many cryptocurrencies and blockchain-based distributed computing platforms, such as <a href="https://en.wikipedia.org/wiki/Ethereum">Ethereum</a>, there is often a need for random selection at the application layer. One solution to prevent bias for such a random selection is to use a distributed randomness beacon like drand to generate the random value. Justin Drake, researcher at the <a href="https://www.ethereum.org/">Ethereum Foundation</a>, believes "randomness from a drand-type federation could be a particularly good match for real-time decentralized applications on Ethereum such as live gaming and gambling". This is due to the possibility to deliver ultra-low latency randomness applicable for a broad range of application where public randomness is required.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4hGB9Ryb87DWFPSKjFCiQQ/5bcdf5446f0344d2c0a123226dba867c/IzxDdb91VENIgVK05HqMqA6u2mwL-pMx3GLBdxJQjCeaPSD1bGTjE3mnOyInEOgq0lyovRBghGCcDbPpWSPO4ToT2tR4aftwcLdQNVwCKn3Lghh2FkK8UbEkC63J.png" />
            
            </figure>
    <div>
      <h3>Let’s get you on drand!</h3>
      <a href="#lets-get-you-on-drand">
        
      </a>
    </div>
    <p>To learn more about the League of Entropy and how to use the distributed randomness beacon, visit <a href="https://leagueofentropy.com">https://leagueofentropy.com</a>. The website periodically displays the randomness generated by the network, and you can even see previously generated values. Go ahead, try it out!</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/45QOeg172UTQopTpSz4urP/4dadd599bf2c2c1b3a447de62174eca1/30p6dmRd2omn-YRzrY7oPmYEVUwRFOo7izqymD6xvYQ9txl6hzOwachb_AkrHilkBKEr2kZu_lCGSXhJQrubJ_q1gPbf-NYu4V3o98cvIfa_bq2Ug1MLk6PrSysL.png" />
            
            </figure>
    <div>
      <h3>How to join the league:</h3>
      <a href="#how-to-join-the-league">
        
      </a>
    </div>
    <p>Want to join the league?? We’re not exclusive!</p><p>If you are an organization or an individual who is interested in contributing to the drand beacon, check out <a href="https://developers.cloudflare.com/randomness-beacon/">the developer docs</a> for more information regarding the requirements for setting up a server and joining the existing group. drand is currently in its beta release phase and an approval request must be sent to <a href="#">leagueofentropy@googlegroups.com</a> in order to be approved as a contributing server.</p><p><b>UPDATE:</b> As of <a href="https://drand.love/blog/2020/08/10/drand-launches-v1-0/">August 2020</a>, drand is a production-grade network supporting critical use cases including Filecoin. For the most up-to-date information on the drand project and the League of Entropy, see <a href="https://drand.love/">drand.love</a>.</p>
    <div>
      <h3>Looking into the future</h3>
      <a href="#looking-into-the-future">
        
      </a>
    </div>
    <p>It only makes sense that the Internet of the future will demand unpredictable randomness beacons. The League of Entropy is out there now, creating the basis for future systems to leverage trustworthy public randomness. Our goal is to increase user trust and provide a one-stop shop for all your public entropy needs. Come, join us!</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5u1TlHjajsOzmkNeIqsGoH/b881384074d8b079c0234550377f87aa/image2-4.png" />
            
            </figure> ]]></content:encoded>
            <category><![CDATA[Crypto Week]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Cryptography]]></category>
            <category><![CDATA[Entropy]]></category>
            <category><![CDATA[LavaRand]]></category>
            <guid isPermaLink="false">66MECAsvLf18mL0k238aK8</guid>
            <dc:creator>Dina Kozlov</dc:creator>
        </item>
        <item>
            <title><![CDATA[Technical reading from the Cloudflare blog for the holidays]]></title>
            <link>https://blog.cloudflare.com/2017-holiday-reading-from-the-cloudflare-blog/</link>
            <pubDate>Fri, 22 Dec 2017 14:17:57 GMT</pubDate>
            <description><![CDATA[ During 2017 Cloudflare published 172 blog posts (including this one). If you need a distraction from the holiday festivities at this time of year here are some highlights from the year. ]]></description>
            <content:encoded><![CDATA[ <p>During 2017 Cloudflare published 172 blog posts (including this one). If you need a distraction from the holiday festivities at this time of year here are some highlights from the year.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1FupNPeMEDTcUGuKJCQ2hX/69f106f4d37e6f7ce629f3845d88f8ed/33651510973_9bc38cc550_z.jpg" />
            
            </figure><p><a href="https://creativecommons.org/licenses/by/2.0/">CC BY 2.0</a> <a href="https://www.flickr.com/photos/148114704@N05/33651510973/in/photolist-TgEMP4-5W4SKe-5QXuaQ-avwN4J-9kM47Q-5sZfg5-62HmQr-vRsPNX-9gu8zw-8tzfDA-7L9szU-2j3fkx-kdS5xh-dTvJ1k-bd2nWP-5eyMyX-cYKDeY-aha8Je-s9FApd-afsNQp-Rr9uMb-6w5kZp-e8k7Zc-7JV8KQ-Sbxdzt-emJeJJ-fvoSPx-7jDQjL-cNbEy7-Ht7oDe-6w5mqM-cDJ6PS-cDHREJ-2L3KsB-2rjJQY-9kxtQm-b31okB-2rfQ8c-bHhPX-dr6fiP-5sUUEp-DDzAGu-onQfBb-afsNzx-kdS4E5-fVkm7-okB223-7ZrhKH-9eLu3Y-pcsdc4">image</a> by <a href="https://perzonseo.com">perzon seo</a></p><p><a href="/the-wirex-botnet/">The WireX Botnet: How Industry Collaboration Disrupted a DDoS Attack</a></p><p>We worked closely with companies across the industry to track and take down the Android WireX Botnet. This blog post goes into detail about how that botnet operated, how it was distributed and how it was taken down.</p><p><a href="/randomness-101-lavarand-in-production/">Randomness 101: LavaRand in Production</a></p><p>The wall of Lava Lamps in the San Francisco office is used to feed entropy into random number generators across our network. This blog post explains how.</p><p><a href="/arm-takes-wing/">ARM Takes Wing: Qualcomm vs. Intel CPU comparison</a></p><p>Our <a href="https://www.cloudflare.com/network/">network</a> of data centers around the world all contain Intel-based servers, but we're interested in ARM-based servers because of the potential cost/power savings. This blog post took a look at the relative performance of Intel processors and Qualcomm's latest server offering.</p><p><a href="/how-to-monkey-patch-the-linux-kernel/">How to Monkey Patch the Linux Kernel</a></p><p>One engineer wanted to combine the Dvorak and QWERTY keyboard layouts and did so by patching the Linux kernel using <a href="https://sourceware.org/systemtap/">SystemTap</a>. This blog explains how and why. Where there's a will, there's a way.</p><p><a href="/introducing-cloudflare-workers/">Introducing Cloudflare Workers: Run JavaScript Service Workers at the Edge</a></p><p>Traditionally, the Cloudflare network has been <i>configurable</i> by our users, but not <i>programmable</i>. In September, we introduced <a href="https://www.cloudflare.com/products/cloudflare-workers/">Cloudflare Workers</a> which allows users to write JavaScript code that runs on our edge worldwide. This blog post explains why we chose JavaScript and how it works.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3rDQWcCe0YDvxU6a8enygs/e436188ab1b54b75b1a875143e9c08c5/5586120601_a7b1776371_b.jpg" />
            
            </figure><p><a href="https://creativecommons.org/licenses/by/2.0/">CC BY 2.0</a> <a href="https://www.flickr.com/photos/werkman/5586120601/in/photolist-9vCk3a-21Bd6Xh-8nCHw7-ptePkD-RJQgiN-nWZ5u6-3xLVWE-rDFYG8-LH8sS-2peYb-mX5MQc-6JxAT-aAArZQ-rJfmkx-9HavML-TX5hUW-niuhtp-jHGzT5-5eRuc3-Gv67PP-fs2mGn-8mhB7f-8pDZbD-ZPoZDF-3xLxd3-6k15Ni-j1zK3-8mhB8b-7RjyKs-57C9rW-j1zBX-bTs5tP-8wuUBf-7r7fAq-8jPBD4-5bnWiq-e88EiF-ddTbY7-PVC9U-e88E6P-S4eP6f-8jPkh2-5bj6xn-NzVdo-7rQyZa-4Dm4gX-ZCuaMm-pQr1Hw-yf9rdC-21HJvkv">image</a> by <a href="https://www.flickr.com/photos/werkman/">Peter Werkman</a></p><p><a href="/geo-key-manager-how-it-works/">Geo Key Manager: How It Works</a></p><p>Our <a href="/introducing-cloudflare-geo-key-manager/">Geo Key Manager</a> gives customers granular control of the location of their private keys on the Cloudflare network. This blog post explains the mathematics that makes the possible.</p><p><a href="/sidh-go/">SIDH in Go for quantum-resistant TLS 1.3</a></p><p>Quantum-resistant cryptography isn't an academic fantasy. We implemented the SIDH scheme as part of our Go implementation of TLS 1.3 and open sourced it.</p><p><a href="/the-languages-which-almost-became-css/">The Languages Which Almost Became CSS</a></p><p>This blog post recounts the history of CSS and the languages that might have been CSS.</p><p><a href="/perfect-locality-and-three-epic-systemtap-scripts/">Perfect locality and three epic SystemTap scripts</a></p><p>In an ongoing effort to understand the performance of NGINX under heavy load on our machines (and wring out the greatest number of requests/core), we used SystemTap to experiment with different queuing models.</p><p><a href="/counting-things-a-lot-of-different-things/">How we built rate limiting capable of scaling to millions of domains</a></p><p>We rolled out a <a href="#">rate limiting</a> feature that allows our customers to control the maximum number of HTTP requests per second/minute/hour that their servers receive. This blog post explains how we made that operate efficiently at our scale.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4cQPAfJHM6gES4uXsyRwd4/f871a9d7627a4ea4f405ea76524e9545/26797557806_18daa76ec2_z.jpg" />
            
            </figure><p><a href="https://creativecommons.org/licenses/by/2.0/">CC BY 2.0</a> <a href="https://www.flickr.com/photos/waters2712/26797557806/in/photolist-GQ1ujJ-ovpzb8-5hGjhb-pkkHPH-7Ed3eQ-5TiuCW-6tknkf-7JGpz4-81Rc1J-qM8AwX-dQVifV-nWZ5u6-puAvLe-acEK6v-F5KyvG-4Ykyf1-bvH81M-FF6XnD-KLqgJ-4rLnJE-d8b1tS-dQVisV-7cTp1r-pkkHic-6oKTtx-9mKe1u-5vsfch-coUNp9-o9Txa7-9p7thZ-aWYjuc-SV2qEb-7LXSYz-9Fcnam-fkr4Fc-b6Dtmt-6r1QQ2-5ndv1D-fuUiKV-qDAQxe-cjZhVY-6Hn6G1-qPMScz-mJAvhc-8LVJNj-7Ed3cf-9wFgvw-9z5jt9-bGsg4R-72BBkc">image</a> by <a href="https://www.flickr.com/photos/waters2712/">Han Cheng Yeh</a></p><p><a href="/reflections-on-reflections/">Reflections on reflection (attacks)</a></p><p>We deal with a new DDoS attack every few minutes and in this blog post we took a close look at reflection attacks and revealed statistics on the types of reflection-based DDoS attacks we see.</p><p><a href="/on-the-dangers-of-intels-frequency-scaling/">On the dangers of Intel's frequency scaling</a></p><p>Intel processors contain special AVX-512 that provide 512-bit wide SIMD instructions to speed up certain calculations. However, these instructions have a downside: when used the CPU base frequency is scaled down slowing down other instructions. This blog post explores that problem.</p><p><a href="/how-cloudflare-analyzes-1m-dns-queries-per-second/">How Cloudflare analyzes 1M DNS queries per second</a></p><p>This blog post details how we handle logging information for 1M DNS queries per second using a custom pipeline, <a href="https://clickhouse.yandex/">ClickHouse</a> and Grafana (via a connector we <a href="https://github.com/vavrusa/grafana-sqldb-datasource">open sourced</a>) to build real time dashboards.</p><p><a href="/aes-cbc-going-the-way-of-the-dodo/">AES-CBC is going the way of the dodo</a></p><p>CBC-mode cipher suites have been declining for some time because of padding oracle-based attacks. In this blog we demonstrate that AES-CBC has now largely been replaced by <a href="/it-takes-two-to-chacha-poly/">ChaCha20-Poly1305</a> .</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6CVkU8gCFVwghZzoP3x0Sd/c90d63d983ab453d7115daac2d16e632/3414054443_2bd47e12f7_b.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/spanginator/3414054443/in/photolist-6cFVrD-6cvz6R-6cKZLw-rn74T-7RoM6f-ATb57-aQHtja-7i1omC-xGoWE-8FsWpL-6DbHyD-9aFjZn-BxbDmF-23fTGw-4v5aS-81KR9D-ahC42F-7ibXNR-Hod7ZY-7hS2JP-fnyx1X-4Pjy9v-kNu6rR-FFmpx9-Gyx1By-GsEegj-7hVPHw-Gv6zDR-F5KyvG-FF6XnD-FZk6kU-9re3Rz-dRTft-btLnvB-o3PQ5p-nU34U-VCRL7q-YhCTjj-L44FTc-Ke5mko-L1vxdJ-KehBhx-7BjC9n-7xSGtH-pEfb5f-2pqSst-7Xhhmq-o8u7ja-pWNcy2-KSCBjW">image</a> by <a href="https://www.flickr.com/photos/spanginator/">Christine</a></p><p><a href="/how-we-made-our-dns-stack-3x-faster/">How we made our DNS stack 3x faster</a></p><p>We answer around 1 million authoritative DNS queries per second using a custom software stack. Responding to those queries as quickly as possible is why Cloudflare is <a href="http://www.dnsperf.com/">fastest</a> authoritative DNS provider on the Internet. This blog post details how we made our stack even faster.</p><p><a href="/quantifying-the-impact-of-cloudbleed/">Quantifying the Impact of "Cloudbleed"</a></p><p>On February 18 a serious security bug was reported to Cloudflare. Five days <a href="/incident-report-on-memory-leak-caused-by-cloudflare-parser-bug/">later</a> we released details of the problem and six days after that we posted this analysis of the impact.</p><p><a href="/luajit-hacking-getting-next-out-of-the-nyi-list/">LuaJIT Hacking: Getting next() out of the NYI list</a></p><p>We make extensive use of <a href="http://luajit.org/">LuaJIT</a> when processing our customers' traffic and making it faster is a key goal. In the past, we've sponsored the project and everyone benefits from those contributions. This blog post examines getting one specific function JITted correctly for additional speed.</p><p><a href="/privacy-pass-the-math/">Privacy Pass: The Math</a></p><p>The <a href="https://privacypass.github.io/">Privacy Pass</a> project provides a zero knowledge way of proving your identity to a service like Cloudflare. This detailed blog post explains the mathematics behind authenticating a user without knowing their identity.</p><p><a href="/how-and-why-the-leap-second-affected-cloudflare-dns/">How and why the leap second affected Cloudflare DNS</a></p><p>The year started with a bang for some engineers at Cloudflare when we ran into a bug in our custom DNS server, <a href="/tag/rrdns/">RRDNS</a>, caused by the introduction of a <a href="https://en.wikipedia.org/wiki/Leap_second">leap second</a> at midnight UTC on January 1, 2017. This blog explains the error and why it happened.</p><p>There's <a href="https://datacenter.iers.org/web/guest/eop/-/somos/5Rgv/latest/16">no leap second</a> this year.</p> ]]></content:encoded>
            <category><![CDATA[Year in Review]]></category>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[LavaRand]]></category>
            <category><![CDATA[DDoS]]></category>
            <category><![CDATA[Geo Key Manager]]></category>
            <category><![CDATA[DNS]]></category>
            <category><![CDATA[LUA]]></category>
            <category><![CDATA[Privacy Pass]]></category>
            <category><![CDATA[Vulnerabilities]]></category>
            <category><![CDATA[Bots]]></category>
            <guid isPermaLink="false">1PeYMnOt6XNE3dqjt2m9aq</guid>
            <dc:creator>John Graham-Cumming</dc:creator>
        </item>
        <item>
            <title><![CDATA[LavaRand in Production: The Nitty-Gritty Technical Details]]></title>
            <link>https://blog.cloudflare.com/lavarand-in-production-the-nitty-gritty-technical-details/</link>
            <pubDate>Mon, 06 Nov 2017 06:07:00 GMT</pubDate>
            <description><![CDATA[ As some of you may know, there's a wall of lava lamps in the lobby of our San Francisco office that we use for cryptography. In this post, we’re going to explore how that works in technical detail.  ]]></description>
            <content:encoded><![CDATA[ 
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3GpGyNbUwxO7rvWhWGw0St/0fbdcd80d0a93d7bbee4966b7f2a2f66/lava-lamps.jpg" />
            
            </figure><p>Lava lamps in the Cloudflare lobby. Courtesy of <a href="https://twitter.com/mahtin/status/888251632550424577">@mahtin</a></p>
    <div>
      <h2>Introduction</h2>
      <a href="#introduction">
        
      </a>
    </div>
    <p>As some of you may know, <a href="https://www.fastcodesign.com/90137157/the-hardest-working-office-design-in-america-encrypts-your-data-with-lava-lamps">there's a wall of lava lamps</a> in the lobby of our San Francisco office that we use for cryptography. In this post, we’re going to explore how that works in technical detail. This post assumes a technical background. For a higher-level discussion that requires no technical background, see <a href="/randomness-101-lavarand-in-production">Randomness 101: LavaRand in Production</a>.</p>
    <div>
      <h2>Background</h2>
      <a href="#background">
        
      </a>
    </div>
    <p>As we’ve <a href="/why-randomness-matters/">discussed in the past</a>, cryptography relies on the ability to generate random numbers that are both unpredictable and kept secret from any adversary. In this post, we’re going to go into fairly deep technical detail, so there is some background that we’ll need to ensure that everybody is on the same page.</p>
    <div>
      <h3>True Randomness vs Pseudorandomness</h3>
      <a href="#true-randomness-vs-pseudorandomness">
        
      </a>
    </div>
    <p>In cryptography, the term <i>random</i> means <i>unpredictable</i>. That is, a process for generating random bits is secure if an attacker is unable to predict the next bit with greater than 50% accuracy (in other words, no better than random chance).</p><p>We can obtain randomness that is unpredictable using one of two approaches. The first produces <i>true randomness</i>, while the second produces <i>pseudorandomness</i>.</p><p>True randomness is any information learned through the measurement of a physical process. Its unpredictability relies either on the inherent unpredictability of the physical process being measured (e.g., the unpredictability of radioactive decay), or on the inaccuracy inherent in taking precise physical measurements (e.g., the inaccuracy of the least significant digits of some physical measurement such as the measurement of a CPU’s temperature or the timing of keystrokes on a keyboard). Random values obtained in this manner are unpredictable even to the person measuring them (the person performing the measurement can’t predict what the value will be before they have performed the measurement), and thus are just as unpredictable to an external attacker. All randomness used in cryptographic algorithms begins life as true randomness obtained through physical measurements.</p><p>However, obtaining true random values is usually expensive and slow, so using them directly in cryptographic algorithms is impractical. Instead, we use pseudorandomness. Pseudorandomness is generated through the use of a deterministic algorithm that takes as input some other random value called a <i>seed</i> and produces a larger amount of random output (these algorithms are called <i>cryptographically secure pseudorandom number generators</i>, or CSPRNGs). A CSPRNG has two key properties: First, if an attacker is unable to predict the value of the seed, then that attacker will be similarly unable to predict the output of the CSPRNG (and even if the attacker is shown the output up to a certain point - say the first 10 bits - the rest of the output - bits 11, 12, etc - will still be completely unpredictable). Second, since the algorithm is deterministic, running the algorithm twice with the same seed as input will produce identical output.</p><p>The CSPRNGs used in modern cryptography are both very fast and also capable of securely producing an effectively infinite amount of output<sup>1</sup> given a relatively small seed (on the order of a few hundred bits). Thus, in order to efficiently generate a lot of secure randomness, true randomness is obtained from some physical process (this is slow), and fed into a CSPRNG which in turn produces as much randomness as is required by the application (this is fast). In this way, randomness can be obtained which is both secure (since it comes from a truly random source that cannot be predicted by an attacker) and cheap (since a CSPRNG is used to turn the truly random seed into a much larger stream of pseudorandom output).</p>
    <div>
      <h3>Running Out of Randomness</h3>
      <a href="#running-out-of-randomness">
        
      </a>
    </div>
    <p>A common misconception is that a CSPRNG, if used for long enough, can “run out” of randomness. This is an understandable belief since, as we’ll discuss in the next section, operating systems often re-seed their CSPRNGs with new randomness to hedge against attackers discovering internal state, broken CSPRNGs, and other maladies.</p><p>But if an algorithm is a true CSPRNG in the <a href="https://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator#Definitions">technical sense</a>, then the only way for it to run out of randomness is for somebody to consume far more values from it than could ever be consumed in practice (think consuming values from a CSPRNG as fast as possible for thousands of years or more).<sup>2</sup></p><p>However, none of the fast CSPRNGs that we use in practice are proven to be true CSPRNGs. They’re just <i>strongly believed</i> to be true CSPRNGs, or something close to it. They’ve withstood the test of academic analysis, years of being used in production, attacks by resourced adversaries, and so on. But that doesn’t mean that they are without flaws. For example, SHA-1, long considered to be a cryptographically-secure collision-resistant hash function (a building block that can be used to construct a CSPRNG) was eventually discovered to be insecure. Today, it can be broken for $110,000’s worth of cloud computing resources.<sup>3</sup></p><p>Thus, even though we aren’t concerned with running out of randomness in a true CSPRNG, we also aren’t sure that what we’re using in practice are true CSPRNGs. As a result, to hedge against the possibility that an attacker has figured out how to break our CSPRNGs, designers of cryptographic systems often choose to re-seed CSPRNGs with fresh, newly-acquired true randomness just in case.</p>
    <div>
      <h3>Randomness in the Operating System</h3>
      <a href="#randomness-in-the-operating-system">
        
      </a>
    </div>
    <p>In most computer systems, one of the responsibilities of the operating system is to provide cryptographically-secure pseudorandomness for use in various security applications. Since the operating system cannot know ahead of time which applications will require pseudorandomness (or how much they will require), most systems simply keep an _entropy pool_<sup>4</sup> - a collection of randomness that is believed to be secure - that is used to seed a CSPRNG (e.g., <code>/dev/urandom</code> on Linux) which serves requests for randomness. The system then takes on the responsibility of not only seeding this entropy pool when the system first boots, but also of periodically updating the pool (and re-seeding the CSPRNG) with new randomness from whatever sources of true randomness are available to the system in order to hedge against broken CSPRNGs or attackers having compromised the entropy pool through other non-cryptographic attacks.</p><p>For brevity, and since Cloudflare’s production system’s run Linux, we will refer to the system’s pseudorandomness provider simply as <code>/dev/urandom</code>, although note that everything in this discussion is true of other operating systems as well.</p><p>Given this setup of an entropy pool and CSPRNG, there are a few situations that could compromise the security of <code>/dev/urandom</code>:</p><ul><li><p>The sources of true randomness used to seed theentropy pool could be too predictable, allowing an attacker to guess the values obtained from these sources, and thus to predict the output of <code>/dev/urandom</code>.</p></li><li><p>An attacker could have access to the sources of true randomness, thus being able to observe their values and thus predict the output of <code>/dev/urandom</code>.</p></li><li><p>An attacker could have the ability to modify the sources of true randomness, thus being able to influence the values obtained from these sources and thus predict the output of <code>/dev/urandom</code>.</p></li></ul>
    <div>
      <h3>Randomness Mixing</h3>
      <a href="#randomness-mixing">
        
      </a>
    </div>
    <p>A common approach to addressing these security issues is to mix multiple sources of randomness together in the system’s entropy pool, the idea being that so long as some of the sources remain uncompromised, the system remains secure. For example, if sources <i>X</i>, <i>Y</i>, and <i>Z</i>, when queried for random outputs, provide values <i>x</i>, <i>y</i>, and <i>z</i>, we might seed our entropy pool with <i>H(x, y, z)</i>, where <i>H</i> is a cryptographically-secure collision-resistant hash function. Even if we assume that two of these sources - say, <i>X</i> and <i>Y</i> - are malicious, so long as the attackers in control of them are not able to observe <i>Z</i>’s output,<sup>5</sup> then no matter what values of <i>x</i> and <i>y</i> they produce, <i>H(x, y, z)</i> will still be unpredictable to them.</p>
    <div>
      <h2>LavaRand</h2>
      <a href="#lavarand">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1thY8qByl6CmiTCI9tIgOG/5de49269d8aeae96359870cad09d3a16/lava-lamps-camera.jpg" />
            
            </figure><p>The view from the camera</p><p>While the probability is obviously very low that somebody will manage to predict or modify the output of the entropy sources on our production machines, it would be irresponsible of us to pretend that it is impossible. Similarly, while cryptographic attacks against state-of-the-art CSPRNGs are rare, they do occasionally happen. It’s important that we hedge against these possibilities by adding <a href="https://en.wikipedia.org/wiki/Defense_in_depth_(computing)">extra layers of defense</a>.</p><p>That’s where LavaRand comes in.</p><p>In short, LavaRand is a system that provides an additional entropy source to our production machines. In the lobby of our San Francisco office, we have a wall of lava lamps (pictured above). A video feed of this wall is used to generate entropy that is made available to our production fleet.</p><p>We're not the first ones to do this. Our LavaRand system was inspired by a similar system first <a href="https://en.wikipedia.org/wiki/Lavarand">proposed and built</a> by Silicon Graphics and <a href="https://www.google.com/patents/US5732138">patented</a> in 1996 (the patent has since expired).</p><p>The flow of the “lava” in a lava lamp is very unpredictable,6 and so the entropy in those lamps is incredibly high. Even if we conservatively assume that the camera has a resolution of 100x100 pixels (of course it’s actually much higher) and that an attacker can guess the value of any pixel of that image to within one bit of precision (e.g., they know that a particular pixel has a red value of either 123 or 124, but they aren’t sure which it is), then the total amount of entropy produced by the image is 100x100x3 = 30,000 bits (the x3 is because each pixel comprises three values - a red, a green, and a blue channel). This is orders of magnitude more entropy than we need.</p>
    <div>
      <h3>Design</h3>
      <a href="#design">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/HQnazwt1tj0ywVtjZ0HTX/4cbe7db55b4792b1b86dcea4a57b5474/Screen-Shot-2017-10-31-at-3.57.19-PM.png" />
            
            </figure><p>The flow of entropy in LavaRand</p><p>The overall design of the LavaRand system is pictured above. The flow of entropy can be broken down into the following steps:</p><p>The wall of lava lamps in the office lobby provides a source of true entropy.</p><p>In the lobby, a camera is pointed at the wall. It obtains entropy from both the visual input from the lava lamps and also from random noise in the individual photoreceptors.</p><p>In the office, there’s a server which connects to the camera. The server has its own entropy system, and the output of that entropy system is mixed with the entropy from the camera to produce a new entropy feed.</p><p>In one of our production data centers, there’s a service which connects to the server in the office and consumes its entropy feed. That service combines this entropy feed with output from its own local entropy system to produce yet another entropy feed. This feed is made available for any production service to consume.</p>
    <div>
      <h3>Security of the LavaRand Service</h3>
      <a href="#security-of-the-lavarand-service">
        
      </a>
    </div>
    <p>We might conceive of a number of attacks that could be leveraged against this system:</p><ul><li><p>An attacker could train a camera on the wall of lava lamps, attempting to reproduce the image captured by our camera.</p></li><li><p>An attacker could reduce the entropy from the wall of lava lamps by turning off the power to the lamps, shining a bright light at the camera, placing a lens cap on the camera, or any number of other physical attacks.</p></li><li><p>An attacker able to compromise the camera could exfiltrate or modify the feed of frames from the camera, replicating or controlling the entropy source used by the server in the office.</p></li><li><p>An attacker with code running on the office server could observe or modify the output of the entropy feed generated by that server.</p></li><li><p>An attacker with code running in the production service could observe or modify the output of the entropy feed generated by that service.</p></li></ul><p>Only one of these attacks would be fatal if successfully carried out: running code on the production service which produces the final entropy feed. In every other case, the malicious entropy feed controlled by the attacker is mixed with a non-malicious feed that the attacker can neither observe nor modify.<sup>7</sup> As we discussed in a previous section, as long as the attacker is unable to predict the output of these non-malicious feeds, they will be unable to predict the output of the entropy feed generated by mixing their malicious feed with the non-malicious feed.</p>
    <div>
      <h3>Using LavaRand</h3>
      <a href="#using-lavarand">
        
      </a>
    </div>
    <p>Having a secure entropy source is only half of the story - the other half is actually using it!</p><p>The goal of LavaRand is to ensure that our production machines have access to secure randomness <i>even if their local entropy sources are compromised</i>. Just after boot, each of our production machines contacts LavaRand over TLS to obtain a fixed-size chunk of fresh entropy called a “beacon.” It mixes this beacon into the entropy system (on Linux, by writing the beacon to <code>/dev/random</code>). After this point, in order to predict or control the output of <code>/dev/urandom</code>, an attacker would need to compromise both the machine’s local entropy sources <i>and</i> the LavaRand beacon.</p>
    <div>
      <h3>Bootstrapping TLS</h3>
      <a href="#bootstrapping-tls">
        
      </a>
    </div>
    <p>Unfortunately, the reality isn’t quite that simple. We’ve gotten ourselves into something of a chicken-and-egg problem here: we’re trying to hedge against bad entropy from our local entropy sources, so we have to assume those might be compromised. But TLS, like many cryptographic protocols, requires secure entropy in order to operate. And we require TLS to request a LavaRand beacon. So in order to ensure secure entropy, we have to have secure entropy…</p><p>We solve this problem by introducing a second special-purpose CSPRNG, and seeding it in a very particular way. Every machine in Cloudflare’s production fleet has its own permanent store of secrets that it uses just after boot to prove its identity to the rest of the fleet in order to bootstrap the rest of the boot process. We piggyback on that system by storing an extra random seed - unique for each machine - that we use for that first TLS connection to LavaRand.</p><p>There’s a simple but very useful result from cryptography theory that says that an HMAC - a hash-based message authentication code - when combined with a random, unpredictable seed, behaves (from the perspective of an attacker) like a random oracle. That’s a lot of crypto jargon, but it basically means that if you have a secret, randomly-generated seed, <i>s</i>, then an attacker will be completely unable to guess the output of <i>HMAC(s, x)</i> <i>regardless of the value of x</i> - even if <i>x</i> is completely predictable! Thus, you can use <i>HMAC(s, x)</i> as the seed to a CSPRNG, and the output of the CSPRNG will be unpredictable. Note, though, that if you need to do this multiple times, you will have to pick different values for <i>x</i>! Remember that while CSPRNGs are secure if used with unpredictable seeds, they’re also deterministic. Thus, if the same value is used for <i>x</i> more than once, then the CSPRNG will end up producing the same stream of “random” values more than once, which in cryptography is often very insecure!</p><p>This means that we can combine those unique, secret seeds that we store on each machine with an HMAC and produce a secure random value. We use the current time with nanosecond precision as the input to ensure that the same value is never used twice on the same machine. We use the resulting value to seed a CSPRNG, and we use that CSPRNG for the TLS connection to LavaRand. That way, even if the system’s entropy sources are compromised, we’ll still be able to make a secure connection to LavaRand, obtain a new, secure beacon, and bootstrap the system’s entropy back to a secure state!</p>
    <div>
      <h2>Conclusion</h2>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>Hopefully we’ll never need LavaRand. Hopefully, the primary entropy sources used by our production machines will remain secure, and LavaRand will serve little purpose beyond adding some flair to our office. But if it turns out that we’re wrong, and that our randomness sources in production are actually flawed, then hopefully LavaRand will be our hedge, making it just a little bit harder to hack Cloudflare.</p><hr /><p><sup>1</sup> Some CSPRNGs exist with constraints on how much output can be consumed securely, but those are not the sort that we are concerned with in this post.</p><p><sup>2</sup> Section 3.1, <a href="https://www.usenix.org/system/files/conference/hotos15/hotos15-paper-corrigan-gibbs.pdf">Recommendations for Randomness in the Operating System</a></p><p><sup>3</sup> <a href="https://shattered.io/static/shattered.pdf">The first collision for full SHA-1</a></p><p><sup>4</sup> “Entropy” and “randomness” are synonyms in cryptography - the former is the more technical term.</p><p><sup>5</sup> If the attacker controls <i>X</i> and <i>Y</i> and can also observe the output of <i>Z</i>, then the attacker can still partially influence the output of <i>H(x, y, z)</i>. See <a href="http://blog.cr.yp.to/20140205-entropy.html">here</a> for a discussion of possible attacks.</p><p><sup>6</sup> Noll, L.C. and Mende, R.G. and Sisodiya, S., <a href="https://www.google.com/patents/US5732138"><i>Method for seeding a pseudo-random number generator with a cryptographic hash of a digitization of a chaotic system</i></a></p><p><sup>7</sup> A surprising example of the effectiveness of entropy is the mixing of the image captured by the camera with the random noise in the camera’s photoreceptors. If we assume that every pixel captured is either recorded as the “true” value or is instead recorded as one value higher than the true value (50% probability for each), then even if the input image can be reproduced by an attacker with perfect accuracy, the camera <i>still</i> provides one bit of entropy for each pixel channel. As discussed before, even for a 100x100 pixel camera, that’s 30,000 bits!</p> ]]></content:encoded>
            <category><![CDATA[LavaRand]]></category>
            <category><![CDATA[Entropy]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Cryptography]]></category>
            <guid isPermaLink="false">6i8GxcLswvLnL74LrqK2Ef</guid>
            <dc:creator>Joshua Liebow-Feeser</dc:creator>
        </item>
        <item>
            <title><![CDATA[Randomness 101: LavaRand in Production]]></title>
            <link>https://blog.cloudflare.com/randomness-101-lavarand-in-production/</link>
            <pubDate>Mon, 06 Nov 2017 05:54:46 GMT</pubDate>
            <description><![CDATA[ As some of you may know, there's a wall of lava lamps in the lobby of our San Francisco office that we use for cryptography. In this post, we’re going to explore how that works.  ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Lava lamps in the Cloudflare lobby Courtesy of <a href="https://twitter.com/mahtin/status/888251632550424577">@mahtin</a></p>
    <div>
      <h3>Introduction</h3>
      <a href="#introduction">
        
      </a>
    </div>
    <p>As some of you may know, <a href="https://www.fastcodesign.com/90137157/the-hardest-working-office-design-in-america-encrypts-your-data-with-lava-lamps">there's a wall of lava lamps</a> in the lobby of our San Francisco office that we use for cryptography. In this post, we’re going to explore how that works. This post assumes no technical background. For a more in-depth look at the technical details, see <a href="/lavarand-in-production-the-nitty-gritty-technical-details">LavaRand in Production: The Nitty-Gritty Technical Details</a>.</p>
    <div>
      <h3>Background</h3>
      <a href="#background">
        
      </a>
    </div>
    
    <div>
      <h4>Randomness in Cryptography</h4>
      <a href="#randomness-in-cryptography">
        
      </a>
    </div>
    <p>As we’ve <a href="/why-randomness-matters/">discussed in the past</a>, cryptography relies on the ability to generate random numbers that are both unpredictable and kept secret from any adversary.</p><p>But “random” is a pretty tricky term; it’s used in many different fields to mean slightly different things. And like all of those fields, its use in cryptography is very precise. In some fields, a process is random simply if it has the right statistical properties. For example, the digits of pi are said to be random because all sequences of numbers appear with equal frequency (“15” appears as frequently as “38”, “426” appears as frequently as “297”, etc). But for cryptography, this isn’t enough - random numbers must be <i>unpredictable</i>.</p><p>To understand what <i>unpredictable</i> means, it helps to consider that all cryptography is based on an asymmetry of information. If you’re trying to securely perform some cryptographic operation, then what you’re concerned about is that somebody - an <i>adversary</i> - will try to break your security. The only thing that distinguishes you from the adversary is that you know some things that the adversary does not, and the job of cryptography is to ensure that this asymmetry of information is enough to keep you secure.</p><p>Let’s consider a simple example. Imagine that you and a friend are trying to go to a movie, but you don’t want your nemesis to figure out which movie you’re going to go to (lest she show up and thwart your movie watching!). This week, it’s your turn to choose the movie. Once you’ve made your choice, you’re going to need to send a message to your friend telling him which movie you’ve chosen, but you’re going to need to ensure that even if your nemesis intercepts the message, she won’t be able to figure out what it says.</p><p>You devise the following scheme: since there are only two movies available to watch at the moment, you label one A and the other B. Then, while in the presence of your friend, you flip a coin. You agree on the following table outlining which message that you will send depending on your choice of what movie to watch and whether the coin comes up heads (H) or tails (T). Later, once you’ve made up your mind about which movie to see, you’ll use this table to send an encrypted message to your friend telling him which movie you’ve chosen.</p><table><tr><td><p><b>Movie</b></p></td><td><p><b>Coin</b></p></td><td><p><b>Message</b></p></td></tr><tr><td><p>A</p></td><td><p>H</p></td><td><p>“The rain in Spain stays mainly on the plain.”</p></td></tr><tr><td><p>A</p></td><td><p>T</p></td><td><p>“In Hertford, Hereford, and Hampshire, hurricanes hardly ever happen.”</p></td></tr><tr><td><p>B</p></td><td><p>H</p></td><td><p>“In Hertford, Hereford, and Hampshire, hurricanes hardly ever happen.”</p></td></tr><tr><td><p>B</p></td><td><p>T</p></td><td><p>“The rain in Spain stays mainly on the plain.”</p></td></tr></table><p>If you were to decide on movie B, and the coin came up heads, you would send the message, “In Hertford, Hereford, and Hampshire, hurricanes hardly ever happen.” Since your friend knows that the coin came up heads - he was there when it happened - he knows that you must have decided on movie B. But consider it from your nemesis’ perspective. She doesn’t know the result of the coin toss - all she knows is that there’s a 50% chance that the coin came up heads, and a 50% chance that it came up tails. Thus, seeing the message “In Hertford, Hereford, and Hampshire, hurricanes hardly ever happen” doesn’t help her at all! There’s a 50% chance that the coin came up heads (implying movie B), and a 50% chance that it came up tails (implying movie A). She doesn’t know anything more than she knew before!</p><p>Let’s return now to the concept of <i>unpredictability</i>. Imagine that the result of the coin toss was completely predictable - say your nemesis planted a trick coin that always comes up heads on the first toss, tails on the second, heads on the third, and so on. Since she would know that there was a 100% chance of the first coin toss coming up heads, then regardless of which message you sent, she would know which movie you were going to see. While the trick coin still exhibits some basic properties of “randomness” as the term is used in the field of statistics - it comes up heads as often as it comes up tails - it’s <i>predictable</i>, which makes it useless for cryptography. The takeaway: when we say <i>random</i> in the context of cryptography, we mean <i>unpredictable</i>.</p>
    <div>
      <h3>Randomness in Computing</h3>
      <a href="#randomness-in-computing">
        
      </a>
    </div>
    <p>Unfortunately for cryptographers, if there’s one thing computers are good at, it’s being predictable. They can execute the same code a million times, and so long as they are given the same inputs each time, they’ll always come up with the same outputs. This is very good for reliability, but it’s tricky when it comes to cryptography - after all, we <i>need</i> unpredictability!</p><p>The solution to this problem is <i>cryptographically-secure pseudorandom number generators</i> (CSPRNGs). CSPRNGs are algorithms which, provided an input which is itself unpredictable, produce a much larger stream of output which is also unpredictable. This stream can be extended indefinitely, producing as much output as required at any time in the future. In other words, if you were to flip a coin a number of times (a process which is known to be unpredictable) and then use the output of those coin flips as the input to a CSPRNG, an adversary who wasn’t able to predict the output of those coin flips would also be unable to predict the output of the CSPRNG - no matter how much output was consumed from the CSPRNG.</p><p>But even though CSPRNGs are a very powerful tool, they’re only one half of the equation - they still need an unpredictable input to operate. But as we said, computers aren’t unpredictable, so aren’t we back at square one? Well, not quite. It turns out that computers do usually have sources of unpredictability that they can use, but they’re pretty slow. What we can do is combine that slow process of gathering unpredictable input with a CSPRNG, which can take that input and produce a much larger amount of input more quickly, and we can satisfy all of our randomness needs!</p><p>But where can a computer get such unpredictable input, even slowly? The answer is <i>the real world</i>. While computers provide a nice simplification of the world for programmers to live in, real, physical computers still exist in the real, physical world. And that world is unpredictable. Computers have all sorts of ways of taking input from the real world - temperature sensors, keyboards, network interfaces, etc. All of these provide the ability to take measurements of the real world, and all of those measurements have some degree of inherent inaccuracy. As we’ll explain in a moment, that inaccuracy is the same thing as unpredictability, and this can be used! Common sources of unpredictable randomness include measuring the temperature of the CPU with high - and thus inaccurate - precision, measuring the timing of keystrokes on the keyboard with high precision, etc. To see how this can be used to produce unpredictable randomness, consider the question, “what’s the temperature of the room I’m sitting in right now?” You can probably estimate to within a couple of degrees - say, somewhere between 70 and 75 degrees Fahrenheit. But you probably have no idea what the temperature is to 2 decimal places of accuracy - is it 73.42 degrees or 73.47 degrees? By measuring the temperature with high precision and then using only the low-order digits of the measured value, you can get highly unpredictable randomness just by observing the world around you. And so can computers.</p><p>So, to recap:</p><ul><li><p>Randomness used in cryptography needs to be unpredictable.</p></li><li><p>Computers can slowly get a small amount of unpredictable randomness by measuring their environment.</p></li><li><p>Computers can greatly extend this randomness by using a CSPRNG which can quickly turn it into a large amount of unpredictable randomness.</p></li></ul>
    <div>
      <h3>Hedging Your Bets</h3>
      <a href="#hedging-your-bets">
        
      </a>
    </div>
    <p>If there’s one thing cryptographers are wary about, it’s certainty. Cryptographic systems are routinely shown to be less secure than they were originally thought to be, and we’re constantly updating our understanding of what algorithms are safe to use in what scenarios.</p><p>So it shouldn’t be any surprise that cryptographers like to hedge their bets by using more security than they believe necessary in case it turns out that one of their assumptions was wrong. It’s sort of like the cryptographer’s version of the engineering practice of designing buildings to withstand far more weight or wind or heat than they think will arise in practice.</p><p>When it comes to randomness, this hedging often takes the form of <i>mixing</i>. Unpredictable random values have the neat property that if they’re mixed in the right way with more unpredictable random values, then the result is at least as unpredictable as either of the inputs. That means that if you mix a random value which is highly unpredictability with a random value which is somewhat predictable, the result will be a highly unpredictable value.</p><p>This mixing property is useful because it allows you to mix unpredictable random values from many sources, and if you later discover that one of those sources was less unpredictable than you’d originally thought, it’s still OK - the other sources come to the rescue.</p>
    <div>
      <h3>LavaRand</h3>
      <a href="#lavarand">
        
      </a>
    </div>
    <p>At Cloudflare, we have thousands of computers in data centers all around the world, and each one of these computers needs cryptographic randomness. Historically, they got that randomness using the default mechanism made available by the operating system that we run on them, Linux.</p><p>But being good cryptographers, we’re always trying to hedge our bets. We wanted a system to ensure that even if the default mechanism for acquiring randomness was flawed, we’d still be secure. That’s how we came up with LavaRand.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/Vz4N3zljIz1BLk9Zj8EFH/df36b17492525695fceb79198df56823/lava-lamps-camera.jpg" />
            
            </figure><p>The view from the camera</p><p>LavaRand is a system that uses lava lamps as a secondary source of randomness for our production servers. A wall of lava lamps in the lobby of our San Francisco office provides an unpredictable input to a camera aimed at the wall. A video feed from the camera is fed into a CSPRNG, and that CSPRNG provides a stream of random values that can be used as an extra source of randomness by our production servers. Since the flow of the “lava” in a lava lamp is very unpredictable,<sup>1</sup> “measuring” the lamps by taking footage of them is a good way to obtain unpredictable randomness. Computers store images as very large numbers, so we can use them as the input to a CSPRNG just like any other number.</p><p>We're not the first ones to do this. Our LavaRand system was inspired by a similar system first <a href="https://en.wikipedia.org/wiki/Lavarand">proposed and built</a> by Silicon Graphics and <a href="https://www.google.com/patents/US5732138">patented</a> in 1996 (the patent has since expired).</p><p>Hopefully we’ll never need it. Hopefully, the primary sources of randomness used by our production servers will remain secure, and LavaRand will serve little purpose beyond adding some flair to our office. But if it turns out that we’re wrong, and that our randomness sources in production are actually flawed, then LavaRand will be our hedge, making it just a little bit harder to hack Cloudflare.</p><ol><li><p>Noll, L.C. and Mende, R.G. and Sisodiya, S., <a href="https://www.google.com/patents/US5732138"><i>Method for seeding a pseudo-random number generator with a cryptographic hash of a digitization of a chaotic system</i></a></p></li></ol><p></p> ]]></content:encoded>
            <category><![CDATA[LavaRand]]></category>
            <category><![CDATA[Entropy]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Cryptography]]></category>
            <guid isPermaLink="false">cMgBPjWlpt6XfFcsYQhhc</guid>
            <dc:creator>Joshua Liebow-Feeser</dc:creator>
        </item>
    </channel>
</rss>