0
Wordpress Hidden Link Injection Fix
Detection
Seeing if your Wordpress install has been compromised is easy. Simply view the source of your homepage and look for any code that does not belong. Check near the top and near the bottom of the file as this is the place I've found the hidden links to mostly exist. They're also usually wrapped in HTML comments.
Some website 1
Some website 2
...
Some website n
If you see code like that, chances are, you are a victim of the Wordpress Hidden Link Injection exploit.
How are "they" doing this?
Apparently, there was a security hole in Wordpress versions 2.8.x that allowed outside users to hijack the /wp-admin/upload.php file and insert files on your server that could be used for all sorts of malicious purposes. One of those purposes is the hidden link injection. Wordpress 2.9 fixed this hole, however, simply upgrading is not enough. Outside users will no longer be able to hijack upload.php but the files that they have already inserted will still orchestrate the attack.
That's why simply removing the links from header.php or footer.php (the two places I've seen the links) is not enough. You'll notice that the links will simply reappear. We've got to treat the disease now, not just the symptom.
Fixing the problem
First and foremost, always keep your Wordpress install up-to-date! Updating could not be any easier. Simply click on the alert that appears at the top of your Dashboard and follow the instructions. It takes literally 10 seconds.
Next, change the admin Wordpress user's password. Also change your MySQL user's password.
Lastly, find the files that have been inserted by the exploit via upload.php. I have found two separate instances of these files, both located in the wp-includes folder. Check the permissions of each of the files in wp-includes and investigate any file that has 777 permission (that's your first clue that something is wrong). class-rss.php and feed-atom2.php are two files that I have seen cause issues. Cleverly named files. These two files are not native to the Wordpress codebase and can be safely removed. If you were to open either of these files and know a bit of PHP, you'll see that these files are certainly the culprit.
Going through these steps should safeguard your Wordpress installation against the hidden link injection exploit.
Stay vigilant
Just because we've fixed this does not guarantee that you'll be immune forever. Hackers are constantly looking for newer and better ways to tear stuff up. Wordpress has been exceptionally good at patching security issues, but someone somewhere has to be the guinea pig to get hit with an attack - and then report it to Wordpress.
One great plugin I've begun to use is Wordpress File Monitor. This plugin scans your Wordpress installation and reports if any files have been added, deleted, or changed. The plugin is customizable to run on a schedule that you set. You can also exclude directories from the plugin's reporting so that you're not alerted every time you upload a picture to insert into a post. I, however, recommend that you do not exclude directories as that directory may be the next location of the next exploit.
Brian Onorio is the President and CEO of O3 Strategies, a Raleigh web design and development group. O3 provides strategies that help small businesses nationwide successfully launch and maintain web presences and online brands.