Account Takeover By Tampering The Signup Verification Token
The signup verification and password reset links used JWTs with the same structure, differing only in a 'type' claim, and the server did not check that the token was issued for the intended purpose. An attacker could change the type to reset a password, and by also changing the user identifier (leaked when inviting users) could take over other accounts.
Published on infosecwriteups.com
As I am not allowed to disclose the company name let's consider it as “xyz.com”.
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 accepted a JWT for password reset without verifying that its 'type' claim matched the intended action, and it trusted the user identifier inside the token without binding it to the requester.
Impact
An attacker could take over any account by resetting its password, provided they could obtain the victim's user identifier, which was leaked in the invite response.
What the attacker needed
A free account; victim's user identifier (leaked via invite)
The fix
The server should verify that the token's 'type' claim matches the action being performed and should not trust a user identifier supplied in the token without additional checks; the report says the issue was resolved.
How it was found
- Sign up and receive an email verification link containing a JWT.
- Decode the verification token and the password reset token and compare their payloads.
- Change the 'type' claim in the verification token to 'resetPassword' and use it to reset a password.
- Invite a user to a team and intercept the response to find a leaked user identifier.
- Change the '_id' claim in the tampered token to the victim's identifier and reset their 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.
A JSON Web Token (JWT) is a signed piece of data a website gives you to prove who you are or what you are allowed to do. Here the same kind of token was used for two different jobs (verifying an email and resetting a password), and the site did not check which job the token was for. By editing the token's stated purpose and user ID, an attacker could 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.