在WordPress安装中伪装的恶意软件


Malware disguised in WordPress install

我们网站的一些用户在访问该网站时开始收到"特洛伊木马威胁"的报告。听到这个消息后,我搜索了恶意软件代码,但在任何地方都找不到它。

我安装了Sucuci SiteCheck插件,它报告了以下内容:

http://sitecheck.sucuri.net/scanner/?&scan=http://www.londonirishcentre.org

有人知道如何找到流氓代码吗?我知道一个新的WP安装是最好的,但该网站已经完成了很多自定义工作,我宁愿将其留给最后一个选项。

任何帮助将不胜感激。

在整个代码库中搜索:iframeevalbase64_decode

可能有许多受感染的区域,但它很可能是模板文件夹或索引.php

如果您无法搜索和删除需要从头开始安装新实例的所有区域。

我在下面为另一个最近的 stackoverflow 问题创建了这个函数,您需要找到一个受感染的 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;
}
?> 

祝你好运