网站链接注入

时间:2010-01-30 00:56:00

标签: php scripting email hyperlink code-injection

我有一个相当静态的网站。它有一些表格可以发送联系信息,邮件列表提交等。也许在上传到网站后的几小时/几天我发现主索引页面中有新的代码我没有放在那里包含隐藏一堆看不见的div中的链接。

我有以下代码处理从表单发送的变量。

<?php
// PHP Mail Order to email@email.com w/ some error detection.

    $jamemail = "email@email.com";
    function check_input($data, $problem='')
        {
        $data = trim($data);
        $data = stripslashes($data);
        $data = htmlspecialchars($data);
        if ($problem && strlen($data) == 0)
            {
            die($problem);
            }
        return $data;
        }
    $email    = check_input($_POST['email'], "Please input email address.");
    $name    = check_input($_POST['name'], "Please input name.");

    mail($jamemail, "Mailing List Submission", "Name: " . $name . " Email: " .$email);
    header('Location: index.php');
?>

我在索引页面中有以下代码,用于提交表单,其中包含一些Javascript,以便在提交之前对提交内容进行错误检测。

    <form action="sendlist.php" method="post" onSubmit="return checkmaill(this);">
        <label for="name"><strong>Name: </strong></label>
        <input type="text" name="name"/><br />
        <label for="email"><strong>Email: </strong></label>
        <input type="text" name="email"/><br />
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="Subscribe" style="width: 100px;"/>
    </form>

在一天结束时,注入的超链接的源代码如下:

</body>

</html><!-- google --><font style="position: absolute;overflow: hidden;height: 0;width: 0">    
xeex172901
<a href=http://menorca.caeb.com/od9c2/xjdmy/onondaga.php>onondaga</a>
<a href=http://menorca.caeb.com/od9c2/xjdmy/tami.php>tami</a>
<a href=http://menorca.caeb.com/od9c2/xjdmy/shotguns.php>shotguns</a>
<a href=http://menorca.caeb.com/od9c2/xjdmy/weir.php>weir</a>
<a href=http://menorca.caeb.com/od9c2/xjdmy/copperhead.php>copperhead</a>
<a href=http://menorca.caeb.com/od9c2/xjdmy/mpv.php>mpv</a>
<a href=http://menorca.caeb.com/od9c2/xjdmy/brunei.php>brunei</a>
<a href=http://menorca.caeb.com/od9c2/xjdmy/doreen.php>doreen</a>

4 个答案:

答案 0 :(得分:1)

您的表单似乎不太可能与您的问题有关,更可能是您的ftp信息已被泄露。假设您使用ftp将更改上传到您的网站......

答案 1 :(得分:1)

除非有人可以物理访问您的服务器,否则这里有一个缺失的部分。您确定这是唯一运行的服务器端代码吗?

您不需要邮寄请求容易受到攻击。 XSS有各种形状和尺寸。

答案 2 :(得分:0)

我建议您升级wordpress

我发现另一个网站仍然使用相同的注入代码here,他们使用wordpress并在那里也有联系表单。

顺便说一下,您向我们展示的页面是在重定向页面之后,漏洞可能在contact.php或wordpress中。

答案 3 :(得分:0)

虚拟主机服务器遭到攻击,而不是大规模污损=用“IPWND!U”替换索引,他们只是选择传播病毒并对其控制的其他域使用blackhad seo,我建议你更改你的托管。 / p>