-
9
Jun
This morning a client emailed me to report that their website had been hacked. The site ran a WordPress theme I had designed a few months ago and wasn’t held on any of my own servers but I was confident that I could get it back online, I mean, I think I’ve seen most WordPress-related hacks in my time right
wrong
Turns out the hack was pretty a sneaky malware re-direction that it only kicked in when a search engine query directed the user to the site.
This is especially sneaky as it means that the site owners who probably had the site in favorites or just typed in the domain would most likely never find the hack until it had been lurking for a while.
Investigation
The first thing I did was check the .htaccess and index.php files on the site. The .htaccess file looked fine, see:
So, I moved on…. I checked the database, nothing, the theme, all clean, the plugins, all the plugins, they were all clean. So what was it? I checked for malicious hidden files in the FTP folders I double checked the data I looked for anything and everything and nothing came up.
Google was no help either, this hack seemed to have been reported many times but it had many different solutions and none of them relevant here.
So a few hours into the investigation I went back to the start and checked the .htaccess file again. My plan was to add my own scripts to replace the default WordPress mod_rewrite code and see if it gleaned any results.
Doh!
Upon checking the main .htaccess file a 2nd time I noticed something that wasn’t obvious before:
GAH!! That’s it. The hacker had done the simplest of things to cover his tracks! By adding a few 1000 lines of whitespace and indenting the code in the .htaccess file it was hidden from view! I didn’t even think to scroll around the file the first time around!
So here it is the hack in all its glory:
A very simple hack but very sneakily done.
Fix
After removing the code the site now seems fine. How did it get there?? I really don’t know. The site isn’t hosted on any of my servers and I’m not contracted to find this out, the server tech can deal with that one. And I’m not even sure if its a WordPress-related hack, I mean, the rest of the site was clean. Only the .htaccess file had been messed with.
So if your site is sending you to malware portals or fake virus scanners then check your .htaccess file and please, dig around a little. Don’t waste 2 hours looking for something that isn’t there
one







