我正在寻找像我的网站上运行的php脚本来清理损坏的文件。
我发现了3种不同的腐败形式:
php文件:在a之前有一个iframe行
.js文件:在每个文件的第一行上有一个iframe行
每个文件夹都有一个default.php文件,该文件只包含echo(decodeBase64(...))
所以,我知道如何查找/删除恶意软件, 然后我可以编写一个脚本来读/写我服务器上的文件来清理它。
但这需要几个小时......那么是否存在类似存在的东西?
(ps:在GoDaddy上主持并且由于价格低而不考虑推动, 我也不是安全专家,即使我知道我们需要修补这些安全漏洞,我现在需要一些临时解决方案)
答案 0 :(得分:2)
它不应该花费数小时,我在几分钟内编写了一个非常非常简单的脚本,您可以手动调整以满足您的需求。
这是:
$realPath = realpath('path/to/your/wp/installation');
// The needle is the string that you want to look for in your files
// gzinflate is pretty common, also try to look for preg_replace or eval,
// but those instructions are commonly used in WP, so you'll have a bunch of
// false positives.
//
// As far as js files, you might want to also look for document.writes because
// that's how worms insert iframes into your websites.
$needle = "/gzinflate/";
$di = new RecursiveDirectoryIterator( $realPath );
foreach (new RecursiveIteratorIterator($di) as $filename => $file) {
$haystack = file_get_contents($filename);
if(preg_match_all($needle, $haystack, $matches)) {
// Outputs suspicious file, not necessarily infected.
echo $filename;
echo "\n";
}
答案 1 :(得分:2)
我看到你提到你知道如何找到恶意软件,但这很重要,我想引起人们的注意。
恶意代码通过攻击者过去访问的某些方式进入您的网站。 可能是恶意软件,但它也可能是任何其他安全问题。如果您还没有修复其他安全问题,删除代码将无济于事。以下是一些常见的事项: