Fighting Referer Spam with deferer

I’ve been getting swamped by referer spam lately. Most of it is for domains that appear to have had hosting suspended. I had already seen a correlation between this referer spam and comment spam; what I didn’t know (but should have guessed) is that lots of folks are seing this. Tim Bray wrote about the problem today, pointing to more info from John Sinteur and Ann Elisabeth. Apparently all of these referer URIs resolve to a single webhost, with an IP of 161.58.59.8.

Ann’s post is one of many on her blog about the subject, she is actively pursuing this and trying to get Verio to pull the miscreant’s hosting. I suggest reading everything on her homepage for lots of good info.

John’s post on the WordPress support blog includes PHP code that sends a 301 Moved Permanently redirection header to any request with a referer URI that resolves to the IP above. Where does he redirect them? Back to the referer URI, of course.

Now, that’s an idea I like. I liked it so much I wrote a perl version as a Blosxom plugin. It’s called deferer, and is available here. Right now, it’s a one-trick pony, but (when time permits) I intend to expand it to a more comprehensive referer spam solution. I don’t know how effective redirecting these requests is- the spider scripts sending the requests may not follow redirects. Even so, deferer reduces server load (it ends the blosxom invocation early) and saves bandwidth.

Update: Deferer has been updated to version 0+2i, to fix a bug that caused a 500 Server Error if the referer hostname could not be resolved.

Both comments and pings are currently closed.

4 Responses to “Fighting Referer Spam with deferer”

  1. Steve Schwarz Says:

    Expanded deferer to use blacklisted words<br/>

    Jason, I put together a plugin I call refererblock that combines your deferer idea and code with Doug Alcorn’s writeback blacklist plugin mods to blacklist referer spam. Thought you might be interested:

    http://agilitynerd.com/index.cgi/tech/web/blogging/blosxom/refererblock_0.1.html

    Thanks for your great idea and initial implementation, Steve

  2. Kurt Yoder Says:

    Use Apache to redirect<br/>

    I used Apache for the 301’s. I’m not sure, but I think this might consume even fewer resources while redirecting referer spammers back to their own site. Assuming you use Apache, I wrote some instructions on setting it up at http://yoderhome.com/cgi-bin/blosxom/2005/01/15#referer3

  3. New Zealand host Says:

    Thanks for deferer! Going to try it out now!

  4. cheat codes Says:

    Thanks we are currently implementing spam deferer! We have been swamped these spammers. I hate people who make software such as prstorm >:(