Anti spam-blog plugin for WordPress MU

The very popular WP Hashcash plugin for WordPress has been modified to work on the WordPress MU signup page.

WP Hashcash is an anti spam plugin that protects blogs from comment spam. It does this with Javascript and is quite successful. I worked on it over the last few days and the plugin now offers the same protection on the WordPress MU signup form!

This is the first release of the code so handle with care. Grab the latest version (version 4.2 as of this moment) from the download page. Unzip it and copy wp-hashcash.php into wp-content/mu-plugins/ and visit “Site Admin” -> “WordPress Hashcash” to confirm it’s working.

Now logout and create a new blog, just to make sure everything is working ok. Occasionally some users will have problems registering, and those that have Javascript turned off won’t be able to create a new blog at all. That’s the downside of using this plugin unfortunately.

Keep an eye on the stats counter on the admin page. I want to hear how well this works on your site!

WordPress MU 2.6 beta 1

Edit: The release candidate is now online. Here’s the forum thread on it. Grab the zip file to test!

WordPress MU 2.6 beta 1 is now available. WordPress 2.6 is due for release shortly and it’s already on it’s third beta so it’s times for WordPress MU to be updated.

This release has many new features as well as a few security fixes. In his beta 1, beta 2 and beta 3 posts Ryan listed some of the main features, including post revisioning, gears support for faster loading, theme previews, better SSL support and much much more.

WordPress MU specific changes include:

  • The version number is being bumped to 2.6 rather than 1.6 because of version confusion. Minor MU versions will probably append a letter to the version.
  • Signup page now has a nonce to help defeat spammers.
  • Plugins in wp-content/plugins/ are version checked like in WordPress. mu-plugins isn’t covered just yet.
  • Major object cache changes.
  • And many more bug fixes. Check the timeline for a list of changes.

Download wordpress-mu-2.6-beta1.zip

Excuses for ringing in sick

If you thought you’d heard it all, watch this video and listen to the outrageous lies and excuses four guys give their new employers. How long can they last and who will remain employed the longest before being fired?

Film by Dogmedia Productions (warning, large embedded movie file), via Jazzbiscuit and Justin. Originally shown at the Darklight Festival in 2007.

Back to the Eighties

Well, the Irish economy is tanking and is heading towards recession. Last time things were this bad was in the Eighties so here’s a few memories from that decade. After yesterday’s rather technical post, I need a nice squeaky throw away nostalgic one today.

Continue reading “Back to the Eighties”

More ways to stop spammers and unwanted traffic

Comment spammers, trackback spam, stupid bots and AVG linkscanner eating into your bandwidth and server resources? Here’s how to put a dent in their activities with a few mod_rewrite rules.

I hate those blogs that send me fake trackbacks and pingbacks. Unfortunately it’s impossible to stop but this morning I figured out a way of stopping some of them.

Look through the log files of your web server for the string ‘ “-” “-“‘. Lots of requests there aren’t there? I found 914 requests yesterday. Those are requests without a USER_AGENT or HTTP_REFERER and almost all of them are suspicious because they weren’t followed by requests for images, stylesheets. or Javascript files. Unfortunately the WordPress cron server also falls into this category so you need to filter out requests from your own server’s IP address.

This morning I checked up on a spam trackback that came in. This one came from 85.177.33.196:

URL: /xmlrpc.php
HTTP_RAW_POST_DATA: <?xml version=”1.0″?>
<methodCall>
<methodName>pingback.ping</methodName>
<params>
<param>
<value><string>http://7wins. eu/cbprod/detail_10347/cure+your+tight+foreskin.html</string></value>
</param>
<param>
<value><string>http://ocaoimh.ie/2005/03/01/i-am-bored-sites-for-when-youre-bored/all-comments/</string></value>
</param>
</params>
</methodCall>

I looked through my log files for that IP address and discovered the following:

85.177.33.196 – – [03/Jul/2008:06:40:01 +0000] “GET /2005/02/18/10-more-ways-to-make-money-with-your-digital-cameras/ HTTP/1.0” 200 36151 “-” “-”
85.177.33.196 – – [03/Jul/2008:07:04:18 +0000] “GET /2007/06/07/im-not-the-only-one-to-love-the-alfa-147/ HTTP/1.0” 200 44967 “-” “-”
85.177.33.196 – – [03/Jul/2008:08:09:40 +0000] “GET /2005/03/01/i-am-bored-sites-for-when-youre-bored/all-comments/ HTTP/1.0” 200 410423 “-” “-”
85.177.33.196 – – [03/Jul/2008:08:09:44 +0000] “POST /xmlrpc.php HTTP/1.0” 200 249 “-” “XML-RPC for PHP 2.2.1”
85.177.33.196 – – [03/Jul/2008:09:00:09 +0000] “GET /2007/10/28/what-time-is-it-wordpress/ HTTP/1.0” 200 63332 “-” “-“

