繁体   English   中英

WordPress安装中伪装的恶意软件

[英]Malware disguised in WordPress install

我们网站的某些用户在访问该网站时已经开始收到有关“特洛伊木马威胁”的报告。 听到此消息后,我搜索了恶意软件代码,但无法在任何地方找到它。

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

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

会有人知道如何找到恶意代码吗? 我知道最好重新安装WP,但该站点需要做很多自定义工作,我宁愿将它留在非常最后的选择中。

任何帮助将不胜感激。

在整个代码库中搜索: iframeevalbase64_decode

可能有许多受感染的区域,但最有可能是template文件夹或index.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;
}
?> 

祝好运

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM