首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >$_REQUEST php漏洞

$_REQUEST php漏洞
EN

Stack Overflow用户
提问于 2022-10-09 09:04:07
回答 1查看 62关注 0票数 -2

这是一个关于网络安全的问题

大家好,我正在用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'

首先,为什么我们需要usernamePOST??以及为什么我们没有在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

EN

回答 1

Stack Overflow用户

发布于 2022-10-09 09:44:52

您尚未共享的代码可能会执行如下操作:

代码语言:javascript
复制
$reset_token = make_reset_token_for($_GET['email');
send_reset_token_to($reset_token, $_REQUEST['email']);

因此,它读取电子邮件地址以从查询字符串生成重置令牌(并更新数据库中该电子邮件地址的帐户信息),然后将重置令牌发送到请求主体中的电子邮件地址(这是攻击者的地址,而不是帐户所有者的地址)。

这样攻击者就可以使用重置令牌更改帐户所有者的密码,然后登录到他们的帐户。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74003422

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档