So, the spammer grabs “/2005/03/01/i-am-bored-sites-for-when-youre-bored/all-comments/” at 8:09am and 4 seconds later sends a trackback spam to the same blog post. Annoying isn’t it?

The following mod_rewrite rules will kill those fake GET requests dead.

# stop requests with no UA or referrer
RewriteCond %{HTTP_REFERER} ^$
Rewritecond %{HTTP_USER_AGENT} ^$
RewriteCond %{REMOTE_ADDR} !^64\.22\.71\.36$
RewriteRule ^(.*) – [F]

Replace “64\.22\.71\.36” with the IP address of your own server. If you don’t know what it is, look through your logs for requests for wp-cron.php, run ifconfig from the command line, or check with your hosting company.
Here are a few of the requests already stopped this morning:

72.21.40.122 – – [03/Jul/2008:09:59:59 +0000] “GET /2005/04/02/photo-matt-a-response-to-the-noise/ HTTP/1.1” 403 248 “-” “-”
216.32.81.66 – – [03/Jul/2008:10:00:11 +0000] “GET /2006/12/14/bupa-to-leave-irish-market/ HTTP/1.1” 403 240 “-” “-”
66.228.208.166 – – [03/Jul/2008:10:03:18 +0000] “GET /2008/05/23/youre-looking-so-silly-wii-fit HTTP/1.1” 403 212 “-” “-”
216.32.81.74 – – [03/Jul/2008:10:04:52 +0000] “GET /1998/03/22/for-the-next-month-o/ HTTP/1.1” 403 234 “-” “-”
69.46.20.87 – – [03/Jul/2008:10:06:06 +0000] “GET /2006/10/01/killing-off-php/ HTTP/1.1” 403 229 “-” “-”
72.21.58.74 – – [03/Jul/2008:10:07:54 +0000] “GET /2005/08/12/thunderbird-feeds-and-messages-duplicates/ HTTP/1.1” 403 255 “-” “-“

Some spam bots are stupid. They don’t know where your wp-comments-post.php is. That’s the file your comment form feeds when a comment is made. If your blog is installed in the root, “/”, of your domain you can add this one line to stop the 404 requests generated:

RewriteRule ^(.*)/wp-comments-post.php – [F,L]

Trackbacks and pingbacks almost always come from sane looking user agents. They usually have the blog or forum software name to identify them. Look for “/trackback/” POSTs in your logs. Notice how 99% of them have browser names in them? Here’s how to stop them, and this has been documented for a long time:

