Spammer Tar Pit

My spammer came back for another visit, so I decided to have a bit of fun. Here is my second WordPress plugin: TarPit (txt, phps).

What it does

If you have any IP numbers listed in your moderation_keys setting (that’s where you put the spam words in the Comment Moderation setting under Discussion Options), this plugin will check them against the current visitor’s IP number. If it matches, the visitor will get a delay (that’s the tar pit — it slows them down), then an “Access Denied” message. You can customize the delay time and the message of course. Advanced users can also add additional IP matches manually, should they so desire. You might want to do that in order to match against an entire IP block, for instance.

If you’re looking for a more humorous spammer deterrent, try Kitten’s Comment Pay. The main difference here is that with “Comment Pay”, the spammer still gets to post a comment. With TarPit, the spammer cannot access any page controlled by WordPress. At all.

Update: I meant to mention this before, but this works great in conjunction with Kitten’s Spam Words Plugin. Anytime you “Delete comment as spam”, the offender’s IP number will automatically be added to your moderation_keys.


Update 2, Aug 27, 2004: Bumped to version 1.1 and added a check for the case where you don’t yet have any IP numbers in your list.


Update 3, Sep 9, 2004: Bumped to version 1.2. Added option to email you when the trap is triggered (enabled by default).


Update 4, Oct 26, 2004: Bumped to version 1.3. Spammers will now get an HTTP 403 “Forbidden” status code, and the output is set to “text/plain”.

Other Posts of Interest

