Discovering Account Takeover Vulnerability Through Source Map Analysis
A JavaScript source map was publicly accessible, exposing unobfuscated front-end code that revealed a password-change endpoint. The endpoint lacked authorisation checks, so an attacker could change the password of any account, including a partner account, and take it over.
Published on medium.com
Hello! I want to share an experience I had while searching for vulnerabilities.
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-change endpoint performed no authorisation or identity check on the caller, and the source map exposing the endpoint was left publicly accessible.
Impact
An attacker could change the password of any account whose email address they knew, leading to full account takeover.
What the attacker needed
Knowledge of the victim's email address; publicly reachable source map file
How it was found
- Find a JavaScript bundle file ending in chunk.js on the target site.
- Append .map to the bundle URL to retrieve the full source code.
- Read the code to find the password-change endpoint and its required fields.
- Call the endpoint with a valid email and a new password and receive a success response.
- Log in to the targeted account 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.
Websites often ship JavaScript in bundles, and a source map is a companion file that maps that bundle back to the original readable code. Here the server handed out that map to anyone, so the hidden code could be read. The password-change function in that code did not check who was calling it, so anyone who knew an email address could set a new password for that account.
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.