Skip to content
Account takeover Write-up Beginner

How I Exploited a JWT Misconfiguration for Account Takeover and Admin Access in 5 Minutes

The application accepted HS256 JWTs signed with an empty key, so an attacker could forge tokens with any payload. By changing the user type to Admin and altering the user ID, the author gained admin access and accessed other users' profiles.

P4RAD0X Follow

Published on medium.com

Hey there, back again with another post! 😄 In this post I’ll be sharing an interesting finding from an internal web pentest where I discovered an account takeover vulnerability caused by a JWT misconfiguration. In this write-up, I’ll walk you through my approach step by step how I identified the flaw and ultimately…

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

Likely the server was configured with an empty or missing HS256 signing secret, so it accepted tokens with no valid signature.

Impact

An attacker could forge tokens to impersonate any user, including admins, leading to full account takeover and privilege escalation.

What the attacker needed

Access to a valid JWT token; ability to send modified tokens

How it was found

  1. Capture the application's JWT token.
  2. Check the token algorithm with jwt_tool and find it uses HS256.
  3. Attempt to crack the signing key with hashcat and rockyou.txt.
  4. Notice no key is found, indicating an empty signing key.
  5. Use the JWT Editor extension in Burp Suite to create a token with an empty signature and a modified payload.
  6. Change the user type to Admin and modify the user ID, then use the token to access other users' profiles.

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 piece of data a website gives you after login to prove who you are. The signature is meant to stop people editing the token, but here the signing key was empty, so anyone could make their own token claiming to be an admin or another user.

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.