Skip to content
Account takeover Write-up Intermediate

How I Hacked JWT Tokens and Became Everyone on the Internet (Temp

The API accepted JWT tokens with the 'none' algorithm and also allowed algorithm confusion and weak secret brute-forcing, enabling an attacker to forge admin tokens and take over any account.

iski Follow

Published on infosecwriteups.com

Free Link🎈

Iski, on infosecwriteups.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 failed to properly validate the JWT signature and algorithm, accepting tokens with 'none' algorithm, allowing algorithm confusion, and using a weak secret.

Impact

An attacker could forge tokens to become any user, including administrators, access all user data, and reset passwords, leading to complete platform compromise.

What the attacker needed

A free account; ability to intercept HTTP traffic

How it was found

  1. Create two test accounts and capture login traffic to obtain a JWT.
  2. Modify the JWT to use the 'none' algorithm and send it to an admin endpoint.
  3. Find the public key in JavaScript files and create a token using HS256 with the public key as secret.
  4. Brute-force the JWT secret to find a weak secret.
  5. Forge tokens to become any user, including admin, and access sensitive endpoints.

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 like a digital ID card that a website gives you after login. The server checks the token's signature to make sure it's real. Here, the server didn't check properly, so someone could make a fake ID card and pretend to be anyone, even an administrator.

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.

More by iski

View all

186 more disclosed reports, best first.

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.