26 Comments

  1. Posted 8/25/2004 at 10:53 pm | Permalink

    Fantastic. I’m blogging about the plugin first and then going to configure and install it. So much more fun that restricting access with .htaccess!

  2. Posted 8/26/2004 at 10:40 am | Permalink

    While this will surely help for a little while, you should (and probably already do) realize that IP numbers are easily spoofed and blocking whole IP number ranges is almost always disadvantageous. As Jay Allen, author of MT-Blacklist, has noted several times, attacking the _method_ of the spammer doesn’t work in the long run, because methods can easily be changed. The tar-pitting is a nice idea, but ideally it should be triggered by a MT-Blacklist type of pattern matching against the author, e-mail, url, body fields of the comment.

  3. Posted 8/26/2004 at 12:14 pm | Permalink

    Yes, I understand well the pitfalls of blocking by IP number. But since I was experiencing an ongoing attack, it was a valid short-term solution. I plan to reap the IP numbers out of my moderation_keys setting from time to time.

    I’m also looking into the possibility of a WP plugin which can utilize the MT Blacklist regex file in real-time (well, with some caching).

  4. Posted 8/29/2004 at 3:09 pm | Permalink

    Another idea would be to grab the important parts of the sourcodes of SpamAssassin and build a plugin based on them. for comparision: I get about 0.5 spam mails per month - before that: about 20 per DAY!
    - so SpamAssassins spam detection engine should be very reliable regarding this topic.

    cu, w0lf.

  5. marlyse
    Posted 9/2/2004 at 3:46 pm | Permalink

    your other plugin ‘pisoff’ works (I think) but when I install this one, my site goes white. I checked white space and there is none before/after the php tag. my index page is not in the wp folder, could this cause the problem?

  6. Posted 9/8/2004 at 3:15 pm | Permalink

    Hmm - I’m trying to deny an entire list of IP addresses from a particularly annoying spammer that seems to be using compromised machines from one provider. Basically, I want to block 212.235.32.0 - 212.235.95.255. (So just 212.235.32. - 212.235.95.)

    So I’m looking at the $spammer_ips array, but can’t see what the regex should be for that list. Being lazy… um, programmer-style, I’m really not planning to write in the whole list going up by one IP each time (212.235.33, 212.235.34..). Hints appreciated..

  7. Posted 9/9/2004 at 12:18 pm | Permalink

    Charles, try this regexp:

    /^212\.235\.((3[2-9])|([4-8][0-9])|(9[0-5]))/

    That should match only the range you mentioned.

  8. Posted 9/10/2004 at 10:06 am | Permalink

    installed the 1.2 version, same problem, when I activate the plugin, complete site goes white. tried it with commenting out sections, to see which section gives me the problems, site goes already white if I only have the first section (line 43 - 56) active. and I don’t see any errors there. any ideas what could cause the site to go white? (there is no space before or after the original tag, if I comment out the complete code and leave just the main tags, site is okay).

  9. Posted 9/13/2004 at 4:39 pm | Permalink

    Having the same problem as marlyse… when I activate the plugin, I don’t get any HTML output. My host has error reporting almost completely disabled so I’m still looking into this.

  10. Posted 9/13/2004 at 5:25 pm | Permalink

    I’ve already exchanged emails with Marlyse, and she has this problem with some other plugins, as well. So I think it may be something specific to certain server setups, and not necessarily something in my code. Of course, if someone spots something that indicates otherwise, please let me know!

  11. Posted 9/14/2004 at 1:52 am | Permalink

    I’ll second the interest in seeing a text matching version. I’ve spent the last 48 hours purging spam from someone who’s spoofing a variety of IP’s but plugging the same list of sites in the comments.

  12. Posted 10/12/2004 at 1:03 am | Permalink

    Wanted to let you know that I’ve finally found out what created the problem: it seems that sometimes when downloading a php file or somehow obtaining code from somebody else, unvisible characters sometimes translate not php friendly. Barely visible is the worst, the usually displayed as a dot ‘empty space’. Only when viewed as phps file, I saw that it would encode these spaces. Looking at it more closely, I found that even though these invisible chars where represented as dots, the dots where ‘fatter’ than the ‘normal’ dots. Once I cleaned that up, I also found that sometimes single quotes would transfer as ‘curly’ single quotes which also again gave problems. Replacing them all with ’straight’ single quotes handled that. At this point I don’t remember which of the above problems I found with your file (as mentioned before, I had these ‘white site’ problems with various - but not all - plugins. Hope this makes sense and if somebody else encounters the same problem a place to look at.

  13. Posted 10/23/2004 at 4:47 am | Permalink

    Fantastic!

  14. Posted 10/23/2004 at 5:10 pm | Permalink

    Um, isn’t this a little lame though (not in terms of the awesome work you’re doing, but just in terms of how it works)? I mean, you have to blacklist the individual ip by hand. I could do that in a darn .htaccess file and be done with it. But any spammer worth their salt is just going to post from another ip. Is there no way to atomate this in the interface?

  15. dkaye
    Posted 11/14/2004 at 10:26 pm | Permalink

    well, i’m gonna give it a whirl - and use it in conjunction with kitten’s spamilator, and spam words. maybe someday we’ll outbeat the spammers at their own game. here’s to hoping! oh, for my own amusement, i modified the message the spammer will receive to read:

    thanks much for the hard work!

  16. Anonymous
    Posted 9/30/2005 at 1:03 pm | Permalink

    I personally think this is a dangerous route, because IP-blocking only works for a short time. Unless you flush your IP list from time to time, you could be blocking legitimate users.

  17. Posted 9/30/2005 at 1:53 pm | Permalink

    Unless you flush your IP list from time to time, you could be blocking legitimate users.

    See one of my earlier comments. Also note in the plugin source code, if you enable email notification, it says this:

    PLEASE NOTE:

    Blocking by IP number is unreliable, because most IP numbers are
    assigned to internet users dynamically by their ISPs. If you have
    not recently seen abusive activity from this source, you may want
    to consider removing it from the “Comment Moderation” settings in
    the WordPress “Discussion Options” admin screen.

    See my SpamValve project for an IP-blocking option which dynamically unblocks hosts after a period of inactivity.

  18. Posted 12/11/2005 at 8:29 pm | Permalink

    that’s too tight! can i put an hour’s delay?

  19. Posted 1/2/2007 at 1:21 pm | Permalink

    I disagree with the idea that blocking IP’s is bad. The reality is there are large blocks of IP’s that are truly bad. They are the source of a great deal of spam. Not only that but they are outside my reader area as in outside the country. Almost all of them are in Asia, primarily in China. I block them not just from my blog but also from all email and web site access to all of my web sites. They do not matter to me and they were creating a heavy load on my servers. Since blocking them my spam load has gone way down. Unblocking them allows more spam. Reblocking them fixes it. They’ll stay blocked.

  20. Posted 2/14/2007 at 11:06 am | Permalink

    It seems that when i activate tarpit characters on my site go weird. Ive got á and é and the likes in my site and it these ones which get changed through the site. Any ideas on a fix?

  21. Posted 9/25/2007 at 11:28 am | Permalink

    kexapyp.cn;66.232.112.242;66.232.127.71;ns1.clubcolanews.com;ns2.clubcolanews.com

  22. Posted 10/4/2007 at 2:51 am | Permalink

    […] […]

  23. Posted 10/4/2007 at 3:05 am | Permalink

    CHAITGEAR » SmartDisk Unveils FlashTrax XT Portable Media Player+Recorder Mobile, News Jefte.net » Css-based design in 60 seconds Articles Math Jazz » The World’s Longest Web Page Code geek ramblings » Spammer Tar Pit Plugins, WordPress CHAITGEAR » Square7 Launches Olympia DualPhone Skype Handset in UK News, Gadget geeksmakemehot.com » Can Unicorn’s Fly? Personal, Geeky Fun, #wordpress

  24. Posted 8/30/2008 at 7:44 am | Permalink

    I agree with Frank about other information can all be used in the filtering process, because some of the universities and Libraries and other institutions share the same IP for all students and this is my case, always finding my IP to be blocked while I never entered the site before.

  25. Posted 9/4/2008 at 6:30 pm | Permalink

    ?????? ????????. ? ??? ??? ?? ?????? ??????? ??????????????? ???????????????? :)

  26. Posted 10/12/2008 at 1:47 pm | Permalink

    thank you

