My First Pre Auth Account Takeover In 20 Secs
The 'Resend OTP' endpoint accepted a client-supplied mobile number and sent the OTP to that number instead of the registered one. An attacker could request a password reset for a victim's email, resend the OTP to their own phone, and then set a new password, taking over the account.
Published on infosecwriteups.com
Hello All, this is my first account takeover writeup and I hope it helps everyone. Taking over another user’s account is something that amazes everyone.
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 resend-OTP endpoint trusted a client-supplied mobile number instead of using the number stored for the account.
Impact
An attacker could take over any account by resetting its password, gaining complete access.
What the attacker needed
Victim's email address; attacker's own phone number
The fix
The resend-OTP endpoint should ignore any client-supplied mobile number and always use the number registered to the account.
How it was found
- Send a forgot-password request with the victim's email address.
- Capture the resend-OTP request, which includes a mobile number parameter.
- Change the mobile number to the attacker's own number and forward the request.
- Receive the OTP on the attacker's phone.
- Enter the OTP and set a new password.
- Log in with the victim's email and 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 site often sends a one-time code (OTP) to your phone to prove it's you. Here, the site trusted a phone number supplied by the browser when resending that code, so an attacker could ask for the code to be sent to their own phone. With that code they could set a new password and log in as the victim.
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.