Broken Access Control (IDOR) on Forgot Password Could Lead to Attacker Change Password for Every…
The password reset endpoint accepted a user-supplied userid parameter, allowing an attacker to change any user's password by substituting the victim's userid. The reset token was also not invalidated after use, enabling repeated resets.
Published on medium.com
In this post, I will show you how I discovered a vulnerability that allows a malicious user could change the password for other users which could lead to an account takeover. On another note, I also found that the forgot password token is not invalidated after use.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the password reset endpoint did not verify that the userid parameter matched the authenticated user or the token's owner, and the token was not invalidated after use.
Impact
An attacker could change the password for every user and perform an account takeover; additionally, a reset token could be reused if an attacker gained access to the victim's email.
What the attacker needed
Attacker has a valid account; victim's userid is known or guessable; attacker can complete reCAPTCHA
The fix
The endpoint should enforce proper authorization by matching the reset token or id to the original userid, and tokens should expire immediately after use.
How it was found
- Create two user accounts, attacker and victim.
- As attacker, go to the login page and click 'FORGOT PASSWORD'.
- Enter the attacker's email, complete the reCAPTCHA, and send the reset link.
- Open the recovery email and click the reset link.
- Set a new password and submit; observe the API request containing id and userid.
- Change the userid parameter to the victim's userid and submit; the victim's password is reset.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When you reset a password, the website should only change the password for the account that requested the reset. Here, the request included a user ID that could be swapped to someone else's, so an attacker could reset anyone's password. Also, the reset link kept working after it was used once.
What is IDOR?
One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.