
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[ The Cloudflare Blog ]]></title>
        <description><![CDATA[ Get the latest news on how products at Cloudflare are built, technologies used, and join the teams helping to build a better Internet. ]]></description>
        <link>https://blog.cloudflare.com</link>
        <atom:link href="https://blog.cloudflare.com/" rel="self" type="application/rss+xml"/>
        <language>en-us</language>
        <image>
            <url>https://blog.cloudflare.com/favicon.png</url>
            <title>The Cloudflare Blog</title>
            <link>https://blog.cloudflare.com</link>
        </image>
        <lastBuildDate>Tue, 07 Apr 2026 23:27:39 GMT</lastBuildDate>
        <item>
            <title><![CDATA[A deep-dive into Cloudflare’s autonomous edge DDoS protection]]></title>
            <link>https://blog.cloudflare.com/deep-dive-cloudflare-autonomous-edge-ddos-protection/</link>
            <pubDate>Thu, 18 Mar 2021 14:18:20 GMT</pubDate>
            <description><![CDATA[ Introducing our autonomous DDoS (Distributed Denial of Service) protection system, globally deployed to all of Cloudflare’s 200+ data centers, and is actively protecting all our customers against DDoS attacks across layers 3 to 7 (in the OSI model) without requiring any human intervention. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Today, I’m excited to talk about our autonomous DDoS (<a href="https://www.cloudflare.com/learning/ddos/what-is-a-ddos-attack/">Distributed Denial of Service</a>) protection system. This system has been deployed globally to all of our 200+ data centers and actively protects all our customers against DDoS attacks across layers 3 to 7 (in the <a href="https://www.cloudflare.com/learning/ddos/glossary/open-systems-interconnection-model-osi/">OSI model</a>) without requiring any human intervention. As part of our <a href="/unmetered-mitigation/">unmetered DDoS protection commitment</a>, we won’t charge a customer more just because they got hit by a DDoS.</p>
    <div>
      <h3>Autonomous protection at the edge</h3>
      <a href="#autonomous-protection-at-the-edge">
        
      </a>
    </div>
    <p>To protect our customers quickly and with precision against DDoS attacks, we built an autonomous edge detection and mitigation system that can make decisions on its own without seeking a centralized consensus. It is completely software-defined and runs on our edge on commodity servers. It’s powered by our denial of service daemon (dosd) which originally went live in mid-2019 for protection against L3/4 DDoS attacks. Since then, we’ve been investing in enhancing and improving its capabilities to stay ahead of attackers and to disrupt the economics of attacks. The latest set of improvements have expanded our edge mitigation component to protect against <a href="https://www.cloudflare.com/learning/ddos/application-layer-ddos-attack/">L7 attacks</a> in addition to <a href="https://www.cloudflare.com/learning/ddos/layer-3-ddos-attacks/">L3/4</a>.</p><p>This system runs on every single server in all our edge data centers. It constantly analyzes packets and HTTP requests, scanning for DDoS attacks. Upon detection, it immediately pushes a mitigation rule with a real-time generated signature to the most optimal location in the Linux stack where the most cost-efficient mitigation can be applied.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/15Hk0Q8gqqwu4pkZXq4foF/c97de51639de77feb3dc93486a2ad8c5/DDoS-mitigation-diagram_2x-1.png" />
            
            </figure><p>A conceptual diagram of Cloudflare DDoS mitigation systems</p><p>Our new edge detection capabilities complement our existing global threat detection mechanism, <a href="/meet-gatebot-a-bot-that-allows-us-to-sleep/">Gatebot</a>, which resides in our network’s core. Detecting attacks at the network core with Gatebot is great for larger, distributed volumetric attacks that require coordination across the entire Cloudflare edge, but smaller, localized attacks require a different approach. Detecting network-layer and HTTP attacks at the edge means we can sample at a higher rate, detect both small and large attacks, and immediately generate a mitigation rule. Over the past few months, 98.6% of all L3/4 DDoS attacks were detected by dosd. Similarly, since deploying the expanded version of dosd, it has been mitigating 81% of all L7 attacks.</p><p>In previous blogs, we’ve already covered <a href="/meet-gatebot-a-bot-that-allows-us-to-sleep/">Gatebot</a> and <a href="/announcing-flowtrackd/">flowtrackd</a>. So in this blog, we’ll be focusing on the expanded dosd capabilities.</p>
    <div>
      <h3>Harnessing Linux networking to drop packets and requests at wire speed</h3>
      <a href="#harnessing-linux-networking-to-drop-packets-and-requests-at-wire-speed">
        
      </a>
    </div>
    <p>Ten years ago, Linux networking was slow. Today, we’re dropping packets at wire speed thanks to Linux — specifically, with iptables and the eXpress Data Path (XDP).</p>
    <div>
      <h3>The life of a packet</h3>
      <a href="#the-life-of-a-packet">
        
      </a>
    </div>
    <p>A packet destined for a Cloudflare-protected customer makes its way to the closest <a href="https://www.cloudflare.com/network/">Cloudflare data center</a> through <a href="https://www.cloudflare.com/learning/cdn/glossary/anycast-network/">BGP Anycast</a>. Once it arrives, it is passed from the router to a server using equal-cost multi-path routing groups (<a href="https://en.wikipedia.org/wiki/Equal-cost_multi-path_routing">ECMP</a>) algorithm via network switches. When it arrives at a server, the packet is sent into a group of eXpress Data Path (<a href="https://en.wikipedia.org/wiki/Express_Data_Path">XDP</a>) programs. The first group of XDP programs, <a href="/l4drop-xdp-ebpf-based-ddos-mitigations/">L4Drop</a>, applies mitigation rules from previously detected attacks and transmits packet samples to dosd for further analysis.</p><p>If a packet is not dropped as malicious, it’s then passed to <a href="/unimog-cloudflares-edge-load-balancer/">Unimog</a>, our proprietary L4 load balancer. Using server health and performance metrics, Unimog decides whether it should keep the packet in the same server or pass it on to another server in the data center better able to handle it. After Unimog, it is passed through the iptables firewall and then, if targeting an L7 application, e.g., a service protected by the <a href="https://www.cloudflare.com/application-services/products/waf/">Cloudflare WAF</a>, to our HTTP reverse proxy. The reverse-proxy runs in userspace and HTTP requests go through our <a href="https://www.cloudflare.com/waf/">Web Application Firewall</a>, application Firewall rules, and additional customer configurations. If the packet is instead destined for a TCP/UDP application (<a href="https://www.cloudflare.com/application-services/products/cloudflare-spectrum/">Spectrum</a>) or an IP destination that is routed rather than proxied (<a href="https://www.cloudflare.com/network-services/products/magic-transit/">Magic Transit</a>), it would pass through those systems rather than our HTTP proxy.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/66UlMrtt1qMkZIKeHkiSF1/dc76094ef0551319f1509063b9d8d4e1/L7-ddos-diagram_2x-1-1.png" />
            
            </figure><p>Life of a packet</p><p>In addition to L4Drop, our HTTP proxy also transmits samples and metadata of HTTP requests to dosd. This edge sampling happens at a rate that’s 10 times greater than core sampling, as signals can now be analyzed (and acted upon) locally rather than shipped to a core data center. Similarly, packets are sampled by dosd at a rate that is 81 times faster than gatebot.</p><p>Together, dosd, gatebot, and flowtrackd analyze samples they receive and apply mitigation rules when DDoS attacks are detected. They push mitigation rules into the web proxy to mitigate HTTP attacks. Attack requests are handled with a block, rate limit, or challenge action, depending on the system’s decision. However, if the attack is highly volumetric, the mitigation rule is pushed down the stack into the iptables firewall and L7 attacks are dropped at L4 using <a href="/rolling-with-the-punches-shifting-attack-tactics-dropping-packets-faster-cheaper-at-the-edge/#jails">IP Jails,</a> for a more cost-efficient mitigation. Similarly, L3/4 attacks are mitigated in the iptables firewall using extended Berkeley Packet Filter (<a href="/cloudflare-architecture-and-how-bpf-eats-the-world/">eBPF</a>) programs inside L4Drop. Leveraging these components allows us to automatically <a href="https://www.cloudflare.com/learning/ddos/ddos-mitigation/">mitigate DDoS attacks</a> at scale.</p>
    <div>
      <h3>Disrupting the attack economics</h3>
      <a href="#disrupting-the-attack-economics">
        
      </a>
    </div>
    <p>Our expanded autonomous system, described above, along with our existing threat mitigation components, was developed to protect our customers against DDoS attacks that have become very easy and cheap to launch. These attacks are used by malicious actors that aim to take down a website, mobile app, game, or any Internet-connected property. These expanded protections were a necessary step as during the past year the number of attacks has increased, as we’ve documented in our <a href="/network-layer-ddos-attack-trends-for-q3-2020/">DDoS trends reports</a>. Additionally, the attacks are getting bigger and more <a href="/beat-an-acoustics-inspired-ddos-attack/">sophisticated</a>, such as the attack that imitated acoustic beats. Just as important are small attacks that could take down a small web property; we want to block the large and small.</p><p>In many cases, attackers can launch DDoS attacks for free using publicly available tools, or for a small fee by hiring a DDoS-as-a-service <a href="https://www.cloudflare.com/learning/ddos/what-is-a-ddos-botnet/">botnet</a> such as <a href="/moobot-vs-gatebot-cloudflare-automatically-blocks-botnet-ddos-attack-topping-at-654-gbps/">Moobot</a> in the dark web. According to the <a href="https://www.privacyaffairs.com/dark-web-price-index-2020/">Dark Web Price Index for 2020</a>, the price of a DDoS attack starts at $10 for a one-hour attack at a rate of 10-50k requests per second. Attacks are far cheaper to launch than the damage they cause. By causing an outage or even <i>just</i> by degrading the service, attackers can take a substantial toll on their victim. As an example, taking down an <a href="https://www.cloudflare.com/ecommerce/">ecommerce website</a> means that users cannot log in and make purchases. Even increased <a href="https://www.cloudflare.com/solutions/ecommerce/optimization/">latency</a> can cause users to abandon their shopping carts and pop over to the competition. A minute of downtime can easily translate to the loss of <a href="https://www.gremlin.com/ecommerce-cost-of-downtime/">tens of thousands of dollars</a>.</p><p>The frequency, sophistication, and size of DDoS attacks require a new approach — one that is fast, accurate, and precise. And this is why we developed the expanded protections described in this post.</p>
    <div>
      <h3>Helping build a better Internet</h3>
      <a href="#helping-build-a-better-internet">
        
      </a>
    </div>
    <p>Cloudflare’s mission is to help build a better Internet — one that is secure, faster, and more reliable for all. The DDoS team’s vision is derived from this mission: our goal is to make the impact of DDoS attacks a thing of the past. In the ’90s and 2000s, <a href="https://en.wikipedia.org/wiki/History_of_email_spam">spam emails became a serious problem</a>. Today, email services filter them out for us, and our objective is to do the same for DDoS attacks.</p><p>For more information about <a href="https://www.cloudflare.com/ddos/">Cloudflare’s DDoS protection</a>, <a href="http://www.cloudflare.com/enterprise">reach out to us</a> or have a go with a hands-on evaluation of <a href="https://www.cloudflare.com/plans/free/">Cloudflare’s free plan</a>.</p><p>By the way, if you are interested in working in the DDoS Protection engineering team, we're currently hiring in our London and Austin offices. Submit your application here:</p><p> Austin: <a href="https://boards.greenhouse.io/cloudflare/jobs/2291040?gh_jid=2291040">https://boards.greenhouse.io/cloudflare/jobs/2291040?gh_jid=2291040</a> London: <a href="https://boards.greenhouse.io/cloudflare/jobs/2291038?gh_jid=2291038">https://boards.greenhouse.io/cloudflare/jobs/2291038?gh_jid=2291038</a></p> ]]></content:encoded>
            <category><![CDATA[DDoS]]></category>
            <category><![CDATA[Gatebot]]></category>
            <category><![CDATA[dosd]]></category>
            <category><![CDATA[Linux]]></category>
            <guid isPermaLink="false">51RV8t0EDJMvGacfUFdMV0</guid>
            <dc:creator>Omer Yoachimik</dc:creator>
        </item>
        <item>
            <title><![CDATA[Moobot vs. Gatebot: Cloudflare Automatically Blocks Botnet DDoS Attack Topping At 654 Gbps]]></title>
            <link>https://blog.cloudflare.com/moobot-vs-gatebot-cloudflare-automatically-blocks-botnet-ddos-attack-topping-at-654-gbps/</link>
            <pubDate>Wed, 16 Sep 2020 11:00:00 GMT</pubDate>
            <description><![CDATA[ On July 3, Cloudflare’s global DDoS protection system, Gatebot, automatically detected and mitigated a UDP-based DDoS attack that peaked at 654 Gbps. The attack was part of a ten-day multi-vector DDoS campaign targeting a Magic Transit customer and was mitigated without any human intervention. ]]></description>
            <content:encoded><![CDATA[ <p>On July 3, Cloudflare’s global DDoS protection system, <a href="/meet-gatebot-a-bot-that-allows-us-to-sleep/">Gatebot</a>, automatically detected and mitigated a <a href="https://www.cloudflare.com/learning/ddos/udp-flood-ddos-attack/">UDP-based DDoS attack</a> that peaked at 654 Gbps. The attack was part of a ten-day multi-vector DDoS campaign targeting a <a href="https://www.cloudflare.com/magic-transit/">Magic Transit</a> customer and was mitigated without any human intervention. The DDoS campaign is believed to have been generated by Moobot, a <a href="/inside-mirai-the-infamous-iot-botnet-a-retrospective-analysis/">Mirai</a>-based botnet. No downtime, service degradation, or false positives were reported by the customer.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5tZOVVWcnoNircFk2dzvgB/f4360a467a489cd7ee38f976e2e4dc1d/image7-3.png" />
            
            </figure><p><b>Moobot Targets 654 Gbps towards a Magic Transit Customer</b></p><p>Over those ten days, our systems automatically detected and mitigated over 5,000 DDoS attacks against this one customer, mainly UDP floods, SYN floods, ACK floods, and GRE floods. The largest DDoS attack was a UDP flood and lasted a mere 2 minutes. This attack targeted only one IP address but hit multiple ports. The attack originated from 18,705 unique IP addresses, each believed to be a Moobot-infected IoT device.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1SBAfKZG8YJHkfEBJnZyHV/655adca6d9f31d78fcc714e9fb49e4ac/image2-3.png" />
            
            </figure><p><b>Attack Distribution by Country - From 100 countries</b></p><p>The attack was observed in Cloudflare’s data centers in 100 countries around the world. Approximately 89% of the attack traffic originated from just 10 countries with the US leading at 41%, followed by South Korea and Japan in second place (12% each), and India in third (10%). What this likely means is that the malware has infected at least 18,705 devices in 100 countries around the world.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4L3iXSkvCp4kDRwUkyjr3d/61490559c472b36b1aa959be999e65d5/image5-4.png" />
            
            </figure><p><b>Attack Distribution by Country - Top 10</b></p>
    <div>
      <h2>Moobot - Self Propagating Malware</h2>
      <a href="#moobot-self-propagating-malware">
        
      </a>
    </div>
    <p>‘Moobot’ sounds like a cute name, but there’s nothing cute about it. According to <a href="https://blog.netlab.360.com/ddos-botnet-moobot-en/">Netlab 360</a>, Moobot is the codename of a self-propagating Mirai-based <a href="https://www.cloudflare.com/learning/ddos/glossary/malware/">malware</a> first discovered in 2019. It infects IoT (Internet of Things) devices using remotely exploitable vulnerabilities or weak default passwords. IoT is a term used to describe smart devices such as security hubs and cameras, smart TVs, smart speakers, smart lights, sensors, and even refrigerators that are connected to the Internet.</p><p>Once a device is infected by Moobot, control of the device is transferred to the operator of the command and control (C2) server, who can issue commands remotely such as attacking a target and locating additional vulnerable IoT devices to infect (self-propagation).</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7YKDGZ9yqbvb1TuYFqqYM/e72ce62dd004ea672ad3272f70b40c6e/image9.gif" />
            
            </figure><p>Moobot is a Mirai-based botnet, and has <a href="/inside-mirai-the-infamous-iot-botnet-a-retrospective-analysis/">similar capabilities (modules) as Mirai</a>:</p><ol><li><p><b>Self-propagation</b> - The self-propagation module is in charge of the botnet’s growth. After an IoT device is infected, it randomly scans the Internet for open telnet ports and reports back to the C2 server. Once the C2 server gains knowledge of open telnet ports around the world, it tries to leverage known vulnerabilities or brute force its way into the IoT devices with common or default credentials.</p></li></ol>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7ve4CTJV9L3BAVMbNMfo0a/a116c9059f8699a408cef7c13b38fe89/image6-3.png" />
            
            </figure><p>Self-propagation</p><p>2. <b>Synchronized attacks</b> - The C2 server orchestrates a coordinated flood of packets or HTTP requests with the goal of creating a denial of service event for the target's website or service.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/43xBoL19Y8IoRYqMdCmGio/e92ef9bd26ae5420d18e119166617553/image3-7.png" />
            
            </figure><p>Synchronized attacks</p><p>The botnet operator may use multiple C2 servers in various locations around the world in order to reduce the risk of exposure. Infected devices may be assigned to different C2 servers varying by region and module; one server for self-propagation and another for launching attacks. Thus if a C2 server is compromised and taken down by law enforcement authorities, only parts of the botnet are deactivated.</p>
    <div>
      <h2>Why this attack was not successful</h2>
      <a href="#why-this-attack-was-not-successful">
        
      </a>
    </div>
    <p>This is the second large scale attack in the past few months that we observed on Cloudflare's network. The previous one peaked at <a href="/mitigating-a-754-million-pps-ddos-attack-automatically/">754M packets per second</a> and attempted to take down our routers with a high packet rate. Despite the high packet rate, the 754Mpps attack peaked at a <i>mere</i> 253 Gbps.</p><p>As opposed to the high packet rate attack, this attack was a high bit rate attack, peaking at 654 Gbps. Due to the high bit rates of this attack, it seems as though the attacker tried (and failed) to cause a denial of service event by saturating our Internet link capacity. So let’s explore why this attack was not successful.</p>
    <div>
      <h3>Avoiding link saturation &amp; keeping appliances running</h3>
      <a href="#avoiding-link-saturation-keeping-appliances-running">
        
      </a>
    </div>
    <p>Cloudflare’s global <a href="https://www.cloudflare.com/network/">network</a> capacity is over 42 Tbps and growing. Our network spans more than 200 cities in over 100 countries, including 17 cities in mainland China. It interconnects with over 8,800 networks globally, including major ISPs, cloud services, and enterprises. This level of interconnectivity along with the use of <a href="https://www.cloudflare.com/learning/cdn/glossary/anycast-network/">Anycast</a> ensures that our network can easily absorb even the largest attacks.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2kvrwYIA87fmnWCTKdl7Wi/67748d4b866d2042e2b5fb40b90207d8/image4-7.png" />
            
            </figure><p>The Cloudflare Network</p><p>After traffic arrives at an edge data center, it is then load-balanced efficiently using our own Layer 4 load-balancer that we built, <a href="/unimog-cloudflares-edge-load-balancer/">Unimog</a>, which uses our appliances' health and other metrics to load-balance traffic intelligently within a data center to avoid overwhelming any single server.</p><p>Besides the use of Anycast for inter-data center load balancing and Unimog for intra-data center load balancing, we also utilize various forms of traffic engineering in order to deal with sudden changes in traffic loads across our network. We utilize both automatic and manual traffic engineering methods that can be employed by our 24/7/365 Site Reliability Engineering (SRE) team.</p><p>These combined factors significantly reduce the likelihood of a denial of service event due to link saturation or appliances being overwhelmed -- and as seen in this attack, no link saturation occurred.</p><h2>Detecting &amp; Mitigating DDoS attacks</h2><p>Once traffic arrives at our edge, it encounters our three software-defined <a href="https://www.cloudflare.com/ddos/">DDoS protection</a> systems:</p><ol><li><p><a href="/meet-gatebot-a-bot-that-allows-us-to-sleep/">Gatebot</a> - Cloudflare’s centralized DDoS protection systems for detecting and mitigating globally distributed volumetric DDoS attacks. Gatebot runs in our network’s core data center. It receives samples from every one of our edge data centers, analyzes them, and automatically sends mitigation instructions when attacks are detected. Gatebot is also synchronized to each of our customers’ web servers to identify its health and triggers mitigation accordingly.</p></li><li><p><a href="/rolling-with-the-punches-shifting-attack-tactics-dropping-packets-faster-cheaper-at-the-edge/">dosd</a> (denial of service daemon) - Cloudflare’s decentralized DDoS protection systems. dosd runs autonomously in each server in every Cloudflare data center around the world, analyzing traffic and applying local mitigation rules when needed. Besides being able to detect and mitigate attacks at super-fast speeds, dosd significantly improves our network resilience by delegating the detection and mitigation capabilities to the edge.</p></li><li><p><a href="/announcing-flowtrackd/">flowtrackd</a> (flow tracking daemon) - Cloudflare’s TCP state tracking machine for detecting and mitigating the most randomized and sophisticated TCP-based DDoS attacks in unidirectional routing topologies (such as the case for <a href="https://www.cloudflare.com/magic-transit/">Magic Transit</a>). flowtrackd is able to identify the state of a TCP connection and then drops, challenges, or rate-limits packets that don’t belong to a legitimate connection.</p></li></ol>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/78iByRWxPrVk9LKN9jJede/e4fb1f012c8e781fe35a2b9c41f4c175/image1-9.png" />
            
            </figure><p>Cloudflare DDoS Protection Lifecycle</p><p>The three DDoS protection systems collect traffic samples in order to detect DDoS attacks. The types of traffic data that they sample include:</p><ol><li><p><b>Packet fields</b> such as the source IP, source port, destination IP, destination port, protocol, TCP flags, sequence number, options, and packet rate.</p></li><li><p><b>HTTP request metadata</b> such as HTTP headers, user agent, query-string, path, host, HTTP method, HTTP version, TLS cipher version, and request rate.</p></li><li><p><b>HTTP response metrics</b> such as error codes returned by customers’ origin servers and their rates.</p></li></ol><p>Our systems then crunch these sample data points together to form a real-time view of our network’s security posture and our customer’s origin server health. They look for attack patterns and traffic anomalies. When found, a mitigation rule with a dynamically crafted attack signature is generated in real-time. Rules are propagated to the most optimal place for cost-effective mitigation. For example, an L7 HTTP flood might be dropped at L4 to reduce the CPU consumption.</p><p>Rules that are generated by dosd and flowtrackd are propagated within a single data center for rapid mitigation. Gatebot’s rules are propagated to all of the edge data centers which then take priority over dosd’s rules for an even and optimal mitigation. Even if the attack is detected in a subset of edge data centers, Gatebot propagates the mitigation instructions to all of Cloudflare’s edge data centers -- effectively sharing the threat intelligence across our network as a form of proactive protection.</p><p>In the case of this attack, in each edge data center, dosd generated rules to mitigate the attack promptly. Then as Gatebot received and analyzed samples from the edge, it determined that this was a globally distributed attack. Gatebot propagated unified mitigation instructions to the edge, which prepared each and every one of our 200+ data centers to tackle the attack as the attack traffic may shift to a different data center due to Anycast or traffic engineering.</p>
    <div>
      <h3>No inflated bills</h3>
      <a href="#no-inflated-bills">
        
      </a>
    </div>
    <p>DDoS attacks obviously pose the risk of an outage and service disruption. But there is another risk to consider -- the cost of mitigation. During these ten days, more than 65 Terabytes of attack traffic were generated by the botnet. However, as part of Cloudflare’s <a href="/unmetered-mitigation/">unmetered DDoS protection</a> guarantee, Cloudflare mitigated and absorbed the attack traffic without billing the customer. The customer doesn't need to submit a retroactive credit request. Attack traffic is automatically excluded from our billing system. We eliminated the financial risk.</p> ]]></content:encoded>
            <category><![CDATA[DDoS]]></category>
            <category><![CDATA[Mirai]]></category>
            <category><![CDATA[Gatebot]]></category>
            <category><![CDATA[Magic Transit]]></category>
            <category><![CDATA[Bots]]></category>
            <category><![CDATA[Attacks]]></category>
            <guid isPermaLink="false">4LiHZDtLcYX0cts6SvjaUj</guid>
            <dc:creator>Omer Yoachimik</dc:creator>
        </item>
        <item>
            <title><![CDATA[flowtrackd: DDoS Protection with Unidirectional TCP Flow Tracking]]></title>
            <link>https://blog.cloudflare.com/announcing-flowtrackd/</link>
            <pubDate>Tue, 14 Jul 2020 11:00:00 GMT</pubDate>
            <description><![CDATA[ flowtrackd is a software-defined DDoS protection system that significantly improves our ability to automatically detect and mitigate even the most complex TCP-based DDoS attacks. If you are a Magic Transit customer, this feature will be enabled by default at no additional cost on July 29, 2020. ]]></description>
            <content:encoded><![CDATA[ <p></p><p><a href="https://www.cloudflare.com/magic-transit/">Magic Transit</a> is Cloudflare’s L3 DDoS Scrubbing service for protecting network infrastructure. As part of our ongoing investment in Magic Transit and our <a href="https://www.cloudflare.com/ddos/">DDoS protection</a> capabilities, we’re excited to talk about a new piece of software helping to protect Magic Transit customers: <b><i>flowtrackd</i></b><i>.</i> flowtrackd is a software-defined DDoS protection system that significantly improves our ability to automatically detect and mitigate even the most complex TCP-based DDoS attacks. If you are a Magic Transit customer, this feature will be enabled by default at no additional cost on July 30, 2020.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3cB4AX4qGrbT7hbc2AH2fP/f4927a9879bade2ea0e21824dc724d89/Social---Case-Study-Quote-template-2.png" />
            
            </figure>
    <div>
      <h3>TCP-Based DDoS Attacks</h3>
      <a href="#tcp-based-ddos-attacks">
        
      </a>
    </div>
    <p>In the first quarter of 2020, one out of every two L3/4 <a href="https://www.cloudflare.com/learning/ddos/what-is-a-ddos-attack/">DDoS attacks</a> Cloudflare mitigated was an <a href="https://www.cloudflare.com/learning/ddos/what-is-an-ack-flood/">ACK Flood</a>, and over 66% of all L3/4 attacks were <a href="https://www.cloudflare.com/learning/ddos/glossary/tcp-ip/">TCP</a> based. Most types of DDoS attacks can be mitigated by finding unique characteristics that are present in all attack packets and using that to distinguish ‘good’ packets from the ‘bad’ ones. This is called "stateless" mitigation, because any packet that has these unique characteristics can simply be dropped without remembering any information (or "state") about the other packets that came before it. However, when attack packets have no unique characteristics, then "stateful" mitigation is required, because whether a certain packet is good or bad depends on the other packets that have come before it.</p><p>The most sophisticated types of TCP flood require stateful mitigation, where every TCP connection must be tracked in order to know whether any particular TCP packet is part of an active connection. That kind of mitigation is called "flow tracking", and it is typically implemented in Linux by the <a href="https://en.wikipedia.org/wiki/Iptables">iptables</a> conntrack module. However, DDoS protection with conntrack is not as simple as flipping the iptable switch, especially at the scale and complexity that Cloudflare operates in. If you're interested to learn more, in <a href="/conntrack-tales-one-thousand-and-one-flows/">this</a> blog we talk about the technical challenges of implementing iptables conntrack.</p><p>Complex TCP DDoS attacks pose a threat as they can be harder to detect and mitigate. They therefore have the potential to cause service degradation, outages and increased false positives with inaccurate mitigation rules. So how does Cloudflare block patternless DDoS attacks without affecting legitimate traffic?</p>
    <div>
      <h3>Bidirectional TCP Flow Tracking</h3>
      <a href="#bidirectional-tcp-flow-tracking">
        
      </a>
    </div>
    <p>Using Cloudflare's traditional products, HTTP applications can be protected by the <a href="https://www.cloudflare.com/waf/">WAF</a> service, and TCP/UDP applications can be protected by <a href="https://www.cloudflare.com/products/cloudflare-spectrum/">Spectrum</a>. These services are "<a href="https://www.cloudflare.com/learning/cdn/glossary/reverse-proxy/">reverse proxies</a>", meaning that traffic passes through Cloudflare in both directions. In this bidirectional topology, we see the entire TCP flow (i.e., segments sent by both the client and the server) and can therefore track the state of the underlying TCP connection. This way, we know if a TCP packet belongs to an existing flow or if it is an “out of state” TCP packet. Out of state TCP packets look just like regular TCP packets, but they don’t belong to any real connection between a client and a server. These packets are most likely part of an attack and are therefore dropped.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/190bHsEl8drp7r686sUlCi/04efd3f411afac52d87b9072c7f43f73/image2-4.png" />
            
            </figure><p><b>Reverse Proxy: What Cloudflare Sees</b></p><p>While not trivial, <a href="/conntrack-tales-one-thousand-and-one-flows/">tracking TCP</a> flows can be done when we serve as a proxy between the client and server, allowing us to absorb and mitigate out of state TCP floods. However it becomes <i>much</i> more challenging when we only see half of the connection: the ingress flow. This visibility into ingress but not egress flows is the default deployment method for Cloudflare’s Magic Transit service, so we had our work cut out for us in identifying out of state packets.</p>
    <div>
      <h3>The Challenge With Unidirectional TCP Flows</h3>
      <a href="#the-challenge-with-unidirectional-tcp-flows">
        
      </a>
    </div>
    <p>With Magic Transit, Cloudflare receives inbound internet traffic on behalf of the customer, scrubs DDoS attacks, and routes the clean traffic to the customer’s data center over a tunnel. The data center then responds directly to the eyeball client using a technique known as Direct Server Return (DSR).</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2sYZnV8m6FNZoMw0TQBxxZ/18566279daa78e35189982a018809526/image6.png" />
            
            </figure><p>Magic Transit: Asymmetric L3 Routing</p><p>Using DSR, when a TCP handshake is initiated by an eyeball client, it sends a SYN packet that gets routed via Cloudflare to the origin data center. The origin then responds with a SYN-ACK directly to the client, bypassing Cloudflare. Finally, the client responds with an ACK that once again routes to the origin via Cloudflare and the connection is then considered established.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4dPx4Zrjj0SAppPOL9Nx7v/ee17d72aceb74493eafd9197c4918dd9/image3-6.png" />
            
            </figure><p><b>L3 Routing: What Cloudflare Sees</b></p><p>In a unidirectional flow we don’t see the SYN+ACK sent from the origin to the eyeball client, and therefore can't utilize our existing flow tracking capabilities to identify out of state packets.</p>
    <div>
      <h3>Unidirectional TCP Flow Tracking</h3>
      <a href="#unidirectional-tcp-flow-tracking">
        
      </a>
    </div>
    <p>To overcome the challenges of unidirectional flows, we recently completed the development and rollout of a new system, codenamed flowtrackd (“flow tracking daemon”). flowtrackd is a state machine that hooks into the network interface. Using only the ingress traffic that routes through Cloudflare, flowtrackd determines whether to forward or drop each received TCP packet based on the state of its related connection.</p><p>The state machine that determines the state of the flows was developed in-house and complements Gatebot and dosd. Together Gatebot, dosd, and flowtrackd provide a comprehensive multi layer DDoS protection.</p>
    <div>
      <h3>Releasing flowtrackd to the Wild</h3>
      <a href="#releasing-flowtrackd-to-the-wild">
        
      </a>
    </div>
    <p>And it works! Less than a day after releasing flowtrackd to an early access customer, flowtrackd automatically detected and mitigated an ACK flood that peaked at 6 million packets per second. No downtime, service disruption, or false positives were reported.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3Ns2NsGj3FiUSTaIB55aSv/4e6ad11d086cd6d605e96897dcaecbe8/image4-2.png" />
            
            </figure><p>flowtrackd Mitigates 6M pps Flood</p>
    <div>
      <h3>Cloudflare’s DDoS Protection - Delivered From Every Data Center</h3>
      <a href="#cloudflares-ddos-protection-delivered-from-every-data-center">
        
      </a>
    </div>
    <p>As opposed to legacy scrubbing center providers with limited network infrastructures, Cloudflare provides DDoS Protection from every one of our data centers in over 200 locations around the world. We write our own software-defined DDoS protection systems. Notice I say system<b>s</b>, because as opposed to vendors that use a dedicated third party appliance, we’re able to write and spin up whatever software we need, deploy it in the optimal location in our tech stack and are therefore not dependent on other vendors or be limited to the capabilities of one appliance.</p><p>flowtrackd joins the Cloudflare DDoS protection family which includes our veteran <a href="/meet-gatebot-a-bot-that-allows-us-to-sleep/">Gatebot</a> and the younger and energetic <a href="/rolling-with-the-punches-shifting-attack-tactics-dropping-packets-faster-cheaper-at-the-edge/">dosd</a>. flowtrackd will be available from every one of our data centers, with a total mitigation capacity of over 37 Tbps, protecting our Magic Transit customers against the most complex TCP DDoS attacks.</p><p><b>New to Magic Transit?</b> Replace your legacy provider with Magic Transit and pay nothing until your current contract expires. Offer expires September 1, 2020. Click <a href="https://www.cloudflare.com/lp/better/">here</a> for details.</p> ]]></content:encoded>
            <category><![CDATA[DDoS]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[TCP]]></category>
            <category><![CDATA[Magic Transit]]></category>
            <category><![CDATA[Gatebot]]></category>
            <guid isPermaLink="false">36KNxycC03DZF9kgnwpwVb</guid>
            <dc:creator>Omer Yoachimik</dc:creator>
        </item>
        <item>
            <title><![CDATA[Mitigating a 754 Million PPS DDoS Attack Automatically]]></title>
            <link>https://blog.cloudflare.com/mitigating-a-754-million-pps-ddos-attack-automatically/</link>
            <pubDate>Thu, 09 Jul 2020 11:00:00 GMT</pubDate>
            <description><![CDATA[ On June 20, Cloudflare automatically mitigated a highly volumetric DDoS attack that peaked above 754 million packets per second. The attack was part of an organized four day campaign starting on June 18 and ending on June 21. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>On June 21, Cloudflare automatically mitigated a highly volumetric DDoS attack that peaked at 754 million packets per second. The attack was part of an organized four day campaign starting on June 18 and ending on June 21: attack traffic was sent from over 316,000 IP addresses towards a single Cloudflare IP address that was mostly used for websites on our <a href="https://www.cloudflare.com/plans/free/">Free plan</a>. No downtime or service degradation was reported during the attack, and no charges accrued to customers due to our <a href="/unmetered-mitigation/">unmetered mitigation guarantee</a>.</p><p>The attack was detected and handled automatically by <a href="/meet-gatebot-a-bot-that-allows-us-to-sleep/">Gatebot</a>, our global DDoS detection and mitigation system without any manual intervention by our teams. Notably, because our automated systems were able to mitigate the attack without issue, no alerts or pages were sent to our on-call teams and no humans were involved at all.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5n37ZlU9nwh2KGUW5Hwctl/d1ec160e2ac256b5ededf7e4eff6842f/image2-3.png" />
            
            </figure><p>Attack Snapshot - Peaking at 754 Mpps. The two different colors in the graph represent two separate systems dropping packets. </p><p>During those four days, the attack utilized a combination of three attack vectors over the <a href="https://www.cloudflare.com/learning/ddos/glossary/tcp-ip/">TCP</a> protocol: <a href="https://www.cloudflare.com/learning/ddos/syn-flood-ddos-attack/">SYN floods</a>, <a href="https://www.cloudflare.com/learning/ddos/what-is-an-ack-flood/">ACK floods</a> and SYN-ACK floods. The attack campaign sustained for multiple hours at rates exceeding 400-600 million packets per second and peaked multiple times above 700 million packets per second, with a top peak of 754 million packets per second. Despite the high and sustained packet rates, our edge continued serving our customers during the attack without impacting performance at all</p>
    <div>
      <h3>The Three Types of DDoS: Bits, Packets &amp; Requests</h3>
      <a href="#the-three-types-of-ddos-bits-packets-requests">
        
      </a>
    </div>
    <p>Attacks with high bits per second rates aim to saturate the Internet link by sending more bandwidth per second than the link can handle. Mitigating a bit-intensive flood is similar to a dam blocking gushing water in a canal with limited capacity, allowing just a portion through.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4c5HPaNGni1tyvuJx67mnk/bbe3d855e355eded524119e6c82d1dab/GBPS-river--copy_2x.png" />
            
            </figure><p>Bit Intensive DDoS Attacks as a Gushing River Blocked By Gatebot</p><p>In such cases, the Internet service provider may block or throttle the traffic above the allowance resulting in denial of service for legitimate users that are trying to connect to the website but are blocked by the service provider. In other cases, the link is simply saturated and everything behind that connection is offline.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5HRDL05jkCa9jJfvbbPfe3/a61b1019bab1fcf7cf7b8b040ec3b72a/MBPS-Mosquitos.png" />
            
            </figure><p>Swarm of Mosquitoes as a Packet Intensive DDoS Attack</p><p>However in this DDoS campaign, the attack peaked at a mere 250 Gbps (I say, mere, but ¼ Tbps is enough to knock pretty much anything offline if it isn’t behind some DDoS mitigation service) so it does not seem as the attacker intended to saturate our Internet links, perhaps because they know that our global capacity exceeds 37 Tbps. Instead, it appears the attacker attempted (and failed) to overwhelm our routers and data center appliances with high packet rates reaching 754 million packets per second. As opposed to water rushing towards a dam, flood of packets can be thought of as a swarm of millions of mosquitoes that you need to zap one by one.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2CT7G4c2uLASjHOw6GWuXM/00e5c2ec980ffcd802a5a38b8bcd4932/gatebot-zapper_2x.png" />
            
            </figure><p>Zapping Mosquitoes with Gatebot</p><p>Depending on the ‘weakest link’ in a data center, a packet intensive DDoS attack may impact the routers, switches, web servers, firewalls, DDoS mitigation devices or any other appliance that is used in-line. Typically, a high packet rate may cause the memory buffer to overflow and thus voiding the router’s ability to process additional packets. This is because there’s a small fixed CPU cost of handing each packet and so if you can send a lot of small packets you can block an Internet connection not by filling it but by causing the hardware that handles the connection to be overwhelmed with processing.</p><p>Another form of DDoS attack is one with a high HTTP request per second rate. An HTTP request intensive DDoS attack aims to overwhelm a web server’s resources with more HTTP requests per second than the server can handle. The goal of a DDoS attack with a high request per second rate is to max out the CPU and memory utilization of the server in order to crash it or prevent it from being able to respond to legitimate requests. Request intensive DDoS attacks allow the attacker to generate much less bandwidth, as opposed to bit intensive attacks, and still cause a denial of service.</p>
    <div>
      <h3>Automated DDoS Detection &amp; Mitigation</h3>
      <a href="#automated-ddos-detection-mitigation">
        
      </a>
    </div>
    <p>So how did we handle 754 million packets per second? First, Cloudflare’s network utilizes BGP Anycast to spread attack traffic globally across our fleet of data centers. Second, we built our own <a href="https://www.cloudflare.com/ddos/">DDoS protection</a> systems, Gatebot and dosd, which <a href="/l4drop-xdp-ebpf-based-ddos-mitigations/">drop packets inside the Linux kernel</a> for maximum efficiency in order to handle massive floods of packets. And third, we built our own L4 load-balancer, Unimog, which uses our appliances' health and other various metrics to load-balance traffic intelligently within a data center.</p><p>In 2017, we published a blog introducing Gatebot, one of our two DDoS protection systems. The blog was titled <a href="/meet-gatebot-a-bot-that-allows-us-to-sleep/">Meet Gatebot - a bot that allows us to sleep</a>, and that’s exactly what happened during this attack. The <a href="https://www.cloudflare.com/learning/security/what-is-an-attack-surface/">attack surface</a> was spread out globally by our Anycast, then Gatebot detected and mitigated the attack automatically without human intervention. And traffic inside each datacenter was load-balanced intelligently to avoid overwhelming any one machine. And as promised in the blog title, the attack peak did in fact occur while our London team was asleep.</p><p>So how does Gatebot work? Gatebot asynchronously samples traffic from every one of our data centers in over 200 locations around the world. It also monitors our <a href="/rolling-with-the-punches-shifting-attack-tactics-dropping-packets-faster-cheaper-at-the-edge/">customers’ origin server health</a>. It then analyzes the samples to identify patterns and traffic anomalies that can indicate attacks. Once an attack is detected, Gatebot sends mitigation instructions to the edge data centers.</p><p>To complement Gatebot, last year we released a new system codenamed dosd (denial of service daemon) which runs in every one of our data centers around the world in over 200 cities. Similarly to Gatebot, dosd detects and mitigates attacks autonomously but in the scope of a single server or data center. You can read more about dosd in our <a href="/rolling-with-the-punches-shifting-attack-tactics-dropping-packets-faster-cheaper-at-the-edge/">recent blog</a>.</p>
    <div>
      <h3>The DDoS Landscape</h3>
      <a href="#the-ddos-landscape">
        
      </a>
    </div>
    <p>While in recent months we’ve observed a <a href="/network-layer-ddos-attack-trends-for-q1-2020/">decrease in the size and duration of DDoS attacks</a>, highly volumetric and globally distributed DDoS attacks such as this one still persist. Regardless of the size, type or sophistication of the attack, Cloudflare offers <a href="/unmetered-mitigation/">unmetered DDoS protection</a> to all customers and plan levels—including the Free plans.</p> ]]></content:encoded>
            <category><![CDATA[DDoS]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Gatebot]]></category>
            <category><![CDATA[Attacks]]></category>
            <category><![CDATA[SYN]]></category>
            <guid isPermaLink="false">4PrPrO1u2DnN6fu86Hbko9</guid>
            <dc:creator>Omer Yoachimik</dc:creator>
        </item>
        <item>
            <title><![CDATA[Today we mitigated 1.1.1.1]]></title>
            <link>https://blog.cloudflare.com/today-we-mitigated-1-1-1-1/</link>
            <pubDate>Fri, 01 Jun 2018 01:13:53 GMT</pubDate>
            <description><![CDATA[ Cloudflare is protected from attacks by the Gatebot DDoS mitigation pipeline. Gatebot performs hundreds of mitigations a day, shielding our infrastructure and our customers from L3 and L7 attacks.  ]]></description>
            <content:encoded><![CDATA[ <p>On May 31, 2018 we had a 17 minute outage on our 1.1.1.1 resolver service; this was our doing and not the result of an attack.</p><p>Cloudflare is protected from attacks by the Gatebot DDoS mitigation pipeline. Gatebot performs hundreds of mitigations a day, shielding our infrastructure and our customers from L3/L4 and L7 attacks. Here is a chart of a count of daily Gatebot actions this year:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4afmhlOoruRjYpiDVEnb6L/1c58c4fab1a06fd06f61b9bbc6a62ee5/gatebot-stats.png" />
            
            </figure><p>In the past, we have blogged about our systems:</p><ul><li><p><a href="/meet-gatebot-a-bot-that-allows-us-to-sleep/">Meet Gatebot, a bot that allows us to sleep</a></p></li></ul><p>Today, things didn't go as planned.</p>
    <div>
      <h3>Gatebot</h3>
      <a href="#gatebot">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6pW1whDtkORpQAEePgmHo/63c2705e59c6eca69a413b190604b955/gatebot-parts.png" />
            
            </figure><p>Cloudflare’s network is large, handles many different types of traffic and mitigates different types of known and not-yet-seen attacks. The Gatebot pipeline manages this complexity in three separate stages:</p><ul><li><p><i>attack detection</i> - collects live traffic measurements across the globe and detects attacks</p></li><li><p><i>reactive automation</i> - chooses appropriate mitigations</p></li><li><p><i>mitigations</i> - executes mitigation logic on the edge</p></li></ul><p>The benign-sounding "reactive automation" part is actually the most complicated stage in the pipeline. We expected that from the start, which is why we implemented this stage using a custom <a href="https://en.wikipedia.org/wiki/Functional_reactive_programming">Functional Reactive Programming (FRP)</a> framework. If you want to know more about it, see <a href="https://idea.popcount.org/2016-02-01-enigma---building-a-dos-mitigation-pipeline/">the talk</a> and <a href="https://speakerdeck.com/majek04/gatelogic-somewhat-functional-reactive-framework-in-python">the presentation</a>.</p><p>Our mitigation logic often combines multiple inputs from different internal systems, to come up with the best, most appropriate mitigation. One of the most important inputs is the metadata about our IP address allocations: we mitigate attacks hitting HTTP and DNS IP ranges differently. Our FRP framework allows us to express this in clear and readable code. For example, this is part of the code responsible for performing DNS attack mitigation:</p>
            <pre><code>def action_gk_dns(...):

    [...]

    if port != 53:
        return None

    if whitelisted_ip.get(ip):
        return None

    if ip not in ANYCAST_IPS:
        return None
        [...] </code></pre>
            <p>It's the last check in this code that we tried to improve today.</p><p>Clearly, the code above is a huge oversimplification of all that goes into attack mitigation, but making an early decision about whether the attacked IP serves DNS traffic or not is important. It's that check that went wrong today. If the IP does serve DNS traffic then attack mitigation is handled differently from IPs that never serve DNS.</p>
    <div>
      <h3>Cloudflare is growing, so must Gatebot</h3>
      <a href="#cloudflare-is-growing-so-must-gatebot">
        
      </a>
    </div>
    <p>Gatebot was created in early 2015. Three years may not sound like much time, but since then we've grown dramatically and added layers of services to our software stack. Many of the internal integration points that we rely on today didn't exist then.</p><p>One of them is what we call the <i>Provision API</i>. When Gatebot sees an IP address, it needs to be able to figure out whether or not it’s one of Cloudflare’s addresses. <i>Provision API</i> is a simple RESTful API used to provide this kind of information.</p><p>This is a relatively new API, and prior to its existence, Gatebot had to figure out which IP addresses were Cloudflare addresses by reading a list of networks from a hard-coded file. In the code snippet above, the <i>ANYCAST_IPS</i> variable is populated using this file.</p>
    <div>
      <h3>Things went wrong</h3>
      <a href="#things-went-wrong">
        
      </a>
    </div>
    <p>Today, in an effort to reclaim some technical debt, we deployed new code that introduced Gatebot to <i>Provision API</i>.</p><p>What we did not account for, and what <i>Provision API</i> didn’t know about, was that <a href="/dns-resolver-1-1-1-1/">1.1.1.0/24 and 1.0.0.0/24</a> are special IP ranges. Frankly speaking, almost every IP range is "special" for one reason or another, since our IP configuration is rather complex. But our recursive DNS resolver ranges are even more special: they are relatively new, and we're using them in a very unique way. Our hardcoded list of Cloudflare addresses contained a manual exception specifically for these ranges.</p><p>As you might be able to guess by now, we didn't implement this manual exception while we were doing the integration work. Remember, the whole idea of the fix was to remove the hardcoded gotchas!</p>
    <div>
      <h3>Impact</h3>
      <a href="#impact">
        
      </a>
    </div>
    <p>The effect was that, after pushing the new code release, our systems interpreted the resolver traffic as an attack. The automatic systems deployed DNS mitigations for our DNS resolver IP ranges for 17 minutes, between 17:58 and 18:13 May 31st UTC. This caused 1.1.1.1 DNS resolver to be globally inaccessible.</p>
    <div>
      <h3>Lessons Learned</h3>
      <a href="#lessons-learned">
        
      </a>
    </div>
    <p>While Gatebot, the DDoS mitigation system, has great power, we failed to test the changes thoroughly. We are using today’s incident to improve our internal systems.</p><p>Our team is incredibly proud of 1.1.1.1 and Gatebot, but today we fell short. We want to apologize to all of our customers. We will use today’s incident to improve. The next time we mitigate 1.1.1.1 traffic, we will make sure there is a legitimate attack hitting us.</p> ]]></content:encoded>
            <category><![CDATA[Reliability]]></category>
            <category><![CDATA[Post Mortem]]></category>
            <category><![CDATA[Mitigation]]></category>
            <category><![CDATA[1.1.1.1]]></category>
            <category><![CDATA[DNS]]></category>
            <category><![CDATA[Resolver]]></category>
            <category><![CDATA[Gatebot]]></category>
            <guid isPermaLink="false">6ZUfF0dLtSHFE2WWfwpgLJ</guid>
            <dc:creator>Marek Majkowski</dc:creator>
        </item>
        <item>
            <title><![CDATA[TLS 1.3 is going to save us all, and other reasons why IoT is still insecure]]></title>
            <link>https://blog.cloudflare.com/why-iot-is-insecure/</link>
            <pubDate>Sun, 24 Dec 2017 16:57:44 GMT</pubDate>
            <description><![CDATA[ As I’m writing this, four DDoS attacks are ongoing and being automatically mitigated by Gatebot. Cloudflare’s job is to get attacked. Our network gets attacked constantly. ]]></description>
            <content:encoded><![CDATA[ <p>As I’m writing this, four DDoS attacks are ongoing and being automatically mitigated by <a href="/meet-gatebot-a-bot-that-allows-us-to-sleep/">Gatebot</a>. Cloudflare’s job is to get attacked. Our network gets attacked constantly.</p><p>Around the fall of 2016, we started seeing DDoS attacks that looked a little <a href="/say-cheese-a-snapshot-of-the-massive-ddos-attacks-coming-from-iot-cameras/">different than usual</a>. One attack we saw around that time had traffic coming from 52,467 unique IP addresses. The clients weren’t servers or desktop computers; when we tried to connect to the clients over port 80, we got the login pages to CCTV cameras.</p><p>Obviously it’s important to lock down IoT devices so that they can’t be co-opted into evil botnet armies, but when we talk to some IoT developers, we hear a few concerning security patterns. We’ll dive into two problematic areas and their solutions: software updates and TLS.</p>
    <div>
      <h3>The Trouble With Updates</h3>
      <a href="#the-trouble-with-updates">
        
      </a>
    </div>
    <p>With PCs, the end user is ultimately responsible for securing their devices. People understand that they need to update their computers and phones. <a href="https://www.macrumors.com/2017/01/05/ios-10-installed-on-76-percent-of-ios-devices/">Just 4 months after Apple released iOS 10, it was installed on 76% of active devices</a>.</p><p>People just don’t know that they are supposed to update IoT <i>things</i> like they are supposed to update their computers because they’ve never had to update things in the past. My parents are never going to install a software update for their thermometer.</p><p>And the problem gets worse over time. The longer a device stays on an older software version, the less likely it will be compatible with the newer version. At some point, an update may not be possible anymore. This is a very real concern as the shelf life of a connected thing can be 10 years in the case of a kitchen appliance - have you ever bought a refrigerator?</p><p>This is if the device can be patched at all. First, devices that are low battery are programmed not to receive updates because it’s too draining on the battery. Second, IoT devices are too lightweight to run a full operating system, they run just a compiled binary on firmware which means there’s a limit to the code that can later be pushed to it. Some devices cannot receive specific patches.</p><p>The other thing we hear about updates from IoT developers is that often they are afraid to push a new update because it could mean breaking hundreds of thousands of devices at once.</p><p>All this may not seem like a big deal - ok, so a toaster can get hacked, so what - but two very real things are at stake. First, every device that’s an easy target makes it easier to make other applications a target. Second, once someone is sitting on a device, they are in your network, which can put at stake any traffic sent over the wire.</p><p>The security model that worked for PC doesn’t work for IoT — the end user can’t be responsible, and patching isn’t reliable. We need something else. What’s the solution?</p><p>Traffic to an IoT device passes through many different networks: the transit provider from the application server, the <a href="https://www.cloudflare.com/learning/cdn/what-is-a-cdn/">content delivery network</a> used to deliver device traffic, the ISP to the building where the device sits.</p><p>It is at those network layers that protection can be added. As IoT device traffic moves through these networks, packets can be filtered to only let in good traffic. Even if a device is running vulnerable code, filters added in the network level can keep hackers out.</p>
    <div>
      <h3>The Trouble With TLS</h3>
      <a href="#the-trouble-with-tls">
        
      </a>
    </div>
    <p>TLS is used in two ways in IoT devices: First, TLS is used to encrypt data in transit. This is used for data privacy and to make it harder to reverse engineer the communications used by the device. Second, devices store client <a href="https://www.cloudflare.com/application-services/products/ssl/">TLS certificates</a> that are used to authenticate the devices to the application - makes it one step harder to fake a device.</p><p>There are three problems developers run into when they want to implement TLS in IoT. The first is that while IoT traffic needs to be quick and lightweight, TLS adds an additional two round trips to the start of every session. The second is that certificates can be large files, and device memory is limited in IoT. And the third is that some of the protocols that are being developed for IoT are plaintext by default.</p>
    <div>
      <h3>TLS Isn’t Lightweight</h3>
      <a href="#tls-isnt-lightweight">
        
      </a>
    </div>
    <p>IoT devices run on low power chips. An IoT device may only have 256 or 512 KB of RAM and often need to conserve battery. They send and receive lots of small information constantly. Imagine an internet connected wind sensor - it measures wind speed and every 30 seconds, sends the new wind speed to the application server. It’s just a few bytes of data it needs to get over the wire and it wants to be able to do so without as much overhead as possible to conserve RAM and battery life.</p><p>Here’s an HTTP POST to do that:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/10XN1xsCbML3sq6IUtHQlk/dd09f91c6593270de299f38e9490caad/Screen-Shot-2017-12-23-at-8.39.11-PM.png" />
            
            </figure><p>But let’s say the same device is going to use TLS. Here’s what the same POST looks like with the TLS handshake — this is with TLS 1.2:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4XYspSKePX6SnuugQdO58g/89efbf761a75c8a90df6d4627dc5439d/Screen-Shot-2017-12-23-at-8.40.00-PM.png" />
            
            </figure><p>Depending on distance between the device and the application server and the latency of the server, this can be hundreds of milliseconds added. The solution is likely the newest version of TLS, TLS 1.3.</p><p>TLS 1.3 eliminates a complete round trip in the TLS handshake, which makes TLS much lighter and faster. It cuts the number of round trips in the handshake by half by predicting what key agreement protocol and algorithm the server will decide to use and sends those guessed parameters and the key share directly in the client hello. And if the server likes that, it sends back its own key share for the same algorithm, and the whole handshake is done.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2LB8N0MKT0QFOFfZL3S91v/240f1a0436802f14c6c736f558b5f9f6/Screen-Shot-2017-12-23-at-8.50.04-PM.png" />
            
            </figure><p>If the same IoT device talks to the same server again, there’s actually <a href="/introducing-0-rtt/">no round trip at all</a>. The parameters chosen in the initial handshake are sent alongside application data in the first packet.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2BVBCXVFfkOtvxxvXO0M1Y/1b850b51f228b6d70540a4fbea3f3aa8/Screen-Shot-2017-12-24-at-8.23.08-AM.png" />
            
            </figure><p>Why isn’t every IoT device using 1.3 today? TLS 1.3 is still actively being developed in the IETF standards track and while Chrome as of version 56 in January and Firefox as of version 52 in March support 1.3, not everything does. The biggest problem today are middleboxes that are used by ISP’s and enterprises that panic when they see a 1.3 handshake and close the connection. This also happened when the world was upgrading to TLS 1.2 and middleboxes only understood TLS 1.1, so it’s just a matter of time.</p>
    <div>
      <h3>TLS Certificate Size</h3>
      <a href="#tls-certificate-size">
        
      </a>
    </div>
    <p>In a TLS handshake, the server can use a server-side TLS certificate to authenticate itself to the client, and the client can use a client-side certificate to authenticate itself to the server. Devices often store certificates to authenticate themselves to the application server. However, device memory is often limited in IoT, and certificates can be large. What can we do?</p><p>Most certificates today use the RSA algorithm, which has been around since the 70’s. The certificates are large because the keys in RSA to be secure need to be large - either 1,024 to 2,048 bytes, however, a newer algorithm using elliptic curve cryptography has been in wide use since the early 2000’s that can solve this problem. With elliptic curve cryptography we can use smaller keys with the same level of security as a larger RSA key and save space on the device.</p>
    <div>
      <h3>Default Plaintext IoT Protocols</h3>
      <a href="#default-plaintext-iot-protocols">
        
      </a>
    </div>
    <p>IoT devices need to be lightweight so two emerging protocols are replacing HTTP as the dominant transfer protocol for some IoT devices: MQTT and CoAP.</p><p>MQTT is a pub/sub protocol that has been around almost 20 years. In MQTT, a proxy server acts as a broker. An IoT device or web app publishes a message to the broker, and the broker distributes those messages to all the other IoT devices that need to receive that message.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/E4huJmd0Qc5gRa4N5kuxH/1116aa56a7893b95bd62909c577d525b/Screen-Shot-2017-12-23-at-8.52.51-PM.png" />
            
            </figure><p>When MQTT was written almost 20 years ago, it was written without security by intention. It was written for oil and gas companies and they were just sending sensor data and no one thought it needed to be encrypted.</p><p>CoAP was standardized just three years ago. It has all the same methods as HTTP, but it’s over UDP so it’s really light.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2PLPc3UEGFJ8RVGsEWpGpk/e073dc56e23e24c449aa96f97e1f9fa8/Screen-Shot-2017-12-23-at-8.53.03-PM.png" />
            
            </figure><p>The problem is, if you want to add TLS (DTLS really because CoAP is over UDP), it no longer is light anymore.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7Ih9SbeRbtRJk4OqCZGXgx/698e1d764c758df0cebcd832c5aefa63/Screen-Shot-2017-12-23-at-8.53.41-PM.png" />
            
            </figure>
    <div>
      <h3>The Future</h3>
      <a href="#the-future">
        
      </a>
    </div>
    <p>It will be quite interesting to see how update mechanisms and TLS implementations change as the number of deployed IoT devices continues to grow. If this type of thing interests you, <a href="https://www.cloudflare.com/careers/">come join us</a>.</p> ]]></content:encoded>
            <category><![CDATA[IoT]]></category>
            <category><![CDATA[TLS 1.3]]></category>
            <category><![CDATA[TLS]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Gatebot]]></category>
            <category><![CDATA[DDoS]]></category>
            <category><![CDATA[Cryptography]]></category>
            <guid isPermaLink="false">3u3LeCl6VoYIZx3NbtHAa0</guid>
            <dc:creator>Dani Grant</dc:creator>
        </item>
        <item>
            <title><![CDATA[Meet Gatebot - a bot that allows us to sleep]]></title>
            <link>https://blog.cloudflare.com/meet-gatebot-a-bot-that-allows-us-to-sleep/</link>
            <pubDate>Mon, 25 Sep 2017 13:00:30 GMT</pubDate>
            <description><![CDATA[ In the past, we’ve spoken about how Cloudflare is architected to sustain the largest DDoS attacks. During traffic surges we spread the traffic across a very large number of edge servers.  ]]></description>
            <content:encoded><![CDATA[ <p>In the past, we’ve spoken about how <a href="/how-cloudflares-architecture-allows-us-to-scale-to-stop-the-largest-attacks/">Cloudflare is architected to sustain the largest DDoS attacks</a>. During traffic surges we spread the traffic across a very large number of edge servers. This architecture allows us to avoid having a single choke point because the traffic gets distributed externally across multiple datacenters and internally across multiple servers. We do that by employing Anycast and ECMP.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/52cb3pH0qnYZoAFRwCILPu/c195045b834c4be87d338318def95590/gatebot-3.jpg" />
            
            </figure><p>We don't use separate scrubbing boxes or specialized hardware - every one of our edge servers can perform advanced traffic filtering if the need arises. This allows us to scale up our DDoS capacity as we grow. Each of the new servers we add to our datacenters increases our maximum theoretical DDoS “scrubbing” power. It also scales down nicely - in smaller datacenters we don't have to overinvest in expensive dedicated hardware.</p><p>During normal operations our attitude to attacks is rather pragmatic. Since the inbound traffic is distributed across hundreds of servers we can survive periodic spikes and small attacks without doing anything. Vanilla Linux is remarkably resilient against unexpected network events. This is especially true since kernel 4.4 when <a href="https://lwn.net/Articles/659199/">the performance of SYN cookies was greatly improved</a>.</p><p>But at some point, malicious traffic volume can become so large that we must take the load off the networking stack. We have to minimize the amount of CPU spent on dealing with attack packets. Cloudflare operates a multi-tenant service and we must always have enough processing power to serve valid traffic. We can't afford to starve our HTTP proxy (nginx) or custom DNS server (named RRDNS, written in Go) of CPU. When the attack size crosses a predefined threshold (which varies greatly depending on specific attack type), we must intervene.</p>
    <div>
      <h3>Mitigations</h3>
      <a href="#mitigations">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3WIjf8ScvlEu9XR2E1qS4a/2da9a0fa8e7dafceb1c70938adf33bb2/Screen-Shot-2017-09-25-at-11.21.11-AM.png" />
            
            </figure><p>During large attacks we deploy mitigations to reduce the CPU consumed by malicious traffic. We have multiple layers of defense, each tuned to specific attack vector.</p><p>First, there is “scattering”. Since we control DNS resolution we are able to move the domains we serve between IP addresses (we call this "scattering"). This is an effective technique as long as the attacks don’t follow the updated DNS resolutions. This often happens for L3 attacks where the attacker has hardcoded the IP address of the target.</p><p>Next, there is a wide range of mitigation techniques that leverage iptables, the firewall built in to the Linux kernel. But we don't use it like a conventional firewall, with a static set of rules. We continuously add, tweak and remove rules, based on specific attack characteristics. Over the years we have mastered the most effective iptables extensions:</p><ul><li><p>xt_bpf</p></li><li><p>ipsets</p></li><li><p>hashlimits</p></li><li><p>connlimit</p></li></ul><p>To make the most of iptables, we built a system to manage the iptables configuration across our entire fleet, allowing us to rapidly deploy rules everywhere. This fits our architecture nicely: due to Anycast, an attack against a single IP will be delivered to multiple locations. Running iptables rules for that IP on all servers makes sense.</p><p>Using stock iptables gives us plenty of confidence. When possible we prefer to use off-the-shelf tools to deal with attacks.</p><p>Sometimes though, even this is not sufficient. Iptables is fast in the general case, but has its limits. During very large attacks, exceeding 1M packets per second per server, we shift the attack traffic from kernel iptables to a kernel bypass user space program (which we call floodgate). We use a <a href="/kernel-bypass/">partial kernel bypass</a> solution using Solarflare EF_VI interface. With this on each server we can process more than 5M attack packets per second while consuming only a single CPU core. With floodgate we have comfortable amount of CPU left for our applications, even during the largest network events.</p><p>Finally, there are a number of tweaks we can make on at the HTTP layer. For specific attacks we disable HTTP Keep-Alives forcing attackers to re-establish TCP sessions for each request. This sacrifices a bit of performance for valid traffic as well, but is a surprisingly powerful tool throttling many attacks. For other attack patterns we turn the “I’m under attack” mode on, forcing the attack to hit our JavaScript challenge page.</p>
    <div>
      <h3>Manual attack handling</h3>
      <a href="#manual-attack-handling">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5JkPhtefpkMJhVoCdOB6Qu/a6b2729f532ee2aea60e8b4c302b9d15/cloudflare_outage.png.scaled500.png" />
            
            </figure><p>Early on these mitigations were applied manually by our tireless System Reliability Engineers (SRE's). Unfortunately, it turns out that humans under stress... well, make mistakes. We learned it the hard way - one of the most famous incidents happened in <a href="/todays-outage-post-mortem-82515/">March 2013 when a simple typo</a> brought our whole network down.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3OtDHft56O7PHCALmswJoY/12605f0ab862bc99291977400fd47a1e/Screen-Shot-2017-09-25-at-11.19.11-AM.png" />
            
            </figure><p>Humans are also not great at applying precise rules. As our systems grew and mitigations became more complex, having many specific toggles, our SREs got overwhelmed by the details. It was challenging to present all the specific information about the attack to the operator. We often applied overly-broad mitigations, which were unnecessarily affecting legitimate traffic. All that changed with the introduction of Gatebot.</p>
    <div>
      <h3>Meet Gatebot</h3>
      <a href="#meet-gatebot">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7nri9vLoPsgtq19T6dHxf/0f9bf6c60d0bbe08b573491353a1211b/Screen-Shot-2017-09-25-at-11.19.31-AM.png" />
            
            </figure><p>To aid our SREs we developed a fully automatic mitigation system. We call it Gatebot<a href="#fn1">[1]</a>.</p><p>The main goal of Gatebot was to automate as much of the mitigation workflow as possible. That means: to observe the network and note the anomalies, understand the targets of attacks and their metadata (such as the type of customer involved), and perform appropriate mitigation action.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/53NqKtsdEEISOc07d2wRZL/4a90e0727ee78f72c9cbc4bb535520da/Screen-Shot-2017-09-25-at-11.20.22-AM.png" />
            
            </figure><p>Nowadays we have multiple Gatebot instances - we call them “mitigation pipelines”. Each pipeline has three parts:</p><ol><li><p>“attack detection” or “signal” - A dedicated system detects anomalies in network traffic. This is usually done by sampling a small fraction of the network packets hitting our network, and analyzing them using streaming algorithms. With this we have a real-time view of the current status of the network. This part of the stack is written in Golang, and even though it only examines the sampled packets, it's pretty CPU intensive. It might comfort you to know that at this very moment two big Xeon servers burn all of their combined 48 Skylake CPU cores toiling away counting packets and performing sophisticated analytics looking for attacks.</p></li><li><p>“reactive automation” or “business logic”. For each anomaly (attack) we see who the target is, can we mitigate it, and with what parameters. Depending on the specific pipeline, the business logic may be anything from a trivial procedure to a multi-step process requiring a number of database lookups and potentially confirmation from a human operator. This code is not performance critical and is written in Python. To make it more accessible and readable by others in company, we developed a simple functional, reactive programming engine. It helps us to keep the code clean and understandable, even as we add more steps, more pipelines and more complex logic. To give you a flavor of the complexity: imagine how the system should behave if a customer upgraded a plan during an attack.</p></li><li><p>“mitigation”. The previous step feeds specific mitigation instructions into the centralized mitigation management systems. The mitigations are deployed across the world to our servers, applications, customer settings and, in some cases, to the network hardware.</p></li></ol>
    <div>
      <h3>Sleeping at night</h3>
      <a href="#sleeping-at-night">
        
      </a>
    </div>
    <p>Gatebot operates constantly, without breaks for lunch. For the iptables mitigations pipelines alone, Gatebot got engaged between 30 and 1500 times a day. Here is a chart of mitigations per day over last 6 months:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2Gb8UBopCCuM9zdrBlVeic/39a7f9453e82e719272573c35143f316/attacks-iptables.png" />
            
            </figure><p>Gatebot is much faster and much more precise than even our most experienced SREs. Without Gatebot we wouldn’t be able to operate our service with the appropriate level of confidence. Furthermore, Gatebot has proved to be remarkably adaptable - we started by automating handling of Layer 3 attacks, but soon we proved that the general model works well for automating other things. Today we have more than 10 separate Gatebot instances doing everything from mitigating Layer 7 attacks to informing our Customer Support team of misbehaving customer origin servers.</p><p>Since Gatebot’s inception we learned greatly from the "detection / logic / mitigation" workflow. We reused this model in our <a href="/the-internet-is-hostile-building-a-more-resilient-network/">Automatic Network System</a> which is used to relieve network congestion<a href="#fn2">[2]</a>.</p><p>Gatebot allows us to protect our users no matter of the plan. Whether you are a on a Free, Pro, Business or Enterprise plan, Gatebot is working for you. This is why we can afford to provide the same level of DDoS protection for all our customers<a href="#fn3">[3]</a>.</p><hr /><p><i>Dealing with attacks sound interesting? Join our </i><a href="https://boards.greenhouse.io/cloudflare/jobs/589572"><i>world famous DDoS team</i></a><i> in London, Austin, San Francisco and our elite office in Warsaw, Poland</i>.</p><hr /><hr /><ol><li><p>Fun fact: all our components in this area are called “gate-something”, like: gatekeeper, gatesetter, floodgate, gatewatcher, gateman... Who said that naming things must be hard? <a href="#fnref1">↩︎</a></p></li><li><p>Some of us have argued that this system should be called Netbot. <a href="#fnref2">↩︎</a></p></li><li><p>Note: there are caveats. Ask your Success Engineer for specifics! <a href="#fnref3">↩︎</a></p></li></ol> ]]></content:encoded>
            <category><![CDATA[DDoS]]></category>
            <category><![CDATA[Mitigation]]></category>
            <category><![CDATA[Reliability]]></category>
            <category><![CDATA[Birthday Week]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Attacks]]></category>
            <category><![CDATA[Gatebot]]></category>
            <guid isPermaLink="false">2L5aTRvTEqUKS0ayXhKqk1</guid>
            <dc:creator>Marek Majkowski</dc:creator>
        </item>
    </channel>
</rss>