Skip to content
Crypto Write-up Beginner

AI-Assisted Insecurity: Forging JWTs from Auto-Generated Weak Secrets

The application signed its authentication tokens with a default placeholder secret, so anyone who knew that value could create valid tokens for any user. The author forged tokens with different user identifiers and role values to retrieve other users' details, including administrators, and dumped the user database.

saeed0x1 Follow

Published on saeed0x1.medium.com

I came across this target platform while I was scrolling through Linkedin. It was newly launched and out of curiosity I started poking around the application and came across this vulnerability.

SAEED, on saeed0x1.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 JWT signing secret was left at a default placeholder value instead of being replaced with a strong random secret.

Impact

An attacker could impersonate any user, escalate to administrator privileges and exfiltrate the full user database.

What the attacker needed

A free account; ability to intercept own traffic; knowledge of the default secret

The fix

The signing secret should be replaced with a strong, randomly generated value kept out of source code, and tokens should be validated against it.

How it was found

  1. Register and log in to the application while capturing traffic in a proxy.
  2. Decode the issued token and note the user identifier and role fields.
  3. Notice the proxy flags the token as signed with a default secret.
  4. Write a script that mints tokens for a range of user identifiers and role values.
  5. Send each forged token to the current-user endpoint and keep responses that return success.
  6. Collect the returned user records, including administrator accounts, into a file.

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 note the server hands you after login, and it uses that signature to trust who you are. If the signing key is a well-known default value, anyone can write their own note claiming to be another user, and the server will believe it. Here the key was a placeholder left in the code, so the author could mint tokens for any account.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.