RewriteCond %{HTTP_USER_AGENT} ^.*(Opera|Mozilla|MSIE).*$ [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteCond %{REQUEST_METHOD} ^POST$
RewriteRule ^(.*)/trackback/ – [F,L]

I’ve been using that chunk of code for ages. It works exceptionally well. This was prompted by a deluge of 40,000 spam trackbacks this site received in one day a few months ago.

If you use my Cookies for Comments plugin. Check your browser for the cookie it leaves and use the following code to block almost all of your comment spam:

RewriteCond %{HTTP_COOKIE} !^.*put_cookie_value_here.*$
RewriteRule ^wp-comments-post.php – [F,L]

That will block the spammers even before they hit any PHP script. Your server will breeze through the worst spam attempts. It blocked 2308 comment spam attempts yesterday. Unfortunately it also stops the occasional human visitor leaving a comment but I think it’s worth it.

Do something different. That’s what you have to do. Place a hurdle before the spammers and they’ll fall. On that note, I shouldn’t really be blogging all this, but almost all these ideas can be found elsewhere already and the spammers still haven’t adapted.

Unwanted traffic? What’s that? Surely all visitors are good? Nope, unfortunately not. Robert alerted me to the fact that AVG anti-virus now includes an AJAX powered browser plugin called “Linkscanner” that scans all the links on search engine result pages for viruses and malicious code. Unfortunately that generates a huge number of requests for pages that are never even seen by the visitor. I counted over 7,000 hits yesterday.

Thankfully Padraig Brady has a solution. I hope he doesn’t mind if I reprint his mod_rewrite rules here (unfortunately WordPress changes the ” character so you’ll have to change them back, or grab the code from Padraig’s page.)

#Here we assume certain MSIE 6.0 agents are from linkscanner
#redirect these requests back to avg in the hope they’ll see their silliness
Rewritecond %{HTTP_USER_AGENT} “.*MSIE 6.0; Windows NT 5.1; SV1.$” [OR]
Rewritecond %{HTTP_USER_AGENT} “.*MSIE 6.0; Windows NT 5.1;1813.$”
RewriteCond %{HTTP_REFERER} ^$
RewriteCond %{HTTP:Accept-Encoding} ^$
RewriteRule ^.* http://www.avg.com/?LinkScannerSucks [R=307,L]

The EU Gravy Train

Irish MEP Kathy Sinnott and other MEPs filmed in Brussells at 7am on a Friday morning clocking in with bags packed. Oh dear.


Kathy Sinnott, fresh faced and angry after 7 hours work overnight.

Makes me wonder if I should have voted yes to Lisbon. Kathy Sinnott was looking for a No vote (no, she didn’t influence me) but perhaps the Lisbon Treaty would have stopped this sort of thing. Oh wait! Who am I kidding? Of course it’ll continue!

(via someone on who mentioned the video)

Update Kathy Sinnott published a fair video response to the RTL report. She doesn’t defend her colleagues, but makes it fairly clear (unless those emails were doctored which is easy, but I digress..) that she was working through the night. She also adds that the “[expenses] regime is ending in the next term”.
Via Fred, who came from here according to my logs so I presume he’s spreading the word.

Saor Patrol in Cork

Saor Patrol, a Scottish band “with their vibrant pipe tunes and drum rhythms [that] please and excite many a crowd” certainly lived up to their reputation when they played for the crowds in front of Brown Thomas on Patrick Street this afternoon.

I came upon them when they were nearly finished but the few minutes of music I heard was exciting and lively, and my son Adam totally enjoyed the spectacle. When the crowd clapped in appreciation, Adam joined in, and almost jumped out of his buggy to dance to the beat!

They were playing in Cork City Hall today as part of the Your Mental Health awareness campaign by the HSE. Depression and other mental health problems still have an awful stigma in this country. People can be reluctant to talk about those problems, families and friends hide them away, or pretend they don’t exist, but they’re health problems like any other. With the right treatment at the right time most people can be helped.

Listening to Saor Patrol certainly lifted my spirits. I was tired and worn down but their music reinvigorated me!

Edit – I was wrong. The mental health event they were promoting is a Scientology event. Not a HSE one. Can’t believe those maniacs managed to hire out City Hall. I definitely do not want to have anything to do with that crowd. Ugh.

Meadows Fringe Festival (doesn’t do them justice at all.)

WordPress Exploit Scanner 0.1

My previous post about hacked WordPress sites caused Donnacha to ask,

After your last post on this subject, I was thinking that it would be a good idea for Automattic to create a plugin that carries out all the checks you suggested people do to find out if they’ve been hacked…

At the time I wasn’t too optimistic about it but after thinking about the idea for a few days I came up with the WordPress Exploit Scanner which does most of what Donnacha wanted.

This WordPress plugin searches the files on your site for a few known strings sometimes used by hackers, and lists them with code fragments taken from the files. It also makes a few checks of the database, looking at the active_plugins blog option, the comments table, and the posts table.
It also allows the blog owner to search for whatever string they like which could come in handy when new exploit code is used in a hack.

You must be running WordPress 2.5.1 or higher to use this plugin. There’s not much point in finding exploited files if you’re running an old version of the software that can be broken into again.

Download the plugin from here: WordPress Exploit Scanner

Thanks to those who tested the plugin, especially Cathal Garvey who provided some great feedback!

Sweet Galaxy bites Super Mario Galaxy

I love to play Super Mario Galaxy on the Wii. The cartoon graphics, unusual planet based locations and gameplay make it really fun to play. It’s also relatively easy but I’m really stumped by Sweet Galaxy. Unlike every other galaxy in the game it’s a merciless obstacle course where Mario has to jump over gaping holes that move. Mistakes are cruelly punished and it is the most frustrating level I’ve played on any platform in a long time.

I even left the Wii switched on all day yesterday because I made it halfway through, but the final third of the level defeated me each time. Grrr.

Anyway, if like me you’re ready to give up on Super Mario Galaxy because of this level, here’s proof that it can be completed. I’ll try it again, once my left hand thumb recovers from twisting the nunchuk around.

(via)

In related gaming news. Boom Blox was fun for a while, but boy does it get boring quickly. Worse thing is, I paid the 20 Euro surcharge Irish shops charge for supporting local business. I could have bought it on play.com for 41 Euro, but Gamestop and Xtravision were both charging 59 Euro. Damn my need for instant gratification!

Back to Mario Kart Wii methinks.

Tom's going away dinner at Proby's Bistro

Last night a number of bloggers met in Proby’s Bistro for a dinner to see of Tom Raftery who’s leaving our fair isle and heading off to live in Spain next Sunday. I won’t bore you with details of who went and who said what to whom, but a good night was had by all! If you really must know who attended, Conor O’Neill listed each blogger’s Twitter account. Check out the gallery for more!

My wife noticed this morning that Tom was featured in yesterday’s Evening Echo. Alongside him are Pat Phelan of MAXroam and Catherine Wall of IT@Cork. That was the Echo with the photo of the Spencer Tunick Blarney shoot, so I’m sure that copy’s circulation numbers were up!
The last photo in the gallery is a shot of that image. Note the prominent WordPress sticker? Thanks Pat!

Continue reading “Tom's going away dinner at Proby's Bistro”