JWT the Hell?! How Weak Tokens Let Me Become Admin with Just a Te
A hardcoded JWT found in a production JavaScript file was signed with a weak secret, allowing the author to forge an admin token and access the admin dashboard. The author also claims to have found a .env file, spoofed internal API access, and performed SSRF from the admin panel.
Free Link 🎈
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 weak and guessable, and the token was hardcoded in client-side JavaScript.
Impact
An attacker could gain admin access to the dashboard, exposing user PII, internal support tickets, API keys, and production logs; the author also claims to have found a .env file, spoofed internal API access, and performed SSRF.
What the attacker needed
Access to the public JavaScript file; Knowledge of common weak secrets
The fix
The text does not state that the issue was fixed; it should be fixed by using a strong, randomly generated JWT secret, not hardcoding tokens in frontend code, and validating roles server-side.
How it was found
- Find a hardcoded JWT in a minified JavaScript file.
- Decode the token to see the algorithm and payload.
- Crack the weak secret using a wordlist.
- Modify the payload to set role to admin.
- Re-sign the token with the cracked secret.
- Replace the token in the request header and access admin routes.
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 token a website uses to remember who you are. If the secret used to sign it is easy to guess, an attacker can make their own token claiming to be an admin. Here, the secret was found by guessing common passwords.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.