Vertical Privilege Escalation: How I Gain Full Admin Account Take
The application signed its JSON Web Tokens with a weak, guessable secret, and the token's subject claim decided which user the request acted as. An attacker who cracked the secret could forge a token naming an administrator and reach admin-only endpoints, including password reset and privilege changes.
Published on mahmoud-khalid.medium.com
In the name of God, the most gracious, the most merciful. May Allah’s blessings and peace be upon our Prophet Muhammad
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 server used a low-entropy symmetric signing secret for its JWTs and trusted the token's subject claim for authorisation, so a forged token with an admin subject was accepted.
Impact
The attacker could reach restricted endpoints, generate password reset links for any user, and remove or escalate any account, leading to a complete admin account takeover.
What the attacker needed
A free account; ability to intercept traffic; weak JWT signing secret
The fix
The application should sign tokens with a complex, high-entropy secret that resists brute-force guessing.
How it was found
- Create a normal account and browse the app with an intercepting proxy running.
- Review the captured API responses and notice the admin and moderator flags returned in the body.
- Try adding those flags to the request body; the server ignores them.
- Try rewriting the flags in the response; only client-side features appear and the admin panel still returns 403.
- Crack the JWT signing secret with a wordlist-based tool.
- Register the recovered symmetric key in the proxy's JWT editor, change the subject claim to the admin username, re-sign the token and replay the admin panel request.
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 gives you after login, saying who you are. If the signing key is easy to guess, anyone can write their own note claiming to be an administrator, and the server will believe it. Here the key was weak enough to crack offline, so the attacker could pretend to be the admin.
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.