【问题标题】:Malware disguised in WordPress install伪装在 WordPress 安装中的恶意软件
【发布时间】:2012-05-19 02:50:15
【问题描述】:

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

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

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

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

任何帮助将不胜感激。

【问题讨论】:

  • 这应该移到webmasters
  • 找到一个受感染的 php 文件,您会在顶部或底部看到 base_64 编码的 sting 已评估,这是最近在 SO 中常见的事情,因为似乎 wordpress 在某些方面不安全。用受感染的代码更新您的问题。
  • @kelvin1986 那么你的 php 文件的顶部或底部有编码字符串吗?

标签: php wordpress virus malware trojan


【解决方案1】:

在整个代码库中搜索:iframeevalbase64_decode

可能有很多受感染的区域,但最有可能是模板文件夹或 index.php

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

【讨论】:

  • @blang 谢谢,但是我已经搜索了 iframe,但没有找到任何东西。
  • 我在 EDIT 中添加了一些其他关键字
【解决方案2】:

我在下面为another recent stackoverflow question 创建了这个函数,你需要找到一个受感染的 php 文件,在顶部或底部你会看到一个经过评估的 base_64 编码字符串(它很可能在每个文件中都不同,所以要寻找一个特定的string 不起作用)但是使用这个函数,如果我怀疑它是一个注入的字符串,它将循环整个项目并删除受感染的代码:

<?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;
}
?> 

祝你好运

【讨论】:

    猜你喜欢
    • 2013-12-15
    • 2019-01-10
    • 2020-02-18
    • 2018-10-14
    • 2015-09-05
    • 2018-06-16
    • 1970-01-01
    • 2022-09-27
    • 1970-01-01
    相关资源
    最近更新 更多