<?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>Inliniac &#187; comment spam</title>
	<atom:link href="http://www.inliniac.net/blog/tag/comment-spam/feed" rel="self" type="application/rss+xml" />
	<link>http://www.inliniac.net/blog</link>
	<description>Everything inline.</description>
	<lastBuildDate>Wed, 11 Jan 2012 19:09:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Removing Trac ticket comment spam in Debian Lenny</title>
		<link>http://www.inliniac.net/blog/2010/04/23/removing-trac-ticket-comment-spam-in-debian-lenny.html</link>
		<comments>http://www.inliniac.net/blog/2010/04/23/removing-trac-ticket-comment-spam-in-debian-lenny.html#comments</comments>
		<pubDate>Fri, 23 Apr 2010 10:23:20 +0000</pubDate>
		<dc:creator>Victor Julien</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[ModSecurity]]></category>
		<category><![CDATA[comment spam]]></category>
		<category><![CDATA[trac]]></category>

		<guid isPermaLink="false">http://www.inliniac.net/blog/?p=340</guid>
		<description><![CDATA[The Vuurmuur website runs Trac and overall I&#8217;m pretty happy with it. The only thing that Trac doesn&#8217;t do well, is dealing with spammers. Spammers target Trac a lot, so that&#8217;s a real problem. To prevent spammers from making it through, I run Scallywhack and a number of custom ModSecurity rules. So far, spams only [...]]]></description>
			<content:encoded><![CDATA[<p>The Vuurmuur website runs Trac and overall I&#8217;m pretty happy with it. The only thing that Trac doesn&#8217;t do well, is dealing with spammers. Spammers target Trac a lot, so that&#8217;s a real problem.</p>
<p>To prevent spammers from making it through, I run <a href="http://projects.otaku42.de/wiki/ScallyWhack">Scallywhack</a> and a number of custom ModSecurity rules. So far, spams only made it through as new tickets in the ticket tracker, so I installed the <a href="http://trac-hacks.org/wiki/TicketDeletePlugin">TicketDeletePlugin</a>.</p>
<p>Yesterday, I saw the first spam as a comment to an existing and valid ticket. Like tickets themselves, ticket comments can not be removed by Trac by default. Luckily, upstream Trac seems to have fixed this. I&#8217;m running Debian&#8217;s version of Trac 0.11.1 however, so I decided to patch that. The patches in the Trac ticket <a href="http://trac.edgewall.org/ticket/454">#454</a> didn&#8217;t apply cleanly, so I had to patch it manually. To save others the work, it&#8217;s available here: <a href="http://www.inliniac.net/files/trac_0.11.1-debian-comment_edit.patch">http://www.inliniac.net/files/trac_0.11.1-debian-comment_edit.patch</a></p>
<p>To use it, make a copy of your /usr/share/pyshared/trac directory.<br />
Next, go into the trac directory and run the command:<br />
patch -p1 &lt; /path/to/trac_0.11.1-debian-comment_edit.patch</p>
<p>After this, each comment in the comment system will have a &#8220;edit&#8221; button and you can remove the spam message content. It&#8217;s not possible to remove the entire comment, but this works for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.inliniac.net/blog/2010/04/23/removing-trac-ticket-comment-spam-in-debian-lenny.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update on using realtime blacklists with ModSecurity</title>
		<link>http://www.inliniac.net/blog/2007/03/01/update-on-using-realtime-blacklists-with-modsecurity.html</link>
		<comments>http://www.inliniac.net/blog/2007/03/01/update-on-using-realtime-blacklists-with-modsecurity.html#comments</comments>
		<pubDate>Thu, 01 Mar 2007 08:04:55 +0000</pubDate>
		<dc:creator>Victor Julien</dc:creator>
				<category><![CDATA[IPS]]></category>
		<category><![CDATA[ModSecurity]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[comment spam]]></category>
		<category><![CDATA[Ivan Ristic]]></category>
		<category><![CDATA[rbl]]></category>

		<guid isPermaLink="false">http://www.inliniac.net/blog/?p=66</guid>
		<description><![CDATA[A few days ago I posted a blog article about stopping comment spam with ModSecurity using realtime blacklists (rbl). While the approach was working, I noted having problems with rules when I tried to match on POST methods in HTTP requests. Luckily, ModSecurity creator Ivan Ristic was quick to point out where the problem is. [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I posted a blog article about stopping comment spam with ModSecurity using realtime blacklists (rbl). While the approach was working, I noted having problems with rules when I tried to match on POST methods in HTTP requests.</p>
<p>Luckily, ModSecurity creator Ivan Ristic was quick to point out where the problem is. I&#8217;m using the Core Ruleset for ModSecurity, and one thing that ruleset does is use the &#8216;lowercase&#8217; transformation. This converts all text from arguments to lowercase, so my ^POST$ match would never be able to match. So like Ivan suggested, using ^post$ solved this part.</p>
<p>Next Ivan pointed out a weakness in the rules. My rules looked for /blog/wp-comment-post.php, and would be easily evaded by just using /blog//wp-comment-post.php. He suggested using the &#8216;normalisePath&#8217; transformation. I did this, but I also slightly changed the rules to not look for the /blog/ part at all (maybe this makes normalisePath useless, but I decided to rather be safe than sorry).</p>
<p>The rules I&#8217;m using now look like this:</p>
<p align="left"><strong>SecRule REQUEST_METHOD &#8220;^post$&#8221; &#8220;log,deny,chain,msg:&#8217;LOCAL comment spammer at rbl list.dsbl.org&#8217;&#8221;<br />
SecRule REQUEST_URI &#8220;wp-(comments-post|trackback)\.php$&#8221; &#8220;chain,t:normalisePath&#8221;<br />
SecRule REMOTE_ADDR &#8220;@rbl list.dsbl.org&#8221;</strong></p>
<p align="left"><strong> SecRule REQUEST_METHOD &#8220;^post$&#8221; &#8220;log,deny,chain,msg:&#8217;LOCAL comment spammer at rbl bl.spamcop.net&#8217;&#8221;</strong><br />
<strong> SecRule REQUEST_URI &#8220;wp-(comments-post|trackback)\.php$&#8221; &#8220;chain,t:normalisePath&#8221;</strong><br />
<strong> SecRule REMOTE_ADDR &#8220;@rbl bl.spamcop.net&#8221;</strong></p>
<p align="left"><strong> SecRule REQUEST_METHOD &#8220;^post$&#8221; &#8220;log,deny,chain,msg:&#8217;LOCAL comment spammer at rbl sbl-xbl.spamhaus.org&#8217;&#8221;</strong><br />
<strong> SecRule REQUEST_URI &#8220;wp-(comments-post|trackback)\.php$&#8221; &#8220;chain,t:normalisePath&#8221;</strong><br />
<strong> SecRule REMOTE_ADDR &#8220;@rbl sbl-xbl.spamhaus.org&#8221;</strong></p>
<p>Thanks a lot Ivan Ristic for your comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.inliniac.net/blog/2007/03/01/update-on-using-realtime-blacklists-with-modsecurity.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blocking comment spam using ModSecurity and realtime blacklists</title>
		<link>http://www.inliniac.net/blog/2007/02/23/blocking-comment-spam-using-modsecurity-and-realtime-blacklists.html</link>
		<comments>http://www.inliniac.net/blog/2007/02/23/blocking-comment-spam-using-modsecurity-and-realtime-blacklists.html#comments</comments>
		<pubDate>Thu, 22 Feb 2007 22:25:45 +0000</pubDate>
		<dc:creator>Victor Julien</dc:creator>
				<category><![CDATA[IPS]]></category>
		<category><![CDATA[ModSecurity]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[comment spam]]></category>
		<category><![CDATA[rbl]]></category>

		<guid isPermaLink="false">http://www.inliniac.net/blog/?p=64</guid>
		<description><![CDATA[Spammers are known to use compromised hosts from all over the world to send their messages. Many people are blocking or scoring email spam based on realtime blacklist (rbl), which contain ipaddresses of these known bad hosts. In my experience this works fairly well for email. A while ago I noticed in the ModSecurity documentation [...]]]></description>
			<content:encoded><![CDATA[<p>Spammers are known to use compromised hosts from all over the world to send their messages. Many people are blocking or scoring email spam based on realtime blacklist (rbl), which contain ipaddresses of these known bad hosts. In my experience this works fairly well for email. A while ago I noticed in the ModSecurity documentation for version 2.0 that ModSecurity features an operator called <a href="http://modsecurity.org/documentation/modsecurity-apache/2.1.0-rc6/html-multipage/08-operators.html#N11490">rbl</a>, that can be used to check the ipaddress of a visitor with a rbl. So I decided to see if I could use the realtime blacklists to prevent comment spam on my blog. Turns out this works great! In this post I&#8217;ll show how to get it working.<br />
<span id="more-64"></span><br />
<a href="http://www.inliniac.net/blog/?p=62">Recently</a> I switched this blog from ModSecurity 1.9.4 to 2.0.4. Since then I&#8217;ve updated it to 2.1.0rc7, but this post should apply to 2.0.4 without modifications.</p>
<p>The basic syntax of the rbl rule is as follows:</p>
<p align="left"><strong>SecRule REMOTE_ADDR &#8220;@rbl bl.spamcop.net&#8221;</strong></p>
<p align="left">However, I would not recommend just using this rule because it would do a lookup of the remote ipaddress for every request made to your site. This will <em>totally</em> destroy the performance of your site. So I decided to inspect only POST request, since posting comments requires&#8230; POST <img src='http://www.inliniac.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p align="left"><strong>SecRule REQUEST_METHOD &#8220;^POST$&#8221; &#8220;log,deny,chain,msg:&#8217;LOCAL comment spammer at rbl bl.spamcop.net&#8217;&#8221;<br />
SecRule REMOTE_ADDR &#8220;@rbl bl.spamcop.net&#8221;</strong></p>
<p>For some reason unclear to me, this doesn&#8217;t work. With this rule the rbl is never ever checked. I could see that just the rbl rule would work, so it must be something in the combination of the rules. Luckily, I found a workaround:</p>
<p align="left"><strong>SecRule REQUEST_URI &#8220;^/blog/wp-(comments-post|trackback)\.php$&#8221; &#8220;log,deny,chain,msg:&#8217;LOCAL comment spammer at rbl bl.spamcop.net&#8217;&#8221;<br />
SecRule REMOTE_ADDR &#8220;@rbl bl.spamcop.net&#8221;</strong></p>
<p>So I tried some variations of rules and the above rule turns out to work just fine. It doesn&#8217;t look for the POST method, but instead just looks at the URI&#8217;s at which a comment poster posts.</p>
<p>After using this with a large number of blacklists, seven to be precise, I can conclude it is very effective. The last few days 144 attempts were blocked, while 22 still came through. I have manually inspected all blocked comments and so far not a single false positive has occured.</p>
<p>Even though I have configured seven different blacklists, only three are actually get hits, so I will paste those below:</p>
<p align="left"><strong>SecRule REQUEST_URI &#8220;^/blog/wp-(comments-post|trackback)\.php$&#8221; &#8220;log,deny,chain,msg:&#8217;LOCAL comment spammer at rbl list.dsbl.org&#8217;&#8221;<br />
SecRule REMOTE_ADDR &#8220;@rbl list.dsbl.org&#8221;</strong></p>
<p align="left"><strong><br />
SecRule REQUEST_URI &#8220;^/blog/wp-(comments-post|trackback)\.php$&#8221; &#8220;log,deny,chain,msg:&#8217;LOCAL comment spammer at rbl bl.spamcop.net&#8217;&#8221;<br />
SecRule REMOTE_ADDR &#8220;@rbl bl.spamcop.net&#8221;</strong></p>
<p align="left"><strong><br />
SecRule REQUEST_URI &#8220;^/blog/wp-(comments-post|trackback)\.php$&#8221; &#8220;log,deny,chain,msg:&#8217;LOCAL comment spammer at rbl sbl-xbl.spamhaus.org&#8217;&#8221;<br />
SecRule REMOTE_ADDR &#8220;@rbl sbl-xbl.spamhaus.org&#8221;</strong></p>
<p>Good luck fighting off the spam! <img src='http://www.inliniac.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.inliniac.net/blog/2007/02/23/blocking-comment-spam-using-modsecurity-and-realtime-blacklists.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

