<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHP Worms: Santy / Perl.PhpInclude &#8211; ModSecurity</title>
	<atom:link href="http://www.sitepoint.com/blogs/2004/12/27/php-worms-santy-perlphpinclude-modsecurity/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sitepoint.com/blogs/2004/12/27/php-worms-santy-perlphpinclude-modsecurity/</link>
	<description>News, opinion, and fresh thinking for web developers and designers. The official podcast of sitepoint.com.</description>
	<lastBuildDate>Sun, 22 Nov 2009 11:54:05 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: nathanj</title>
		<link>http://www.sitepoint.com/blogs/2004/12/27/php-worms-santy-perlphpinclude-modsecurity/comment-page-1/#comment-1637</link>
		<dc:creator>nathanj</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">139107243#comment-1637</guid>
		<description>&lt;p&gt;Thanks for the heads up. I notice this script on a exploit site today. :S&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>Thanks for the heads up. I notice this script on a exploit site today. :S</p>]]></content:encoded>
	</item>
	<item>
		<title>By: evolve</title>
		<link>http://www.sitepoint.com/blogs/2004/12/27/php-worms-santy-perlphpinclude-modsecurity/comment-page-1/#comment-1638</link>
		<dc:creator>evolve</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">139107243#comment-1638</guid>
		<description>&lt;p&gt;ModSecurity is really key for webhosts who use apache to have.&lt;/p&gt;

&lt;p&gt;Google also helped the spread of the Santy worm by preventing its search engine for being used to find websites to attack.  They blacklisted a number of keywords which the worm was using to find targets.&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>ModSecurity is really key for webhosts who use apache to have.</p>
<p>Google also helped the spread of the Santy worm by preventing its search engine for being used to find websites to attack.  They blacklisted a number of keywords which the worm was using to find targets.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: trigger</title>
		<link>http://www.sitepoint.com/blogs/2004/12/27/php-worms-santy-perlphpinclude-modsecurity/comment-page-1/#comment-1639</link>
		<dc:creator>trigger</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">139107243#comment-1639</guid>
		<description>&lt;p&gt;so,its only a phpBB thing? just wondering what the exploit is, or if there&#039;s a function in specific they are using. got +10K visitors over X-Mas Weekend, which is a little unusual, but my site isn&#039;t defaced (yet).&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>so,its only a phpBB thing? just wondering what the exploit is, or if there&#8217;s a function in specific they are using. got +10K visitors over X-Mas Weekend, which is a little unusual, but my site isn&#8217;t defaced (yet).</p>]]></content:encoded>
	</item>
	<item>
		<title>By: HarryF</title>
		<link>http://www.sitepoint.com/blogs/2004/12/27/php-worms-santy-perlphpinclude-modsecurity/comment-page-1/#comment-1640</link>
		<dc:creator>HarryF</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">139107243#comment-1640</guid>
		<description>&lt;p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;br /&gt;
so,its only a phpBB thing?&lt;br /&gt;
&lt;/p&gt;&lt;/blockquote&gt;&lt;/p&gt;

&lt;p&gt;The phpBB vuln seems to have been related to highlighted words passed from searches(?). I presume &lt;a href=&quot;http://cvs.sourceforge.net/viewcvs.py/phpbb/phpBB2/viewtopic.php?r1=1.354&amp;r2=1.355&quot;&gt;this diff&lt;/a&gt; was the fix.&lt;/p&gt;

&lt;p&gt;The include worm is different though and &lt;i&gt;not&lt;/i&gt; specifically targetting any application. The version &lt;a href=&quot;http://www.k-otik.com/exploits/20041225.PhpIncludeWorm.php&quot;&gt;here&lt;/a&gt; looks to pull a list of pages with &#039;.php&#039; in the URL from Google and Yahoo modify the GET query string and replace what would become PHP variables with a link to a remote site (which I guess was hacked in advance). One such site I saw in a log seems to have been taken down on the 25th, thereby &quot;neutralizing&quot; worms using it.&lt;/p&gt;

