我们网站的一些用户在访问网站时已开始收到有关“木马威胁”的报告。听到这个后,我搜索了恶意软件代码,但找不到它。
我安装了Sucuci SiteCheck插件,并报告了以下内容:
http://sitecheck.sucuri.net/scanner/?&scan=http://www.londonirishcentre.org
有人会知道如何找到流氓代码吗?我知道一个新的WP安装是最好的,但该网站有很多自定义工作,我宁愿把它留给非常的最后选项。
任何帮助都会受到大力赞赏。
答案 0 :(得分:0)
在整个代码库中搜索:iframe
,eval
,base64_decode
可能有许多受感染的区域,但最有可能是templates文件夹或index.php
如果您无法搜索并删除所有需要从头开始安装新实例的区域。
答案 1 :(得分:0)
我在another recent stackoverflow question下面创建了这个函数,你需要找到一个受感染的php文件,在顶部或底部你会看到一个eval'ed base_64编码的字符串(它最有可能在每个文件中有所不同,所以寻找一个特定的字符串不会工作)但是使用这个函数,如果它是我怀疑的注入字符串,它将遍历整个项目并删除受感染的代码:
<?php
error_reporting(E_ALL);
//A Regex to match the infection string
$find='<\?php @error_reporting\(0\); if \(!isset\((.*?)\?>';
//Do It!
echo cleanMalware('./',$find);
function cleanMalware($path,$find){
$return='';
ob_start();
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if(is_dir($path.'/'.$file)){
$sub=cleanMalware($path.'/'.$file,$find);
if(isset($sub)){
echo $sub.PHP_EOL;
}
}else{
$ext=substr(strtolower($file),-3);
if($ext=='php'){
$filesource=file_get_contents($path.'/'.$file);
//The cleaning bit
echo "The infection was found in the file '$path/$file and has been removed from the source file.<br>";
$clean_source = preg_replace('#'.$find.'#','',$filesource);
// $clean_source = str_replace($find,'',$filesource);
file_put_contents($path.'/'.$file,$clean_source);
}else{
continue;
}
}
}
}
closedir($handle);
}
$return = ob_get_contents();
ob_end_clean();
return $return;
}
?>
祝你好运