Skip to content
Account takeover Write-up Beginner

How One Accidental Find Led to Full App Security Testing

The app signed JWT authentication tokens with a weak HMAC key, so an attacker who knew a victim's phone number could forge a token and access that user's account. This exposed personal and financial data and allowed full account takeover without any user interaction.

hasirhamdan77 Follow

Published on medium.com

Two days back, a friend suggested that I check out an app where you can invest in gold for your future. It seemed like a solid idea an easy way to save for the long term with a platform that claimed to be “safe, secure, and reliable.”

Hasirhamdan, 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

The application used a weak, easily guessable HMAC secret to sign JWTs, allowing token forgery.

Impact

An attacker could take over any user's account and view sensitive personal and financial information, including PAN card numbers and wallet details, without any user interaction.

What the attacker needed

Knowledge of victim's phone number; ability to intercept HTTP requests

The fix

The application should use a strong, randomly generated secret for signing JWTs instead of a weak, guessable key.

How it was found

  1. Log in as a regular user with a phone number.
  2. Capture the profile request in Burp Suite and note the Authorization header containing a JWT.
  3. Crack the JWT signing key using jwt_tool with a wordlist of common passwords.
  4. Edit the token's sub field to another user's phone number using a Burp extension.
  5. Re-send the request with the forged token to access the other user's data.

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 JWT is a signed token the app uses to remember who you are. If the secret used to sign it is easy to guess, an attacker can create their own valid token for any user. Here the secret was a very common four-digit number, so the attacker could pretend to be anyone whose phone number they knew.

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.