Mediawiki spam

I run several sites off Mediawiki, and the spam problem has been getting progressively worse recently.

Making the wiki ‘registered users only can edit’ helps a bit, but most of the spambots can get around that now. In fact most seem to get around the ‘easy rollback’ of recently registered users changes by creating their spamming accounts quite some time before actually using them to spam.

Most of the spam I get is of a particularly useless kind. It’s wrapped in a div set with a style of “overflow:auto;height:1px;”, which makes it invisible on the page. However, as most recent releases of MediaWiki also default to adding a “nofollow” to external links, this means that the spam links get no googlejuice either.

Although useless to the spammer, it’s highly irritating to wiki admins. However, there is a particularly simple fix.

In your LocalSettings.php, just add one line:


Now any attempt to include text that matches in an edit causes the edit to fail.

I’m sure this is documented somewhere, but I only came across it on one of the mailing lists. So I’m offering it out here in the hope that some other plagued mediawiki admin can cut back their admin burden too.

9 thoughts on “Mediawiki spam

  1. Hi, I just wanted to drop you a note that this was incredibly useful to me just now – the mediawiki I was just tasked with admin’ing was having a flux of spam of exactly the sort you describe, and I think this edit will take care of it. Thanks!

  2. Thank you!!

    Before last week, they would attack, disappear, I would clean it, and we’d repeat a month later.

    This week they were very persistent, hitting the same pages over and over.

    Thanks for the salvation!

  3. Pingback: ChocoFlop - Live! Image and Photo Editing for Mac OS X » Blog Archive » Bloody spammers

  4. The fix is working perfectly, there hasn’t been a single piece of spam since. I’ve also passed it along to a few other wiki admins. Thank you.

  5. Pingback: Rage on Omnipotent » Blog Archive » Wiki anti-spam

Leave a Reply

Your email address will not be published. Required fields are marked *