&lt;p&gt;Bottom line is if you have code like;&lt;/p&gt;

&lt;code lang=&quot;php&quot;&gt;
// Validate first!!!
include $_GET[&#039;page&#039;];&lt;/code&gt;&lt;p&gt;You could be in for trouble (depending on PHP configuration).&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.f-secure.com/weblog/archives/archive-122004.html#00000413&quot;&gt;This blog&lt;/a&gt; suggests that, this time round, there&#039;s no need for panic. At the same time, this is the first serious attempt of this kind. There&#039;s room to be &quot;smarter&quot; as well as target other oft-installed PHP-apps. Expect we&#039;re going to see more of it.&lt;/p&gt;

&lt;p&gt;MOTD: &lt;i&gt;Validate all incoming data&lt;/i&gt;. &lt;i&gt;Anything&lt;/i&gt; you get from the browser cannot be trusted.&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>
<blockquote>
<p>
so,its only a phpBB thing?
</p>
</blockquote>
</p><p>The phpBB vuln seems to have been related to highlighted words passed from searches(?). I presume <a href="http://cvs.sourceforge.net/viewcvs.py/phpbb/phpBB2/viewtopic.php?r1=1.354&amp;r2=1.355">this diff</a> was the fix.</p>
<p>The include worm is different though and <i>not</i> specifically targetting any application. The version <a href="http://www.k-otik.com/exploits/20041225.PhpIncludeWorm.php">here</a> looks to pull a list of pages with &#8216;.php&#8217; in the URL from Google and Yahoo modify the GET query string and replace what would become PHP variables with a link to a remote site (which I guess was hacked in advance). One such site I saw in a log seems to have been taken down on the 25th, thereby &#8220;neutralizing&#8221; worms using it.</p>
<p>Bottom line is if you have code like;</p>
<p><code lang="php">
// Validate first!!!
include $_GET['page'];</code>
</p><p>You could be in for trouble (depending on PHP configuration).</p>
<p><a href="http://www.f-secure.com/weblog/archives/archive-122004.html#00000413">This blog</a> suggests that, this time round, there&#8217;s no need for panic. At the same time, this is the first serious attempt of this kind. There&#8217;s room to be &#8220;smarter&#8221; as well as target other oft-installed PHP-apps. Expect we&#8217;re going to see more of it.</p>
<p>MOTD: <i>Validate all incoming data</i>. <i>Anything</i> you get from the browser cannot be trusted.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: subnet_rx</title>
		<link>http://www.sitepoint.com/blogs/2004/12/27/php-worms-santy-perlphpinclude-modsecurity/comment-page-1/#comment-1641</link>
		<dc:creator>subnet_rx</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">139107243#comment-1641</guid>
		<description>&lt;p&gt;why would webhosts not install modsecurity?  Overhead?&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>why would webhosts not install modsecurity?  Overhead?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: HarryF</title>
		<link>http://www.sitepoint.com/blogs/2004/12/27/php-worms-santy-perlphpinclude-modsecurity/comment-page-1/#comment-1642</link>
		<dc:creator>HarryF</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">139107243#comment-1642</guid>
		<description>&lt;p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;br /&gt;
why would webhosts not install modsecurity? Overhead?&lt;br /&gt;
&lt;/p&gt;&lt;/blockquote&gt;&lt;/p&gt;

&lt;p&gt;Think the main thing is ModSecurity is still fairly new - think the awareness isn&#039;t quite there yet. Overhead &lt;i&gt;could&lt;/i&gt; be an issue although reading the ModSecurity docs suggests it &lt;i&gt;shouldn&#039;t&lt;/i&gt;. It probably (Ivan can no doubt answer that) needs a larger user base before it&#039;s possible to consider performance in detail.&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>
<blockquote>
<p>
why would webhosts not install modsecurity? Overhead?
</p>
</blockquote>
</p><p>Think the main thing is ModSecurity is still fairly new &#8211; think the awareness isn&#8217;t quite there yet. Overhead <i>could</i> be an issue although reading the ModSecurity docs suggests it <i>shouldn&#8217;t</i>. It probably (Ivan can no doubt answer that) needs a larger user base before it&#8217;s possible to consider performance in detail.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Thomas</title>
		<link>http://www.sitepoint.com/blogs/2004/12/27/php-worms-santy-perlphpinclude-modsecurity/comment-page-1/#comment-1643</link>
		<dc:creator>Richard Thomas</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">139107243#comment-1643</guid>
		<description>&lt;p&gt;Someone is limiting/spamming that channel to prevent it from getting a lot of connections while they try to get the channel killed. Thats the only reason the worm isn&#039;t spreading like wildfire&lt;/p&gt;

&lt;p&gt;At least this is what I saw in one of the reports somewhere&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>Someone is limiting/spamming that channel to prevent it from getting a lot of connections while they try to get the channel killed. Thats the only reason the worm isn&#8217;t spreading like wildfire</p>
<p>At least this is what I saw in one of the reports somewhere</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Website Rob</title>
		<link>http://www.sitepoint.com/blogs/2004/12/27/php-worms-santy-perlphpinclude-modsecurity/comment-page-1/#comment-1644</link>
		<dc:creator>Website Rob</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">139107243#comment-1644</guid>
		<description>&lt;p&gt;Actually, phpBB had a similar type exploit a few years ago -- v2.04 or thereabouts. That&#039;s when, as a Server Admin, I started paying more attention to the security within PHP itself.&lt;/p&gt;

&lt;p&gt;By having the following in a Server php.ini file:&lt;/p&gt;

&lt;p&gt;&lt;b&gt;disable_functions = shell_exec,system,proc_open&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;all PHP scripts have very good security.&lt;/p&gt;

&lt;p&gt;Everytime I see this error showing in the Server Error logs:&lt;/p&gt;

&lt;p&gt;&lt;b&gt;PHP Warning:  system() has been disabled for security reasons&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;it gives me a warm feeling knowing Clients scripts are safe and no defacement has been done, regardless of any security weaknesses within an individual script.&lt;/p&gt;

&lt;p&gt;Tis only one part of an over-all security strategy for any Server though, and as mod_security becomes more popular, is an excellent security addition.&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>Actually, phpBB had a similar type exploit a few years ago &#8212; v2.04 or thereabouts. That&#8217;s when, as a Server Admin, I started paying more attention to the security within PHP itself.</p>
<p>By having the following in a Server php.ini file:</p>
<p><b>disable_functions = shell_exec,system,proc_open</b></p>
<p>all PHP scripts have very good security.</p>
<p>Everytime I see this error showing in the Server Error logs:</p>
<p><b>PHP Warning:  system() has been disabled for security reasons</b></p>
<p>it gives me a warm feeling knowing Clients scripts are safe and no defacement has been done, regardless of any security weaknesses within an individual script.</p>
<p>Tis only one part of an over-all security strategy for any Server though, and as mod_security becomes more popular, is an excellent security addition.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen</title>
		<link>http://www.sitepoint.com/blogs/2004/12/27/php-worms-santy-perlphpinclude-modsecurity/comment-page-1/#comment-1645</link>
		<dc:creator>Stephen</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">139107243#comment-1645</guid>
		<description>&lt;p&gt;Well our server has been compromised in the last week or so. On Friday they managed to use it to send a whole load of spam emails and that gave the game away as server usage rocketted. We have been noticing very high traffic since 9th Jan anyway.&lt;br /&gt;
Doing some digging now reveals that it got compromised via the include hack into phpBBs viewtopic.php script. I am just decoding the system calls to see what happened.&lt;br /&gt;
I think the mistake is to assume that the vulnerability is with the urldecode() function. That is simply the phpBB guys fix. i.e. to remove it - as far as I can see. No. The real problem lies with the preg_replace(#....#e,,) call that uses what gets passed by that variable in the viewtopic.php url. The &#039;e&#039; option on preg_replace causes the second parameter to act like a function on the first. So they simply include a system call in there with the execution vars encoded as chr()s.&lt;br /&gt;
So the rule seems to be for php coders nothing to do with urlencode, etc. but don&#039;t use preg_replace with the &#039;e&#039; option unless you check what it is you are executing!&lt;/p&gt;

&lt;p&gt;Now back to our server. What really troubles me is that not only did they gain access to /var/ where they can upload files and execute as user apache, but they also managed to get root access. This is the bit I can&#039;t work out. Do I take it that they managed to run one of the latest known compromises for &quot;root as local user&quot; scripts? I see there is one for SMP kernels on Linux. We were using Mandrake 9.2 with SMP and looking at other sites it seems that there is just such a script for our kernel.&lt;br /&gt;
Has anyone else had this? Apart from that no pages defaced etc. But we will need to reinstall the server, change all passwords now, etc. which is a real pain.&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>Well our server has been compromised in the last week or so. On Friday they managed to use it to send a whole load of spam emails and that gave the game away as server usage rocketted. We have been noticing very high traffic since 9th Jan anyway.<br />
Doing some digging now reveals that it got compromised via the include hack into phpBBs viewtopic.php script. I am just decoding the system calls to see what happened.<br />
I think the mistake is to assume that the vulnerability is with the urldecode() function. That is simply the phpBB guys fix. i.e. to remove it &#8211; as far as I can see. No. The real problem lies with the preg_replace(#&#8230;.#e,,) call that uses what gets passed by that variable in the viewtopic.php url. The &#8216;e&#8217; option on preg_replace causes the second parameter to act like a function on the first. So they simply include a system call in there with the execution vars encoded as chr()s.<br />
So the rule seems to be for php coders nothing to do with urlencode, etc. but don&#8217;t use preg_replace with the &#8216;e&#8217; option unless you check what it is you are executing!</p>
<p>Now back to our server. What really troubles me is that not only did they gain access to /var/ where they can upload files and execute as user apache, but they also managed to get root access. This is the bit I can&#8217;t work out. Do I take it that they managed to run one of the latest known compromises for &#8220;root as local user&#8221; scripts? I see there is one for SMP kernels on Linux. We were using Mandrake 9.2 with SMP and looking at other sites it seems that there is just such a script for our kernel.<br />
Has anyone else had this? Apart from that no pages defaced etc. But we will need to reinstall the server, change all passwords now, etc. which is a real pain.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Gavin C</title>
		<link>http://www.sitepoint.com/blogs/2004/12/27/php-worms-santy-perlphpinclude-modsecurity/comment-page-1/#comment-1646</link>
		<dc:creator>Gavin C</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">139107243#comment-1646</guid>
		<description>&lt;p&gt;It stumped me for a while too. It&#039;s just a short script running as the apache user, no real exploit. &lt;br /&gt;
it tricks phpbb into running something like this:&lt;br /&gt;
exec (wget some perl script; perl /var/the script)&lt;/p&gt;

&lt;p&gt;It does a trick where it disguises itself to look like an httpd process in the list. this makes it look like it has root and started a server. It uses wget to download some scripts into var which it is allowed to do running as apache. then it runs the script with perl. The quick way top stop it is to rename wget. then upgrade phpbb.&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>It stumped me for a while too. It&#8217;s just a short script running as the apache user, no real exploit. <br />
it tricks phpbb into running something like this:<br />
exec (wget some perl script; perl /var/the script)</p>
<p>It does a trick where it disguises itself to look like an httpd process in the list. this makes it look like it has root and started a server. It uses wget to download some scripts into var which it is allowed to do running as apache. then it runs the script with perl. The quick way top stop it is to rename wget. then upgrade phpbb.</p>]]></content:encoded>
	</item>
</channel>
</rss>
