From data leak to account takeover
The API returned excessive user data including password hashes and email verification tokens, and team information leaked password reset tokens of team members. An attacker could invite a target to a team, leak their reset token, and change their password, leading to account takeover.
Published on dev.to
While browsing the web, I ended up finding a startup which recently launched its product. Like any normal person, I decided to perform a security audit to hopefully find 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
The API returned the entire user document and team information, including sensitive fields like password hashes and password reset tokens, to the client.
Impact
An attacker could take over any account by leaking password reset tokens, and also lock the user out by changing and validating a new email.
What the attacker needed
A free account; victim's email address
The fix
The API should only return necessary fields and never expose sensitive tokens or password hashes.
How it was found
- Perform a password change request for the target user.
- Create a new team.
- Invite the target user to the team.
- Leak the password reset token via the team information returned by the API.
- Change the victim's password using the leaked token.
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.
The app's API sent back more information than needed, like a scrambled version of the password and special tokens used to verify email or reset passwords. An attacker could use these tokens to take over other people's accounts by inviting them to a team and reading their reset token.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.