<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PSEiBlog &#187; phpmyadmin</title>
	<atom:link href="http://www.pseiko.nl/blog/tag/phpmyadmin/feed" rel="self" type="application/rss+xml" />
	<link>http://www.pseiko.nl/blog</link>
	<description>But why?</description>
	<lastBuildDate>Fri, 07 May 2010 14:02:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Countering PHPMyAdmin scanners with Fail2Ban</title>
		<link>http://www.pseiko.nl/blog/367/countering-phpmyadmin-scanners-with-fail2ban</link>
		<comments>http://www.pseiko.nl/blog/367/countering-phpmyadmin-scanners-with-fail2ban#comments</comments>
		<pubDate>Wed, 09 Dec 2009 14:44:40 +0000</pubDate>
		<dc:creator>Remco</dc:creator>
				<category><![CDATA[Computer & Technology Related]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Fail2Ban]]></category>
		<category><![CDATA[phpmyadmin]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regular expression]]></category>

		<guid isPermaLink="false">http://www.pseiko.nl/blog/?p=367</guid>
		<description><![CDATA[While examining my webserver statistics, I noticed that quite a lot 404&#8217;s are being served on most of my domains to scan bots that are trying to find exploits in possible running PHPMyAdmin configurations.
Though harmless if you keep a clean ship with a decently configured PHPMyAdmin and the latest updates like I do, I still [...]]]></description>
			<content:encoded><![CDATA[<p>While examining my webserver statistics, I noticed that quite a lot 404&#8217;s are being served on most of my domains to scan bots that are trying to find exploits in possible running PHPMyAdmin configurations.<br />
Though harmless if you keep a clean ship with a decently configured PHPMyAdmin and the latest updates like I do, I still decided I couldn&#8217;t let this behaviour unanswered. So I took action, and wrote a small fail2ban filter that permanently drops all traffic from the IP addresses these scans originate from, like I do with every address that misbehaves in any way.</p>
<p>The regex used won&#8217;t capture all attempts, but with my configuration only 1 hit is enough to get you banned (the scripts these scans call are main.php and config.inc.php, which aren&#8217;t to be called directly, especially not when they fail with a 404 like these), and all scanning attempts I&#8217;ve seen so far cycle through at least 20 different combinations.</p>
<p>Well, enough talk, here is the filter.d file:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Fail2Ban configuration file
</span><span style="color: #666666; font-style: italic;">#
</span><span style="color: #666666; font-style: italic;"># Author: Remco Overdijk
</span><span style="color: #666666; font-style: italic;">#
</span><span style="color: #666666; font-style: italic;"># $Revision: 4 $
</span><span style="color: #666666; font-style: italic;">#
</span>
<span style="color: #009900;">&#91;</span>Definition<span style="color: #009900;">&#93;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Option:  failregex
</span><span style="color: #666666; font-style: italic;"># Notes.:  regex to match the 404'ed PMA file in the logfile. The
</span><span style="color: #666666; font-style: italic;">#          host must be matched by a group named &quot;host&quot;. The tag &quot;&lt;HOST&gt;&quot; can
</span><span style="color: #666666; font-style: italic;">#          be used for standard IP/hostname matching and is only an alias for
</span><span style="color: #666666; font-style: italic;">#          (?:::f{4,6}:)?(?P&lt;host&gt;\S+)
</span><span style="color: #666666; font-style: italic;"># Values:  TEXT
</span><span style="color: #666666; font-style: italic;">#
</span>failregex <span style="color: #339933;">=</span> <span style="color: #339933;">&lt;</span>HOST<span style="color: #339933;">&gt;</span> <span style="color: #339933;">-.*</span><span style="color: #0000ff;">&quot;GET .*(php|pma|PMA|p/m/a|db|sql|admin).*/(config/config\.inc|main)\.php.*&quot;</span><span style="color: #339933;">.*</span><span style="color:#800080;">404.</span><span style="color: #339933;">*</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Option:  ignoreregex
</span><span style="color: #666666; font-style: italic;"># Notes.:  regex to ignore. If this regex matches, the line is ignored.
</span><span style="color: #666666; font-style: italic;"># Values:  TEXT
</span><span style="color: #666666; font-style: italic;">#
</span>ignoreregex <span style="color: #339933;">=</span></pre></div></div>

<p>And this is of course accompanied by a bit in jail.conf:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009900;">&#91;</span>apache<span style="color: #339933;">-</span>pma<span style="color: #009900;">&#93;</span>
&nbsp;
enabled <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span>
filter <span style="color: #339933;">=</span> apache<span style="color: #339933;">-</span>pma
action <span style="color: #339933;">=</span> iptables<span style="color: #339933;">-</span>allports<span style="color: #009900;">&#91;</span>name<span style="color: #339933;">=</span>pma<span style="color: #009900;">&#93;</span>
mail<span style="color: #339933;">-</span>whois<span style="color: #009900;">&#91;</span>name<span style="color: #339933;">=</span>pma<span style="color: #339933;">,</span> dest<span style="color: #339933;">=&lt;</span>YOURADDRHERE<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#93;</span>
logpath <span style="color: #339933;">=</span> <span style="color: #339933;">/</span><span style="color: #000000; font-weight: bold;">var</span><span style="color: #339933;">/</span><span style="color: #990000;">log</span><span style="color: #339933;">/</span>apache2<span style="color: #339933;">/</span>access_log
bantime <span style="color: #339933;">=</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span>
maxretry <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span></pre></div></div>

<p>Works for me, another 20 additional IPs/day onto the shitlist!</p>
<blockquote><p><b>Update:</b> It seems another variation of these scans are hitting the NIC&#8217;s quite often; One for Zen Cart to be more precise.<br />
You can easily add support countering this scanner as well, simply by expanding the failregex with this line:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">^<span style="color: #339933;">&lt;</span>HOST<span style="color: #339933;">&gt;</span> <span style="color: #339933;">-.*</span><span style="color: #0000ff;">&quot;GET .*(cart|boutique|catalog|butik|shop|zen|store).*/install\.txt.*&quot;</span><span style="color: #339933;">.*</span><span style="color:#800080;">404.</span><span style="color: #339933;">*</span></pre></div></div>

<p>You can put multiple regexes within one failregex, just put each one on a new line.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.pseiko.nl/blog/367/countering-phpmyadmin-scanners-with-fail2ban/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
