Compromised sites being injected with SPAM SEO is something we deal very often. A few months ago we wrote about a wave of SPAM injections known as HideMe.
However, the bad guys are always getting more and more “creative”, and they’ve developed a better version of that SPAM, called “HideMeBetter”. Yes, that’s their own naming scheme.
It basically follows the same principle by adding SPAM content inside a <div> and calling it in a subsequent <script> tag as you can see below:
This time, instead of adding a huge amount of content inside the <div> that could be easily flagged, they just added an <a href> tag to a specific malicious website.
Although it’s very similar to the original version and we know it’s malicious, this code is very hard spot.
You may ask why and the answer is really simple:
- The code is not obsfucated, therefore it wouldn’t raise any red flags;
- Unless you know the exact content you have in each file, you may never see that;
- If you are not experienced with this type of issue, it may go unnoticed;
Here are though a few steps you could take in order to prevent that.
- Monitoring: Unfortunately new malware and backdoors are created every single day, having a monitoring system in place may help you in detecting issues early on and avoiding further problems, such as getting blacklisted by search engines, AV software and others;
- File Checksum: This is also a great way to detect and verify the integrity of your files. It’s a huge red flag if the checksum from any file in your server changes without you actively interacting with it.
- Backups: Having regular backups of the working version of your website may ease the recovery process just in case something bad happens and you have to revert a specific file.
Cleaning up the Infection
In this case, the malicious code was inserted inside the WordPress theme index.php file and to remove it was pretty simple.
*Keep in mind that other files such as footer.php, header.php, home.php, 404.php or any other file that displays content to the user could be used to spread the SPAM links.
Just open the file inside a text editor and remove the content we displayed above.
Starting from the <div> here up to </div>:
And then the closing it:
Safe hunting, and we can only hope that we are not going to see a HideMeBetterAndImproved version in the future 🙂