How did I found Account Takeover Vulnerability on takeuforward.or
The password reset flow stored a bcrypt hash of the OTP in a client-side cookie and compared the submitted OTP against that cookie value. An attacker could replace the cookie with a hash of a known OTP and reset any user's password without knowing the real OTP.
I was scrolling through YouTube looking for DSA videos when I stumbled upon TakeUForward, a channel run by Raj Vikramaditya (better known as Striver). I noticed they are recently launched their own DSA platform, only about a month old at the time.
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 server trusted a client-side cookie containing the hashed OTP for verification instead of storing the OTP hash server-side and comparing against that.
Impact
An attacker could reset any user's password without knowing the real OTP, leading to account takeover.
What the attacker needed
A registered account; ability to intercept and modify requests
The fix
The vulnerability was fixed by the vendor, likely by moving OTP verification to the server side.
How it was found
- Go to the login page and click the 'Forgot Password?' link.
- Enter your email address and submit the form.
- Receive the OTP by email and open the reset page.
- Submit a random OTP and a new password while intercepting the request.
- Notice an OTP key cookie containing a bcrypt hash of the OTP.
- Generate a bcrypt hash of your chosen OTP with the same cost factor, replace the cookie value, and resend the request.
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 email. This site put a scrambled version of that code in a cookie stored in your browser, and checked your entered code against the cookie instead of a server-side record. Because the cookie could be edited, anyone could put in their own scrambled code and reset someone else's 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.