Google

Home
Most Popular
Petals

|
*
2006/11/23
 13:03:57

And the spambots adapt...

So I was enjoying my relaxing Thanksgiving (well, not really, but that's another story), and I get emails about spam comments. That's the first in a year or more, so I glance at the logs to see how it evaded the setup. It appears it followed a link from googleblog, and was acting as a fully compliant browser (executing javascript, etc.). So either it was a manual attempt, or a really advanced script. To make the rest of my day easier, I implemented an XBL check (after making sure it would have helped in this case), which is something I'd seen as an interesting idea to prevent spam. As I didn't want to bother with Net::DNS for such a simple check that doesn't run often, this should be pretty portable in case anyone else uses perl and wants to try it.

if ($ENV{'REMOTE_ADDR'} =~ m/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) {
my $xblresult = qx!/usr/bin/host $4.$3.$2.$1.xbl.spamhaus.org!;
if ($xblresult =~ m/\b127\.0\.0\.\d+\b/) {
print "Content-type: text/plain\n\n";
print "Rejected due to xbl\n";
exit;
}
}

#
By babada on 2006/11/24 at 08:34:45

What is XBL?

#
By Jeremy on 2006/11/24 at 13:59:37

Exploits Block List. Basically an RBL of exploited machines.

#
By Pete on 2006/11/24 at 09:03:03

Hey, I use Perl and I might need that!

Thanks, Mooney. That'll go in my next round of updates.

#
By bleaus on 2006/11/24 at 14:11:48

Pete, You need to get an RSS Feed too. I never remember to check your site.

#
By Jeremy on 2006/11/24 at 14:19:41

Apparently you must have removed it from your reader or something - it started working a couple days ago.

#
By bleaus on 2006/11/24 at 16:52:59

Whoa. It works!

#
By Pete on 2006/11/24 at 23:28:45

Hooray for me!

#
By Jeremy on 2006/12/14 at 12:16:53

Of course then there's the time where someone controls a botnet and hits from a half dozen IPs at a time, only one of which is in XBL... Luckily odd behavior is still something that can be recognized.

#
By bleaus on 2006/12/14 at 14:52:50

I checked my Reader this morning and it said 12 new articles, then I saw they were spam.... that mad me sad.

#
By Jeremy on 2006/12/14 at 18:38:58

Yea, that was no fun.