Skip to content
Account takeover Write-up Intermediate

Account Takeover via Weak Password Reset Token Validation

The password reset token was a JWT signed with a weak secret, and the user ID inside was sequential and guessable. An attacker who cracked the secret could forge a token for any user and reset their password.

medium.com

Published on medium.com

Account takeover (ATO) vulnerabilities are among the most critical issues in modern web applications. During security testing, I identified a serious flaw in the password reset implementation of a popular web platform that could allow an attacker to reset any user’s password without authorization.

Aswin Thambi Panikulangara, on medium.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 reset token used a JWT signed with a weak, crackable secret and included a predictable sequential user ID, with no additional validation.

Impact

An attacker could reset the password of any user whose ID they could guess, leading to account takeover.

What the attacker needed

A valid account to request a reset; access to the reset email; ability to run a JWT cracking tool

The fix

The reset token should use a strong, random secret and a non-sequential, unpredictable identifier, and the server should validate the token properly.

How it was found

  1. Request a password reset for a valid account using the Forgot Password feature.
  2. Examine the reset link in the email, which contains two Base64-encoded parameters: id and payload.
  3. Decode the payload parameter to see it is a JWT containing only a user ID.
  4. Use a JWT cracking tool with a common wordlist to recover the signing secret.
  5. Request reset links for several accounts and notice the user IDs differ only in the last few digits.
  6. Forge a JWT with a guessed user ID, sign it with the recovered secret, and use it to reset that user's 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 password reset link usually contains a secret code that proves you own the account. Here the code was a type of token called a JWT, which is signed with a secret key. The key was weak enough to guess, and the user ID inside the token was easy to predict, so an attacker could make a valid reset link for someone else.

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.