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.
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.
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
- Register and log in to the application while capturing traffic in a proxy.
- Decode the issued token and note the user identifier and role fields.
- Notice the proxy flags the token as signed with a default secret.
- Write a script that mints tokens for a range of user identifiers and role values.
- Send each forged token to the current-user endpoint and keep responses that return success.
- 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.