How I Found an Account Takeover Bug in the Forgot Password Flow
The password reset API returned the reset token in its response body instead of only sending it by email. An attacker could request a reset for any account, read the token, and set a new password, taking over the account.
medium.com
Published on medium.com
While I was hunting on a target, I came across an acquisition related to it, so I decided to look around the new domain. It immediately caught my eye because it was an e-commerce application with registration and login functionality.
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
The server included the password reset token in the API response body instead of delivering it only to the user's email.
Impact
An attacker could take over any account without access to the victim's email, exposing personal information and enabling fraud on e-commerce accounts.
What the attacker needed
A free account; ability to send a password reset request
The fix
The reset token should be generated server-side and delivered only via the user's registered email, never in the API response.
How it was found
- Create an account and complete email verification.
- Submit the forgot password form for an email address while capturing traffic.
- Inspect the response to the reset request and note the reset token in the body.
- Build the password reset URL using the token and open it in a private browsing window.
- Enter a new password and save, then log in with the new password.
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 forget your password, a website usually emails you a special link containing a secret code. That code proves you own the email address. Here, the website also put that secret code in the reply it sent back to the browser, so anyone who asked for a reset could see it and use it to change the password.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.