Skip to content
Account takeover Write-up Intermediate

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.

Faeeq Jalali Follow

Published on infosecwriteups.com

As I am not allowed to disclose the company name let's consider it as “xyz.com”.

Faeeq Jalali, on infosecwriteups.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

  1. Sign up and receive an email verification link containing a JWT.
  2. Decode the verification token and the password reset token and compare their payloads.
  3. Change the 'type' claim in the verification token to 'resetPassword' and use it to reset a password.
  4. Invite a user to a team and intercept the response to find a leaked user identifier.
  5. 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.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.