Spam Link Injection Sucks

Over the past few days, I’ve been helping out someone with their blog as it’s become compromised by some nasty injection code. This code is in his php files, in his content, and his database. I have no idea how it happened except that his plugin and theme folders had a permission level of 777. On top of that, I discovered some malicious themes within the themes folder containing the base64 encrypted code which I believe to be the hidden spam links.

I told him to do a fresh install the first time around which is what he did via Fantastico only to have the problem resurface. Again, the themes and plugin folders had a permission level of 777 and I found out this was because of a plugin he had installed called One Click Updater.

Currently this plugin only uses direct file access to update and install plugins/themes, so you’ll need to make the “/wp-content/plugins/” and “/wp-content/themes/” folders writable by PHP for this to work.

Either he didn’t know he could do the same thing in WordPress since version 2.7 or core plugin upgrades didn’t work. In any case, I believe the permission level to be a source of the problem. As it turned out, his database was clean but certain files located within rogue themes were injecting the encrypted code into all of his content which was only viewable by checking the source code of the site. In the end, I finally exported his site via the WXR export feature, gave him a fresh install of WordPress, imported the WXR file and told him to stay 5 miles away from the One Click Update plugin or any plugin that needs permissions for folders to be 777. Once his fresh site was online, all traces of the spam links were gone meaning his database was clean, his WXR file was clean, and he was a happy camper.

Now you might be wondering, why didn’t this guy do all of this himself? Well, he is in a unique situation where the only thing he owns is an N95 phone powered by S60. He maintains and writes content for his blog all through this phone. It’s his only connection to the digital world. So, uploading and doing things that come easy on a desktop PC is not so when all you have is a handheld phone. I give this guy a lot of credit.

To bring this back full circle, I encourage you to read Chris Coyier’s experience where he explains how his notable site CSS-Tricks ended up with hidden spam links within the content of the site and how he was able to get rid of them.

I guess we should be checking the source code of our own sites more often?

4

4 responses to “Spam Link Injection Sucks”

  1. The most common cause of spam injections is being on a poorly configured shared server. Some other site on the server gets hacked, the hacker runs a script on the server that searches for and auto-hacks anything it can find, done.

    A properly secured shared server won’t have this problem. Hacking one site on the server will not give the person access to the whole of the server. A server that uses suPHP is a good first step towards this.

    So, my advice would be to find a webhost that actually knows what they’re doing when it comes to security. Oddly enough, one that I’ve found happens to be GoDaddy. Their shared web servers may be slow and overloaded, but they are indeed secure. I guess when you stick 3k users onto a box, you have a sudden need for real security. ;)

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.