How To Block Annoying Referrer Spammers?

There's a very persistent (and very stupid) referrer spammer pummelling my blog and I'm getting sick of it - not least of all because at one point it actually managed to completely overwhelm the tiny little virtual server my blog runs on so that nothing else could access it. Given that I'm using WordPress with Apache, what's the easiest way to block it?

One Response to “How To Block Annoying Referrer Spammers?”

  1. Stephen Thorne Says:

    I don’t know exactly how to handle referrer spam, but I do know how to spot a spam url.

    Given any url, for example, http://hostname.example.com/foo/bar/baz.html

    take hostname.example.com, and append .multi.surbl.org to it. Then do a DNS lookup on it, i.e. “hostname.example.com.multi.surbl.org”. if the query comes back with an ip address, (it will be 127.0.0.XX, where XX will change according to the blacklists that list that hostname) then it is spam. Remove elements from the hostname until you’re left with nothing but the root (.com, .cx, .com.au, etc, there’s a list of them on surbl.org for you convenience).

    As for how to make apache drop HTTP connections based on the referrer, I don’t know how to do that, but it would be a fun mod_anti_spam. ;)

    Heck, you could probably use the same technique to stop comment spam, if you inspect the HTTP GET/POST data as well as the Referrer: header…


Leave a Reply

Alternatively, subscribe to the Atom feed.