Recently we started to see a lot of WordPress sites hacked with malware hidden inside the wp_options -> siteurlpath table. The symptoms are very similar to the pharma hack (lots of SPAM hidden in the site), but in this case the SPAM is displayed to all users, not only search engines.
This is how an affected site looks like on our scanner:
To get started cleaning your site, you first have to make sure WordPress is updated. If it is not, go ahead and update it before doing anything else.
Cleaning up the file system
The first place you have to clean is the file system. On all the sites we’ve cleaned so far, the malware was hidden in three files: header.php, functions.php and a random image file (void.jpg, test.jpg, lol.jpg, etc). All of them are inside your themes directory.
Inside the header.php, they added the following code:
So it basically read the contents of void.jpg (which is not an image in reality, but a heavily encoded php backdoor):
… lots and lots more…
Inside the functions.php, at the very bottom, the following code was added to load the siteurlpath option from the database where the spam itself is hidden:
So removing these 3 files should clean the file system for this kind of hack.
Cleaning up the database
Run the following query to see if your database is infected:
> select * from wp_options where option_name = ‘siteurlpath’;
If you see a large spill of php code in there, it means the db is infected.
This code basically acts as a backdoor for the attackers and print the SPAM to everyone else. This is the beginning of the backdoor (Magic shell):
As far as the spam, it loads them from two sites: http://wplinksforwork.com and http://hemoviestube.com.
The code is full of protection to avoid getting detected and acts as a PHP bot to infect other sites. Both sites used to manage the SPAM bots point to the same IP address and we recommend hosting companies to block them:
# host hemoviestube.com
hemoviestube.com has address 184.108.40.206
# host wplinksforwork.com
wplinksforwork.com has address 220.127.116.11
You can see the scale of this attack by searching for these two sites on Google. You will see lots of sites generating errors when they were not able to reach the spam managers.
[function.file-get-contents]: failed to …..
We will post more details later about this attack, but this should be enough to clean up the affected sites.
If your site is hacked (or contains malware), and you need help, send us an email at email@example.com or visit our site: Sucuri Security Malware Removal. We can get your sites cleaned up right away.
Also, consider checking out our site security monitoring. We will monitor your sites 24×7 and alert you if it ever gets infected with malware, hacked or blacklisted.