
<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>Mon, 13 Apr 2026 18:30:16 GMT</lastBuildDate>
        <item>
            <title><![CDATA[Training a million models per day to save customers of all sizes from DDoS attacks]]></title>
            <link>https://blog.cloudflare.com/training-a-million-models-per-day-to-save-customers-of-all-sizes-from-ddos/</link>
            <pubDate>Wed, 23 Oct 2024 13:00:00 GMT</pubDate>
            <description><![CDATA[ In this post we will describe how we use anomaly detection to watch for novel DDoS attacks. We’ll provide an overview of how we build models which flag unusual traffic and keep our customers safe. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Our always-on DDoS protection runs inside every server across our global network.  It constantly analyzes incoming traffic, looking for signals associated with previously identified DDoS attacks. We dynamically create <a href="https://developers.cloudflare.com/ddos-protection/about/how-ddos-protection-works/"><u>fingerprints</u></a> to flag malicious traffic, which is dropped when detected in high enough volume — so it never reaches its destination — keeping customer websites online.</p><p>In many cases, flagging bad traffic can be straightforward. For example, if we see too many requests to a destination with the same protocol violation, we can be fairly sure this is an automated script, rather than a surge of requests from a legitimate web browser.</p><p>Our DDoS systems are great at detecting attacks, but there’s a minor catch. Much like the human immune system, they are great at spotting attacks similar to things they have seen before. But for new and novel threats, they need a little help knowing what to look for, which is an expensive and time-consuming human endeavor.</p><p>Cloudflare protects millions of Internet properties, and we serve over 60 million HTTP requests per second on average, so trying to find unmitigated attacks in such a huge volume of traffic is a daunting task. In order to protect the smallest of companies, we need a way to find unmitigated attacks that may only be a few thousand requests per second, as even these can be enough to take smaller sites offline.</p><p>To better protect our customers, we also have a system to automatically identify unmitigated, or partially mitigated DDoS attacks, so we can better shore up our defenses against emerging threats. In this post we will introduce this anomaly detection pipeline, we’ll provide an overview of how it builds statistical models which flag unusual traffic and keep our customers safe. Let’s jump in!</p>
    <div>
      <h2>A naive volumetric model</h2>
      <a href="#a-naive-volumetric-model">
        
      </a>
    </div>
    <p>A DDoS attack, by definition, is characterized by a higher than normal volume of traffic destined for a particular destination. We can use this fact to loosely sketch out a potential approach. Let’s look at an example website, and look at the request volume over the course of a day, broken down into 1 minute intervals.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6j97IMawigCOtQEIKLzQ4n/8ab1e487a5dc8faaecc732b8fbb7d8d4/image3.png" />
          </figure><p>We can plot this same data as a histogram:</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1Ys3wf2GY6e5K4rEBUTDBN/5cff86a1f90ee5e0eae9ec394f2322b3/image6.png" />
          </figure><p>The data follows a bell-shaped curve, also known as a normal distribution. We can use this fact to flag observations which appear outside the usual range. By first calculating the mean and standard deviation of our dataset, we can then use these values to rate new observations by calculating how many standard deviations (or sigma) the data is from the mean.</p><p>This value is also called the z-score — a z-score of 3 is the same as 3-sigma, which corresponds to 3 standard deviations from the mean. A data point with a high enough z-score is sufficiently unusual that it might signal an attack. Since the mean and standard deviation are stationary, we can calculate a request volume threshold for each z-score value, and use traffic volumes above these thresholds to signal an ongoing attack.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4X5WaA5QssNRlWWaz4UUYL/05b88c9cfe52f6ba05cef7cab033d53d/image1.png" />
          </figure><p><sup><i>Trigger thresholds for z-score of 3, 4 and 5</i></sup></p><p>Unfortunately, it’s incredibly rare to see traffic that is this uniform in practice, as user load will naturally vary over a day. Here I’ve simulated some traffic for a website which runs a meal delivery service, and as you might expect it has big peaks around meal times, and low traffic overnight since it only operates in a single country.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6Pk6sFmz8lqjUJrdTev8Xw/194436196eddbbb11576b74f1515d6c6/image2.png" />
          </figure><p>Our volume data no longer follows a normal distribution and our 3-sigma threshold is now much further away, so smaller attacks could pass undetected.</p><p>Many websites elastically scale their underlying hardware based upon anticipated load to save on costs. In the example above the website operator would run far fewer servers overnight, when the anticipated load is low, to save on running costs. This makes the website more vulnerable to attacks during off-peak hours as there would be less hardware to absorb them. An attack as low as a few hundred requests per minute may be enough to overwhelm the site early in the morning, even though the peak-time infrastructure could easily absorb this volume.</p><p>This approach relies on traffic volume being stable over time, meaning it’s roughly flat throughout the day, but this is rarely true in practice. Even when it is true, benign increases in traffic are common, such as an e-commerce site running a Black Friday sale. In this situation, a website would expect a surge in traffic that our model wouldn’t anticipate, and we may incorrectly flag real shoppers as attackers.</p><p>It turns out this approach makes too many naive assumptions about what traffic should look like, so it’s impossible to choose an appropriate sigma threshold which works well for all customers.</p>
    <div>
      <h2>Time series forecasting</h2>
      <a href="#time-series-forecasting">
        
      </a>
    </div>
    <p>Let’s continue with trying to determine a volumetric baseline for our meal delivery example. A reasonable assumption we could add is that yesterday’s traffic shape should approximate the expected shape of traffic today. This idea is called “seasonality”. Weekly seasonality is also pretty common, i.e. websites see more or less traffic on certain weekdays or on weekends.</p><p>There are many methods designed to analyze a dataset, unpick the varying horizons of seasonality within it, and then build an appropriate predictive model. We won’t go into them here but reading about <a href="https://en.wikipedia.org/wiki/Autoregressive_integrated_moving_average"><u>Seasonal ARIMA (SARIMA)</u></a> is a good place to start if you are looking for further information.</p><p>There are three main challenges that make SARIMA methods unsuitable for our purposes. First is that in order to get a good idea of seasonality, you need a lot of data. To predict weekly seasonality, you need at least a few weeks worth of data. We’d require a massive dataset to predict monthly, or even annual, patterns (such as Black Friday). This means new customers wouldn’t be protected until they’d been with us for multiple years, so this isn’t a particularly practical approach.</p><p>The second issue is the cost of training models. In order to maintain good accuracy, time series models need to be frequently retrained. The exact frequency varies between methods, but in the worst cases, a model is only good for 2–3 inferences, meaning we’d need to retrain all our models every 10–20 minutes. This is feasible, but it’s incredibly wasteful.</p><p>The third hurdle is the hardest to work around, and is the reason why a purely volumetric model doesn’t work. Most websites experience completely benign spikes in traffic that lie outside prior norms. Flash sales are one such example, or 1,000,000 visitors driven to a site from Reddit, or a Super Bowl commercial.</p>
    <div>
      <h2>A better way?</h2>
      <a href="#a-better-way">
        
      </a>
    </div>
    <p>So if volumetric modeling won’t work, what can we do instead? Fortunately, volume isn’t the only axis we can use to measure traffic. Consider the end users’ browsers for example. It would be reasonable to assume that over a given time interval, the proportion of users across the top 5 browsers would remain reasonably stationary, or at least within a predictable range. More importantly, this proportion is unlikely to change too much during benign traffic surges.</p><p>Through careful analysis we were able to discover about a dozen such variables with the following features for a given zone: </p><ul><li><p>They follow a normal distribution</p></li><li><p>They aren’t correlated, or are only loosely correlated with volume</p></li><li><p>They deviate from the underlying normal distribution during “under attack” events</p></li></ul><p>Recall our initial volume model, where we used z-score to define a cutoff. We can expand this same idea to multiple dimensions. We have a dozen different time series (each feature is a single time series), which we can imagine as a cloud of points in 12 dimensions. Here is a sample showing 3 such features, with each point representing the traffic readings at a different point in time. Note that both graphs show the same cloud of points from two different angles.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5idkNYYgL0IhY8d2HapYud/f3696ec7fb91f8641a04ba261d0cf673/image4.png" />
          </figure><p>To use our z-score analogy from before, we’d want our points to be spherical, since our multidimensional- z-score is then just the distance from the centre of the cloud. We could then use this distance to define a cutoff threshold for attacks.</p><p>For several reasons, a perfect sphere is unlikely in practice. Our various features measure different things, so they have very different scales of ‘normal’. One property might vary between 100-300 whereas another property might usually occupy the interval 0-1. A change of 3 in this latter property would be a significant anomaly, whereas in the first this would just be within the normal range.</p><p>More subtly, two or more axes may be correlated, so an increase in one is usually mirrored with a proportional increase/decrease in another dimension. This turns our sphere into an off-axis disc shape, as pictured above.</p><p>Fortunately, we have a couple of mathematical tricks up our sleeve. The first is scale normalization. In each of our n dimensions, we subtract the mean, and divide by the standard deviation. This makes all our dimensions the same size and centres them around zero. This gives a multidimensional analogue of z-score, but it won’t fix the disc shape.</p><p>What we can do is figure out the orientation and dimensions of the disc, and for this we use a tool called <a href="https://en.wikipedia.org/wiki/Principal_component_analysis"><u>Principal Component Analysis (PCA)</u></a>. This lets us reorient our disc, and rescale the axes according to their size, to make them all the same.</p><p>Imagine grabbing the disc out of the air, then drawing new X and Y axes on the top surface, with the origin at the center of the disc. Our new Z-axis is the thickness of the disc. We can compare the thickness to the diameter of the disc, to give us a scaling factor for the Z direction. Imagine stretching the disc along the z-axis until it’s as tall as the length across the diameter.</p><p>In reality there’s nothing to say that X &amp; Y have to be the same size either, but hopefully you get the general idea. PCA lets us draw new axes along these lines of correlation in an arbitrary number of dimensions, and convert our n-dimensional disc into a nicely behaved sphere of points (technically an n-dimensional sphere).</p><p>Having done all this work, we can uniquely define a coordinate transformation which takes any measurement from our raw features, and tells us where it should lie in the sphere, and since all our dimensions are the same size we can generate an anomaly score purely based on its distance from the centre of the cloud.</p><p>As a final trick, we can also use a final scaling operation to ensure the sphere for dataset A is the same size as the sphere generated from dataset B, meaning we can do this same process for any traffic data and define a cutoff distance λ which is the same across all our models. Rather than fine-tuning models for each individual customer zone, we can tune this to a value which applies globally.</p><p>Another name for this measurement is <a href="https://en.wikipedia.org/wiki/Mahalanobis_distance"><u>Mahalanobis distance</u></a>. (Inclined readers can understand this equivalence by considering the role of the covariance matrix in PCA and Mahalanobis distance. Further discussion can be found on <a href="https://stats.stackexchange.com/questions/166525/is-mahalanobis-distance-equivalent-to-the-euclidean-one-on-the-pca-rotated-data"><u>this</u></a> StackExchange post.) We further tune the process to discard dimensions with little variance — if our disc is too thin we discard the thickness dimension.  In practice, such dimensions were too sensitive to be useful.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1OcPc7zoehsizwzPEkD1Fc/094bd59ca6d6aba3c301fd74f12d580a/image5.png" />
          </figure><p>We’re left with a multidimensional analogue of the z-score we started with, but this time our variables aren’t correlated with peacetime traffic volume. Above we show 2 output dimensions, with coloured circles which show Mahalanobis distances of 4, 5 and 6. Anything outside the green circle will be classified as an attack.</p>
    <div>
      <h2>How we train ~1 million models daily to keep customers safe</h2>
      <a href="#how-we-train-1-million-models-daily-to-keep-customers-safe">
        
      </a>
    </div>
    <p>The approach we’ve outlined is incredibly parallelizable: a single model requires only the traffic data for that one website, and the datasets needed can be quite small. We use 4 weeks of training data chunked into 5 minute intervals which is only ~8k rows/website.</p><p>We run all our training and inference in an Apache Airflow deployment in Kubernetes. Due to the parallelizability, we can scale horizontally as needed. On average, we can train about 3 models/second/thread. We currently retrain models every day, but we’ve observed very little intraday model drift (i.e. yesterday’s model is the same as today’s), so training frequency may be reduced in the future.</p><p>We don’t consider it necessary to build models for all our customers, instead we train models for a large sample of representative customers, including a large number on the Free plan. The goal is to identify attacks for further study which we then use to tune our existing DDoS systems for all customers.</p>
    <div>
      <h2>Join us!</h2>
      <a href="#join-us">
        
      </a>
    </div>
    <p>If you’ve read this far you may have questions, like “how do you filter attacks from your training data?” or you may have spotted a handful of other technical details which I’ve elided to keep this post accessible to a general audience. If so, you would fit in well here at Cloudflare. We’re helping to build a better Internet, and we’re <a href="https://www.cloudflare.com/careers/jobs/?title=data+scientist"><u>hiring</u></a>.</p> ]]></content:encoded>
            <category><![CDATA[DDoS]]></category>
            <category><![CDATA[Deep Dive]]></category>
            <category><![CDATA[Machine Learning]]></category>
            <guid isPermaLink="false">4awe2vvz8flXFLuz3BGm7j</guid>
            <dc:creator>Nick Wood</dc:creator>
            <dc:creator>Manish Arora</dc:creator>
        </item>
        <item>
            <title><![CDATA[How Cloudflare auto-mitigated world record 3.8 Tbps DDoS attack]]></title>
            <link>https://blog.cloudflare.com/how-cloudflare-auto-mitigated-world-record-3-8-tbps-ddos-attack/</link>
            <pubDate>Wed, 02 Oct 2024 13:00:00 GMT</pubDate>
            <description><![CDATA[ Over the past couple of weeks, Cloudflare's DDoS protection systems have automatically and successfully mitigated multiple hyper-volumetric L3/4 DDoS attacks exceeding 3 billion packets per second (Bpps). Our systems also automatically mitigated multiple attacks exceeding 3 terabits per second (Tbps), with the largest ones exceeding 3.65 Tbps. The scale of these attacks is unprecedented. ]]></description>
            <content:encoded><![CDATA[ <p>Since early September, <a href="https://developers.cloudflare.com/ddos-protection/about/components/#autonomous-edge"><u>Cloudflare's DDoS protection systems</u></a> have been combating a month-long campaign of hyper-volumetric L3/4 DDoS attacks. Cloudflare’s defenses mitigated over one hundred hyper-volumetric L3/4 DDoS attacks throughout the month, with many exceeding 2 billion packets per second (Bpps) and 3 terabits per second (Tbps). The largest attack peaked 3.8 Tbps — the largest ever disclosed publicly by any organization. Detection and mitigation was fully autonomous. The graphs below represent two separate attack events that targeted the same Cloudflare customer and were mitigated autonomously.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7hXUgmEd37kzZrMs0KPXLl/21a4779022bdff91f760dc66759eb955/BLOG-2586_2.png" />
          </figure><p><sup><i>A mitigated 3.8 Terabits per second DDoS attack that lasted 65 seconds</i></sup></p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1uxvtlkdFoH6KU6waXxK3o/d17fe7cf0e33c20e64a47b3ca0e6ca63/BLOG-2586_3.png" />
          </figure><p><sup><i>A mitigated 2.14 billion packet per second DDoS attack that lasted 60 seconds</i></sup></p>
    <div>
      <h2>Cloudflare customers are protected</h2>
      <a href="#cloudflare-customers-are-protected">
        
      </a>
    </div>
    <p>Cloudflare customers using Cloudflare’s HTTP reverse proxy services (e.g. <a href="https://developers.cloudflare.com/waf/"><u>Cloudflare WAF</u></a> and <a href="https://developers.cloudflare.com/cache/"><u>Cloudflare CDN</u></a>) are automatically protected.</p><p>Cloudflare customers using <a href="https://developers.cloudflare.com/spectrum/"><u>Spectrum</u></a> and <a href="https://developers.cloudflare.com/magic-transit/"><u>Magic Transit</u></a> are also automatically protected. Magic Transit customers can further optimize their protection by deploying <a href="https://developers.cloudflare.com/magic-firewall/"><u>Magic Firewall</u></a> rules to enforce a strict positive and negative security model at the packet layer.</p>
    <div>
      <h2>Other Internet properties may not be safe</h2>
      <a href="#other-internet-properties-may-not-be-safe">
        
      </a>
    </div>
    <p>The scale and frequency of these attacks are unprecedented. Due to their sheer size and bits/packets per second rates, these attacks have the ability to take down unprotected Internet properties, as well as Internet properties that are protected by on-premise equipment or by cloud providers that just don’t have sufficient network capacity or global coverage to be able to handle these volumes alongside legitimate traffic without impacting performance. </p><p>Cloudflare, however, does have the network capacity, global coverage, and intelligent systems needed to absorb and automatically mitigate these monstrous attacks. </p><p>In this blog post, we will review the attack campaign and why its attacks are so severe. We will describe the anatomy of a Layer 3/4 DDoS attack, its objectives, and how attacks are generated. We will then proceed to detail how Cloudflare’s systems were able to autonomously detect and mitigate these monstrous attacks without impacting performance for our customers. We will describe the key aspects of our defenses, starting with how our systems generate real-time (dynamic) signatures to match the attack traffic all the way to how we leverage kernel features to drop packets at wire-speed.</p>
    <div>
      <h2>Campaign analysis</h2>
      <a href="#campaign-analysis">
        
      </a>
    </div>
    <p>We have observed this attack campaign targeting multiple customers in the financial services, Internet, and telecommunication industries, among others. This attack campaign targets bandwidth saturation as well as resource exhaustion of in-line applications and devices.</p><p>The attacks predominantly leverage <a href="https://www.cloudflare.com/learning/ddos/glossary/user-datagram-protocol-udp/"><u>UDP</u></a> on a fixed port, and originated from across the globe with larger shares coming from Vietnam, Russia, Brazil, Spain, and the US. </p><p>The high packet rate attacks appear to originate from multiple types of compromised devices, including MikroTik devices, DVRs, and Web servers, orchestrated to work in tandem and flood the target with exceptionally large volumes of traffic. The high bitrate attacks appear to originate from a large number of compromised ASUS home routers, likely exploited using <a href="https://censys.com/june-20-improper-authentication-vulnerability-in-asus-routers/"><u>a CVE 9.8 (Critical) vulnerability that was recently discovered by Censys</u></a>.</p><div>
    <figure>
        <table>
            <colgroup>
                <col></col>
                <col></col>
            </colgroup>
            <tbody>
                <tr>
                    <td>
                        <p><span><span>Russia</span></span></p>
                    </td>
                    <td>
                        <p><span><span>12.1%</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>Vietnam</span></span></p>
                    </td>
                    <td>
                        <p><span><span>11.6%</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>United States</span></span></p>
                    </td>
                    <td>
                        <p><span><span>9.3%</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>Spain</span></span></p>
                    </td>
                    <td>
                        <p><span><span>6.5%</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>Brazil</span></span></p>
                    </td>
                    <td>
                        <p><span><span>4.7%</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>France</span></span></p>
                    </td>
                    <td>
                        <p><span><span>4.7%</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>Romania</span></span></p>
                    </td>
                    <td>
                        <p><span><span>4.4%</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>Taiwan</span></span></p>
                    </td>
                    <td>
                        <p><span><span>3.4%</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>United Kingdom</span></span></p>
                    </td>
                    <td>
                        <p><span><span>3.3%</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>Italy</span></span></p>
                    </td>
                    <td>
                        <p><span><span>2.8%</span></span></p>
                    </td>
                </tr>
            </tbody>
        </table>
    </figure>
</div><p><sup><i>Share of packets observed by source location</i></sup></p>
    <div>
      <h2>Anatomy of DDoS attacks</h2>
      <a href="#anatomy-of-ddos-attacks">
        
      </a>
    </div>
    <p>Before we discuss how Cloudflare automatically detected and mitigated the largest DDoS attacks ever seen, it‘s important to understand the basics of DDoS attacks. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7HLtAHnyjS33iiJAR1B9h9/2e1fc2cab871440fc95fa803989ae156/BLOG-2586_5.png" />
          </figure><p><sup><i>Simplified diagram of a DDoS attack</i></sup></p><p>The goal of a <a href="https://www.cloudflare.com/learning/ddos/what-is-a-ddos-attack/"><u>Distributed Denial of Service (DDoS) attack</u></a> is to deny legitimate users access to a service. This is usually done by exhausting resources needed to provide the service. In the context of these recent Layer 3/4 DDoS attacks, that resource is CPU cycles and network bandwidth.</p>
    <div>
      <h3>Exhausting CPU cycles</h3>
      <a href="#exhausting-cpu-cycles">
        
      </a>
    </div>
    <p>Processing a packet consumes CPU cycles. In the case of regular (non-attack) traffic, a <i>legitimate</i> packet received by a service will cause that service to perform some action, and different actions require different amounts of CPU processing. However, before a packet is even delivered to a service there is per-packet work that needs to be done. Layer 3 packet headers need to be parsed and processed to deliver the packet to the correct machine and interface. Layer 4 packet headers need to be processed and routed to the correct socket (if any). There may be multiple additional processing steps that inspect every packet. Therefore, if an attacker sends at a high enough packet rate, then they can potentially saturate the available CPU resources, denying service to legitimate users.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3aBbNG4Fc7TY6MTugLl3BE/064fb17761aebbce737a5a4518a14235/BLOG-2586_6.png" />
          </figure><p>To defend against high packet rate attacks, you need to be able to inspect and discard the bad packets using as few CPU cycles as possible, leaving enough CPU to process the good packets. You can additionally acquire more, or faster, CPUs to perform the processing — but that can be a very lengthy process that bears high costs. </p>
    <div>
      <h3>Exhausting network bandwidth</h3>
      <a href="#exhausting-network-bandwidth">
        
      </a>
    </div>
    <p>Network bandwidth is the total amount of data per time that can be delivered to a server. You can think of bandwidth like a pipe to transport water. The amount of water we can deliver through a drinking straw is less than what we could deliver through a garden hose. If an attacker is able to push more garbage data into the pipe than it can deliver, then both the bad data <i>and</i> the good data will be discarded upstream, at the entrance to the pipe, and the DDoS is therefore successful.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/OehVItOhGfP9ApllRvDDM/fce73e6f375173a1a53bc22026e0b9b1/BLOG-2586_7.png" />
          </figure><p>
Defending against attacks that can saturate network bandwidth can be difficult because there is very little that can be done if you are on the downstream side of the saturated pipe. There are really only a few choices: you can get a bigger pipe, you can potentially find a way to move the good traffic to a new pipe that isn’t saturated, or you can hopefully ask the upstream side of the pipe to stop sending some or all of the data into the pipe.</p>
    <div>
      <h2>Generating DDoS attacks</h2>
      <a href="#generating-ddos-attacks">
        
      </a>
    </div>
    <p>If we think about what this means from the attackers point of view you realize there are similar constraints. Just as it takes CPU cycles to receive a packet, it also takes CPU cycles to create a packet. If, for example, the cost to send and receive a packet were equal, then the attacker would need an equal amount of CPU power to generate the attack as we would need to defend against it. In most cases this is not true — there is a cost asymmetry, as the attacker is able to generate packets using fewer CPU cycles than it takes to receive those packets. However, it is worth noting that generating attacks is not free and can require a large amount of CPU power.</p><p>Saturating network bandwidth can be even more difficult for an attacker. Here the attacker needs to be able to output more bandwidth than the target service has allocated. They actually need to be able to exceed the capacity of the receiving service. This is so difficult that the most common way to achieve a network bandwidth attack is to use a reflection/amplification attack method, for example a <a href="https://www.cloudflare.com/learning/ddos/dns-amplification-ddos-attack/"><u>DNS Amplification attack</u></a>. These attacks allow the attacker to send a small packet to an intermediate service, and the intermediate service will send a large packet to the victim.</p><p>In both scenarios, the attacker needs to acquire or gain access to many devices to generate the attack. These devices can be acquired in a number of different ways. They may be server class machines from cloud providers or hosting services, or they can be compromised devices like DVRs, routers, and webcams that have been infected with the attacker’s malware. These machines together form the botnet.</p>
    <div>
      <h2>How Cloudflare defends against large attacks</h2>
      <a href="#how-cloudflare-defends-against-large-attacks">
        
      </a>
    </div>
    <p>Now that we understand the fundamentals of how DDoS attacks work, we can explain how Cloudflare can defend against these attacks.</p>
    <div>
      <h3>Spreading the attack surface using global anycast</h3>
      <a href="#spreading-the-attack-surface-using-global-anycast">
        
      </a>
    </div>
    <p>The first not-so-secret ingredient is that Cloudflare’s network is built on <a href="https://www.cloudflare.com/learning/cdn/glossary/anycast-network/"><u>anycast</u></a>. In brief, anycast allows a single IP address to be advertised by multiple machines around the world. A packet sent to that IP address will be served by the closest machine. This means when an attacker uses their distributed botnet to launch an attack, the attack will be received in a distributed manner across the Cloudflare network. An infected DVR in Dallas, Texas will send packets to a Cloudflare server in Dallas. An infected webcam in London will send packets to a Cloudflare server in London.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/48tW6A6ACUT4Fd9h3l70F4/c6bcea8f037fc853477d0987c939e007/BLOG-2586_8.png" />
          </figure><p><sup><i>Anycast vs. Unicast networks</i></sup></p><p>Our anycast network additionally allows Cloudflare to allocate compute and bandwidth resources closest to the regions that need them the most. Densely populated regions will generate larger amounts of legitimate traffic, and the data centers placed in those regions will have more bandwidth and CPU resources to meet those needs. Sparsely populated regions will naturally generate less legitimate traffic, so Cloudflare data centers in those regions can be sized appropriately. Since attack traffic is mainly coming from compromised devices, those devices will tend to be distributed in a manner that matches normal traffic flows sending the attack traffic proportionally to datacenters that can handle it. And similarly, within the datacenter, traffic is distributed across multiple machines.</p><p>Additionally, for high bandwidth attacks, Cloudflare’s network has another advantage. A large proportion of traffic on the Cloudflare network does not consume bandwidth in a symmetrical manner. For example, an HTTP request to get a webpage from a site behind Cloudflare will be a relatively small incoming packet, but produce a larger amount of outgoing traffic back to the client. This means that the Cloudflare network tends to egress far more legitimate traffic than we receive. However, the network links and bandwidth allocated are symmetrical, meaning there is an abundance of ingress bandwidth available to receive volumetric attack traffic.</p>
    <div>
      <h3>Generating real-time signatures</h3>
      <a href="#generating-real-time-signatures">
        
      </a>
    </div>
    <p>By the time you’ve reached an individual server inside a datacenter, the bandwidth of the attack has been distributed enough that none of the upstream links are saturated. That doesn’t mean the attack has been fully stopped yet, since we haven’t dropped the bad packets. To do that, we need to sample traffic, qualify an attack, and create rules to block the bad packets. </p><p>Sampling traffic and dropping bad packets is the job of our <a href="https://blog.cloudflare.com/l4drop-xdp-ebpf-based-ddos-mitigations/"><u>l4drop</u></a> component, which uses <a href="https://netdevconf.info/2.1/papers/Gilberto_Bertin_XDP_in_practice.pdf"><u>XDP (eXpress Data Path)</u></a> and leverages an extended version of the Berkeley Packet Filter known as <a href="https://blog.cloudflare.com/tag/ebpf/"><u>eBPF (extended BPF)</u></a>. This enables us to execute custom code in kernel space and process (drop, forward, or modify) each packet directly at the network interface card (NIC) level. This component helps the system drop packets efficiently without consuming excessive CPU resources on the machine. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1NUxGTvKFs5l6G2UCSxvqw/3632f6728f9361123169d9694c807f0b/BLOG-2586_9.png" />
          </figure><p><sup><i>Cloudflare DDoS protection system overview</i></sup></p><p>We use XDP to sample packets to look for suspicious attributes that indicate an attack. The samples include fields such as the source IP, source port, destination IP, destination port, protocol, TCP flags, sequence number, options, packet rate and more. This analysis is conducted by the <i>denial of service daemon (dosd).</i> <i>Dosd</i> holds our secret sauce. It has many <i>filters</i> which instruct it, based on our curated heuristics, when to initiate mitigation. To our customers, these filters are logically grouped by attack vectors and exposed as the <a href="https://developers.cloudflare.com/ddos-protection/managed-rulesets/"><u>DDoS Managed Rules</u></a>. Our customers can <a href="https://developers.cloudflare.com/ddos-protection/managed-rulesets/adjust-rules/"><u>customize their behavior</u></a> to some extent, as needed.</p><p>As it receives samples from XDP, dosd will generate multiple permutations of fingerprints for suspicious traffic patterns. Then, using a data streaming algorithm, dosd will identify the most optimal fingerprints to mitigate the attack. Once an attack is qualified, dosd will push a mitigation rule inline as an eBPF program to surgically drop the attack traffic. </p><p>The detection and mitigation of attacks by dosd is done at the server level, at the data center level and at the global level — and it’s all software defined. This makes our network extremely resilient and leads to almost instant mitigation. There are no out-of-path “scrubbing centers” or “scrubbing devices”. Instead, each server runs the full stack of the Cloudflare product suite including the DDoS detection and mitigation component. And it is all done autonomously. Each server also <i>gossips (multicasts)</i> mitigation instructions within a data center between servers, and globally between data centers. This ensures that whether an attack is localized or globally distributed, dosd will have already installed mitigation rules inline to ensure a robust mitigation.</p>
    <div>
      <h2>Strong defenses against strong attacks</h2>
      <a href="#strong-defenses-against-strong-attacks">
        
      </a>
    </div>
    <p>Our software-defined, autonomous DDoS detection and mitigation systems run across our entire network. In this post we focused mainly on our dynamic fingerprinting capabilities, but our arsenal of defense systems is much larger. The <a href="https://developers.cloudflare.com/ddos-protection/tcp-protection/"><u>Advanced TCP Protection</u></a> system and <a href="https://developers.cloudflare.com/ddos-protection/dns-protection/"><u>Advanced DNS Protection</u></a> system work alongside our dynamic fingerprinting to identify sophisticated and highly randomized TCP-based DDoS attacks and also leverages statistical analysis to thwart complex DNS-based DDoS attacks. Our defenses also incorporate real-time threat intelligence, traffic profiling, and machine learning classification as part of our <a href="https://developers.cloudflare.com/ddos-protection/managed-rulesets/adaptive-protection/"><u>Adaptive DDoS Protection</u></a> to mitigate traffic anomalies. </p><p>Together, these systems, alongside the full breadth of the Cloudflare Security portfolio, are built atop of the Cloudflare network — one of the largest networks in the world — to ensure our customers are protected from the largest attacks in the world.</p> ]]></content:encoded>
            <category><![CDATA[DDoS]]></category>
            <category><![CDATA[Attacks]]></category>
            <category><![CDATA[Trends]]></category>
            <category><![CDATA[Security]]></category>
            <guid isPermaLink="false">4j6QWqeVFn6qzs0Md0LK7h</guid>
            <dc:creator>Manish Arora</dc:creator>
            <dc:creator>Shawn Bohrer</dc:creator>
            <dc:creator>Omer Yoachimik</dc:creator>
            <dc:creator>Cody Doucette</dc:creator>
            <dc:creator>Alex Forster</dc:creator>
            <dc:creator>Nick Wood</dc:creator>
        </item>
        <item>
            <title><![CDATA[How we build software at Cloudflare]]></title>
            <link>https://blog.cloudflare.com/building-software-at-cloudflare/</link>
            <pubDate>Tue, 02 Nov 2021 12:59:45 GMT</pubDate>
            <description><![CDATA[ Cloudflare has a broad range of products -- ranging from security, to performance and serverless compute. These products are built by multiple teams in close collaboration and delivering those products can be a complex task. So ever wonder how we do so consistently and safely at scale? ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Cloudflare provides a broad range of products — ranging from security, to performance and serverless compute — which are used by millions of Internet properties worldwide. Often, these products are built by multiple teams in close collaboration and delivering them can be a complex task. So ever wondered how we do so consistently and safely at scale?</p><p>Software delivery consists of all the activities to get working software into the hands of customers. It’s usual to talk about software delivery with reference to a model, or framework. These provide the scaffolding for most modern software delivery models, although in order to minimise operational friction it’s usual for a company to tailor their approach to suit their business context and culture.</p><p>For example, a company that designs the autopilot systems for passenger aircraft will require very strict tolerances, as a failure could cost hundreds of lives. They would want a different process to a cutting edge tech startup, who may value time to market over system uptime or stability.</p><p>Before outlining the approach we use at Cloudflare it’s worth quickly running through a couple of commonly used delivery models.</p>
    <div>
      <h3>The Waterfall Approach</h3>
      <a href="#the-waterfall-approach">
        
      </a>
    </div>
    <p><a href="https://en.wikipedia.org/wiki/Waterfall_model">Waterfall</a> has its foundations (pun intended) in construction and manufacturing. It breaks a project up into phases and presumes that each phase is completed before the next begins. Each phase “cascades” into the next bit like a waterfall, hence the name.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5tFELCJ7Fd5vBpWl4KZfdv/2d773acbca12dc1c6bb30529fc80ee3f/image2-1.png" />
            
            </figure><p>The main criticism of waterfall approaches arises when flaws are discovered downstream, which may necessitate a return to earlier phases — though this can be managed through governance processes that allows for adjusting scope, budgets or timelines.</p><p>More recently there are a number of modified waterfall models which have been developed as a response to its perceived inflexibility. Some notable examples are the <a href="https://en.wikipedia.org/wiki/Rational_Unified_Process">Rational Unified Process (RUP)</a>, which encourages iteration within phases, and <a href="https://www.thomasalspaugh.org/pub/fnd/softwareProcess.html#Sashimi">Sashimi</a> which provides partial overlap between phases.</p><p>Despite falling out of favour in recent years, waterfall still has a place in modern technology companies. It tends to be reserved for projects where the scope and requirements can be defined upfront and are unlikely to change. At Cloudflare, we use it for infrastructure rollouts, for example. It also has a place in very large projects with complex dependencies to manage.</p>
    <div>
      <h3>Agile Approaches</h3>
      <a href="#agile-approaches">
        
      </a>
    </div>
    <p>Agile isn’t a single well-defined process, rather a family of approaches which share similar philosophies — those of the <a href="https://agilemanifesto.org">agile manifesto</a>. Implementations vary, but most agile flavours tend to share a number of common traits:</p><ul><li><p>Short release cycles, such that regular feedback (ideally from real users) can be incorporated.</p></li><li><p>Teams maintain a prioritized to-do list of upcoming work (often called a ‘backlog’), with the most valuable items are at the top.</p></li><li><p>Teams should be self-organizing, and work at a sustainable pace.</p></li><li><p>A philosophy of Continuous Improvement, where teams seek to improve their ways of working over time.</p></li></ul><p>Continuous improvement is very much the heart of agile, meaning these approaches are less about nailing down “the correct process” and focus more on regular reflection and change. This means variances between any two teams is expected, and encouraged.</p><p>Agile approaches can be divided into two main branches — iterative and flow-based. <a href="https://scrumprimer.org/">Scrum</a> is probably the most prevalent of the iterative agile methods. In Scrum a team aims to build shippable increments of code at regular intervals called sprints (or “iterations”). Flow-based approaches on the other hand (such as <a href="https://www.atlassian.com/agile/kanban">Kanban</a>) instead pick up new items from their backlog on an ad hoc basis. They use a number of techniques to try and minimise work in progress across the team.</p><p>The main differences between the two branches can be typified by looking at two example teams:</p><ul><li><p>The “Green” Team has a set of products they support and wants to update them regularly, production issues for them are rare and there is very little ad-hoc work. An iterative approach allows them to make long term plans whilst also being able to incorporate feedback from users with some regularity.</p></li><li><p>The “Blue” Team meanwhile is an operational team, where a big part of their role is to monitor production systems and investigate issues as they arise. For them, a flow based approach is much more appropriate, so they can update their plans on the fly as new items arise.</p></li></ul>
    <div>
      <h3>Which approach does Cloudflare follow?</h3>
      <a href="#which-approach-does-cloudflare-follow">
        
      </a>
    </div>
    <p>Cloudflare comprises dozens of globally distributed engineering teams each with their own unique challenges and contexts. A team usually has an Engineering Manager, a Product Manager and less than 10 engineers, who all focus on a singular product or mission. The DDoS team for example is one such team.</p><p>A team that supports a newly released product will likely want to rapidly incorporate feedback from customers, whereas a team that manages shared internal platforms will prize platform stability over speed of innovation. There is a spectrum of different contexts within Cloudflare which makes it impossible to define a single software delivery method for all teams to follow.</p><p>Instead, we take a more nuanced approach where we allow teams to decide which methodology they wish to follow within the team, whilst also defining a number of high-level concepts and language that are common to all teams. In other words, we are more concerned with <b>macro</b>-management than micro-management.</p>
    <div>
      <h3>“SHIP”s and “Epic”s</h3>
      <a href="#ship-s-and-epic-s">
        
      </a>
    </div>
    <p>At the highest level, our unit of work is called a “SHIP”  — this is a change to a service or product which we intend to ship to customers, hence the name. All live SHIPs are published on our internal roadmap, called our “SHIP-board”. Transparency and collaboration are part of our DNA at Cloudflare, so for us, it’s important that anyone in Cloudflare can view the SHIP-board.</p><p>Individual SHIPs are sized such that they can be comfortably delivered within a month or two, though we have a strong preference towards shorter timescales. We’d much rather deliver three small feature sets monthly than one big launch every quarter.</p><p>A single SHIP might need work from multiple teams in order for customers to use it. We manage this by ensuring there is an EPIC within the SHIP for each team contributing. To prevent circular dependencies, a SHIP can’t contain another SHIP. SHIPs are owned by their Product Manager, and EPICs are usually owned by an Engineering Manager. We also allow for EPICs to be created that don’t deliver against SHIPs — this is where technical improvement initiatives are typically managed.</p><p>Below the level of EPICs we don’t enforce any strict delivery model on teams, though teams will usually link their contributory work to the EPIC for ease of tracking. Teams are free to use whichever delivery framework they wish.</p><p>Within the Product Engineering organisation, all Product Managers and Engineering managers meet weekly to discuss progress and blockers of their live SHIPs/EPICs. Due to the number of people involved, this is a very rapid fire meeting facilitated by our automated “SHIP-board”. This has a built-in linter to highlight potential issues, to be updated prior to the meeting. We run through each team one by one, starting with the team with the most outstanding lints.</p><p>There’s also a few icons which let us visualise the status of a SHIP or EPIC at a glance. For example, a monkey means the target date for an item moved in the last week. Bananas count the total number of times the date has “slipped”, i.e. changed. A typical fragment of the SHIP-board is shown below.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7ysKfyI9KK1Sz9lBwhQgTe/ff0dc8a24b2cedb7bb7b0774ef0d9140/image1-2.png" />
            
            </figure>
    <div>
      <h3>Planning</h3>
      <a href="#planning">
        
      </a>
    </div>
    <p>Planning takes place every quarter. This lets us deliver aggressively, without having to change plans too frequently. It also forces us to make conscious choices about what to include and exclude from a SHIP so that extraneous work is minimised.</p><p>About a month before quarter-end, product managers will begin to compile the SHIPs that would deliver the most value to customers. They’ll work with their engineering teams to understand how the work might be done, and what work is required of other teams (e.g. the UI team might need to build a frontend whilst another team builds the API).</p><p>The team will likely estimate the work at this stage (though the exact mechanism is left up to them). Where work is required of other teams we’ll also begin to reach out to them, so they can factor it into their work for the quarter, and estimate their effort too. It’s also important at this stage to understand what kind of dependency this is — do we need one piece to fully complete before the other, or can they be done in parallel and integrated towards the end? Usually the latter.</p><p>The final aspect of planned work are unlinked EPICs — these are things that don’t necessarily contribute meaningfully to a SHIP, but the team would still like to get them completed. Examples of this are performance improvements, or changes/fixes to backend tooling.</p><p>We deliver continuously through the quarter to avoid a scramble of deployment at once, and our target dates will reflect that. We also allow anything delivered in the first two weeks of the following quarter to still count as being on-time — stability of the network is more important than hitting arbitrary dates.</p><p>We also take a fairly pragmatic approach towards target dates. A natural part of software delivery is that as we begin to explore the solution space we may uncover additional complexity. As long as we can justify a change of date it’s perfectly acceptable to amend the dates of SHIPs/EPICs to reflect the latest information. The exception to this is where we’ve made an external commitment to deliver something, so changing the delivery dates is subject to greater scrutiny.</p>
    <div>
      <h3>Keeping us safe</h3>
      <a href="#keeping-us-safe">
        
      </a>
    </div>
    <p>You might think that letting teams set their own process might lead to chaos, but in my experience the opposite is true. By allowing teams to define their own methods we are empowering them to make better decisions and understand their own context within Cloudflare. We explicitly define the interfaces we use between teams, and that allows teams the flexibility to do what works best for them.</p><p>We don’t go as far as to say “there are no rules”. Last quarter Cloudflare blocked an average of 87 billion cyber threats each day, and in July 2021 we blocked the <a href="/cloudflare-thwarts-17-2m-rps-ddos-attack-the-largest-ever-reported/">largest DDoS attack</a> ever recorded. If we have an outage, our customers feel it, and we feel it too. To manage this we have strict, though simple, rules governing how code reaches our data centers. For example, we mandate a minimum number of reviews for each piece of code, and our deployments are phased so that changes are tested on a subset of live traffic, so any issues can be localised.</p><p>The main takeaway is to find the right balance between freedom and rules, and appreciate that this may vary for different teams within the organisation. Enforcing an unnecessarily strict process can cause a lot of friction in teams, and that’s a shortcut to losing great people. Our ideal process is one that minimises red tape, such that our team can focus on the hard job of protecting our customers.</p>
    <div>
      <h3>P.S. — we’re hiring!</h3>
      <a href="#p-s-were-hiring">
        
      </a>
    </div>
    <p>Do you want to come and work on advanced technologies where every code push impacts millions of Internet properties? <a href="https://boards.greenhouse.io/cloudflare/jobs/3362628?gh_jid=3362628">Join our team</a>!</p> ]]></content:encoded>
            <category><![CDATA[Careers]]></category>
            <category><![CDATA[Developers]]></category>
            <guid isPermaLink="false">5YJEnwrBl65CRry77tkgQp</guid>
            <dc:creator>Nick Wood</dc:creator>
        </item>
    </channel>
</rss>