59 Trackbacks

  1. By the life of justin on 8/25/2004 at 10:59 pm

    more spam fun
    This has to be a record setting blogging day for me. I think it’s my 6th or 7th post - not mention an edit to a previous post which should count as well. This is an update to that attempt at spamming…

    Dougal has had a REPEAT spammer visit his blo…

  2. By Weblog Tools Collection on 8/26/2004 at 9:23 am

    geek ramblings >> Spammer Tar Pit
    geek ramblings >> Spammer Tar Pit: I like to call this the “PissOff” plugin. Dougal and I were discussing this yesterday while our respective weblogs were getting flooded with comments and he has come up with a really nice solution. This one stops fl…

  3. By wordlog.com » Slow Down Spammer Boy! on 8/27/2004 at 5:52 am

    [...] in waves. Dougal helps you slow them down a bit, and then give them a piece of your mind. Spammer Tar Pit is a plugin that checks whether comments are from known spammer IPs in [...]

  4. By Photo Matt » The Trouble With WordPress on 8/27/2004 at 8:03 am

    [...] ccuring what has actually happened in WordPress development in the last week: Dougal wrote a plugin to slow down spambots, literally; Alex made a new style for the styles page; K [...]

  5. [...] floods in WP written on Aug 31, 2004 Filed under: meta-blog projects to try spammer tar pit kitten’s spam words Comments » The U [...]

  6. By CMS Blog Community on 9/1/2004 at 4:58 pm

    [...] ecent comment flood attempt comes to mind. Dougal came up with the wonderful Spammer Tar Pit plugin to temporarily stop the floods and that plugin gave me some idea [...]

  7. [...] my own good & look into either Kitty’s SPAM Killer Plugin or some plugins that Dougal & Markreleased lately. [...]

  8. [...] people attempting comment spam: to kill it, I use Kitten’s Spam Words allied to the Spammer Tar Pit. Both are Wordpress plugins. And work damn well, I’d add. Unfort [...]

  9. By Rage on Omnipotent » WP anti-spam on 9/16/2004 at 6:28 am

    [...] m @ 7:28 am Two WordPress anti-comment-spam plugins: Kitten’s spam words and Spammer tar pit. Comments » The URI to [...]

  10. By geek ramblings » Spammers are stupid on 9/17/2004 at 7:43 pm

    [...] der against future spams. Fire the cannons, with a chest full of booty! And thanks t’ me Spammer TarPit plugin, I get th’ amusement o’ seein’ some feedback when I block th’ nex [...]

  11. By WISWYG in Vancouver » Spam Comment on 9/18/2004 at 8:44 pm

    [...] spam comment。 除了以上兩個 plugin,還在Geek Ramblings這個 blog 找到個叫spammer-tar-pit的 plugin,這個 plugin 用的方法更利害,當它發現 comment [...]

  12. By dot-totally.co.uk on 10/3/2004 at 5:10 am

    s

    Comments were spammed again, so I’ll go about installing Dougal’s Spam Tar Pit.

    Comments

    The URI to TrackBack this entry i [...]

  13. rning. The spams are coming from several different IP numbers (which all now blocked by my Spammer TarPit plugin), and the hosts appear to be different types. All of them appear [...]

  14. By cliffrowley :: blog on 10/22/2004 at 4:58 am

    Spammage = popularity?

    Well, I got my first blog comment spam. I guess that means someone somewhere is reading this, which is kinda cool I guess. I’ve found a few WordPress plugins and patches that will prevent the spam which I’ll add at some point in the next few days -…

  15. commentaires (11, dont un seul a été placé en modération) Vu notre emploi des plugins Spammer Tar Pit, Kitten’s Spam Words et Three Strikes Spam, il a du soumettre ses [...]

  16. By dot-totally.co.uk on 10/26/2004 at 4:55 pm

    October, 2004; evening time - No Comments

    I don’t know if Dougal’s Spammer TarPit is just going slightly overboard on my weblog. Since the 11th of October [...]

  17. By WOIFM on 10/26/2004 at 5:09 pm

    Tarpit and Comment-Pay Plug-Ins

    Doug Campbell’s Spammer Tar Pit and Kitten’s Comment-Pay are cute ideas. Possibly impractical, but cute. Both are for WordPress but…

  18. By Wikilab » Comment spam on 10/27/2004 at 5:13 am

    qui il comment spam. Stamattina ne ho cancellati 4. Abilitati Kitten’s Spam Words e Spammer Tar Pit.

    Commenti
    »

    La U [...]

  19. By Kick & Scream on 10/28/2004 at 11:29 am

    Three Strikes TarPit

    I was hit by a wave of spam today. On Raena’s recommendation, I had Kitten’s Spam Words running, so the spam wasn’t visible on the blog, but I still had to log in and delete it all from the moderation queue.

    Pain in the arse.

    So I went looking…

  20. By the life of justin » must kill spam on 10/29/2004 at 9:44 am

    hose that don’t pass the blacklisting rules. The final piece of this puzzle would be Dougal’s Spammer Tar Pit to immediately block access to all WordPress powered PHP [...]

  21. By [rmfo-blogs.com]: About on 10/29/2004 at 12:15 pm

    Stemming the Tide of Comment Spam With a Tar Pit

    Many [rmfo-blogs] users have had their Weblogs indexed enough by Google to now be suffering from comment spam. What follows is an tutorial for an advanced technique for stemming the flow of comment spam; this involves installing a WordPress plugin and…

  22. to compare some of the other spam plugins out there, so in no particular order here goes. Spammer Tar Pit This is one of those ideas that I wish I had had. The concept is to tie [...]

  23. ijn bescheiden mening veel interessanter, is Kitten’s Spaminator, een combinatie van Tar pit en Three Strikes. De laatste gebruikte ik al in de tweetrapsraket, en dat werkt [...]

  24. By Canned !! -- my Atropine on 11/2/2004 at 1:29 pm

    SPAM Prevention with WP!!

    Are you being spammed? Do you use WP? If the answer is YES, then you MUST read this…..

  25. Spam

    Kitten’s Spaminator vereint die Funktionen der beiden Anti-Spam-PlugIns Tar Pit und Three Strikes Spam Prevention

    This entry was [...]

  26. -Spammer for WordPress Blogs Spammer Tar Pit Anti-Spammer for WordPress Blogs Blac [...]

  27. om kombinerar det bästa från ‘Three Strikes Spam Prevention Plugin‘ och ‘Spammer Tar Pit‘. Det låter kanske onödigt att ha flera olika typer av antispam- [...]

  28. hate it. So, to save my precious time and effort I have installed a new plugin called the Spammer Tar Pit&#172. Technically, it gives the spammer a slow down thereby giving them [...]

  29. By My true site on 11/26/2004 at 4:31 am

    enti di utenti o amici, ecco che allora entra in gioco un simpatico plugin per WordPress: Tarpit qui potrete trovare il Link [...]

  30. By Webbie's Webblog » Webblog Spammers on 11/26/2004 at 12:58 pm

    217;ve switched off the comments. Thanks to a couple of Wordpress plugin’s: » Tar Pit » Kitten’s Spam Words I am able to control them, but I’m stil [...]

  31. the Caymans that want to use my site to advertise without paying for it. Check these out: Spammer Tar Pit lets you blacklist IPs Kitten’s Friendly Comments allows you to m [...]

  32. as the spammer, but I’m not concerned about it: my understanding is that my plugin (Tarpit) will only block comments from the listed IP addresses, not actual access to the [...]

  33. for moderation, so they never appeared on the site, but what a drag. I just installed the spammer tarpit plugin to waste their time. Now when an IP I’ve moderated tries t [...]

  34. ten’s spam words, (which dynamically updates a blacklist of words, URIs and IPs) and tar pit. someone on the #wordpress IRC recommended spam karma, which i will try if this [...]

  35. By myownworld.org » The Spaminator on 12/1/2004 at 6:24 pm

    nator. My main interest lies in the fact that it combines the best of the other plugins (Tar Pit and [...]

  36. ouple of plugins to combat against comment spam: Kitten’s Spam Words Plugin, and the Spammer Tar Pit. So I am going to disable the comment moderation and trial these two to [...]

  37. By The Linux Blog » Trackback Spam on 2/1/2005 at 10:09 am

    ated some of my custom-written filters and added them to the trackback.php file) and using Spammer Tar Pit, which is explained on the page as so: [b]What it does[/b] [b]If you [...]

  38. By Serenity, now! » Finally… on 2/2/2005 at 10:48 pm

    [...] oad NOW price of $89.99. A sweet deal! I have more spam in my trash folder. Thank god for Spammer Tar Pit! But that means someone has made it past my .htaccess f [...]

  39. [...] es long to make their move…that was then, this is now: Kitten’s Spaminator and Spammer Tar Pit to the rescue. This entry was posted [...]

  40. [...] to combat it. Some of the ones I will be reviewing for possible use will be: AuthImage Spammer Tarpit WP Blacklist Spam Karma WP-Hashcash dns-anti-spam TrencaSpammers
    [...]

  41. [...] —¥ä»˜ã‘に関係なく読者に1ページ目から読ませることができます。 スパマー・ターピット (Spammer TarPit)訪問者の IP ナンバーが moderati [...]

  42. By Starlit Dreams on 3/24/2005 at 9:41 am

    RSS 2.0 Valid XHTML [IMG Get Firefox!] Powered by WordPress Plugins Kitten’s Spam Words Spammer Tar Pit Update Linkroll WP Grins View Level Cats Show/Hide More

  43. [...] ijn bescheiden mening veel interessanter, is Kitten’s Spaminator, een combinatie van Tar pit en Three Strikes. De laatste gebruikte ik al in de tweetrapsraket, en dat werkt [...]

  44. [...] -Spammer for WordPress Blogs Spammer Tar Pit Anti-Spammer for WordPress Blogs Blac [...]

  45. By Patrick's Rants on 4/3/2005 at 2:29 pm

    Weekend the best time for trackback spam

    As the weekend draws to a close, I can look at my inbox and see 20+ attempts to spam using trackbacks. During the week the spam is at a much lower level, apparently spammers think/know that bloggers don’t check their blogs as much over the weekend and…

  46. By Un Cielo Provvisorio » Mnemosine on 5/4/2005 at 8:01 pm

    [...] del blog. Un applauso anche allo staff di TopHost, che ha preso a cuore i miei problemi di utenze non gradite e stan [...]

  47. [...] r can choose the look of the blog that they like), an image management and a very powerful spam killer. (The only downfall of doing a blog is that spambots find the blogs and lay [...]

  48. By Eau Salée Lunaire on 5/16/2005 at 5:40 pm

    Seems there’s another comment here that didn’t get raped by TarPit . Hey, here’s an idea — instead of spending all your free time wallowing in self pitty and angst (by “free” I mean when you aren’t self loathing and playing the poor pitiful victim of a cruel uncompassionate world), maybe you should consider

  49. CHAITGEAR » SmartDisk Unveils FlashTrax XT Portable Media Player+Recorder Mobile, News Jefte.net » Css-based design in 60 seconds Articles Math Jazz » The World’s Longest Web Page Code geek ramblings » Spammer Tar Pit Plugins, WordPress CHAITGEAR » Square7 Launches Olympia DualPhone Skype Handset in UK News, Gadget geeksmakemehot.com » Can Unicorn’s Fly? Personal, Geeky Fun, #wordpress

  50. [...] f comment spam I receive; I now have four layers to my comment spam defense. The first is Tar Pit, a lovely little device that slows spammers down and eventually bans them from [...]

  51. [...] Jag har även installerat Kitten’s Spam Words . Med den och TarPit sÃ¥ skall jag inte fÃ¥ sÃ¥ mycket spam pÃ¥ denna och andra sidor pÃ¥ denna server… [...]

  52. [...] I know this is bad netizen-y behavior, but I just blocked several IP addresses from posting on this site. I’ve been getting hit with 30-50 spams every time I post, and since I’m working off of an anonymous wireless connection coming from somewhere in my parents’ neighborhood, I don’t have time for social niceties. I’m thinking about installing Spammer Tar Pit or some other anti-comment spam plug-in, but it will have to wait until I don’t have to depend on my computer being in juuuust the right position in order to be connected. [...]

  53. By Interesting News Posts on 3/9/2006 at 9:24 pm

    [...] [...]

  54. By Tar for Windows - Tar Links on 4/28/2006 at 6:05 am

    [...] geek ramblings » Spammer Tar Pit Dougal came up with the wonderful Spammer Tar Pit plugin to temporarily stop … 除了以上兩個 plugin,還在Geek Ramblings這個 blog 找到個叫spammer-tar-pit的 … [...]

  55. By Not an artist on 6/14/2006 at 5:36 am

    Spammers Tarpit…

    Spammers tarpit has been posted. It’s a plugin that’s supposed to ask spammers to go away. Not an ideal solution as far as I can say. I’d prefer just increasing the delay, first a minute, then a minute and a half, until they go away. …

  56. [...] Visit [...]

  57. [...] Visit & Download [...]

  58. By Barb’s Blog » Word Press Plug-Ins on 4/28/2008 at 10:32 pm

    [...] I already had in my old version of Word Press, but definately worth a mention here, is the “TarPit” plug in for trackback [...]

  59. By lilo the sequel…. | Jörgen S Öfjäll on 9/23/2008 at 3:31 pm

    [...] har även installerat Kitten’s Spam Words . Med den och TarPit så skall jag inte få så mycket spam på denna och andra sidor på denna [...]

Post a Comment

Your email is never published nor shared. Comments or website URLs deemed to be off-topic or inappropriate may be deleted at the site owner's discretion.