Skip to content
Crypto Write-up Intermediate

JWT Authentication Bypass via Weak Signing Key

The application used a weak JWT signing key that could be brute-forced, allowing an attacker to forge a token with administrator privileges and access the admin panel to delete users.

medium.com

Published on medium.com

This scenario focuses on a JWT-based authentication system that relies on a dangerously weak signing key. Because JSON Web Tokens must be signed with a secret known only to the server, the strength of that secret defines the integrity of every session.

Bash Overflow, 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 application used a weak, guessable secret key to sign JWTs, allowing brute-force recovery of the key.

Impact

An attacker could forge valid tokens for any account, including administrators, bypassing authentication and authorization controls.

What the attacker needed

A free account; ability to intercept HTTP traffic; access to a wordlist of common JWT secrets

The fix

The application should use a strong, randomly generated secret key that is not guessable.

How it was found

  1. Log in as the standard user wiener.
  2. Install the JWT Editor extension in Burp Suite and observe the JWT session cookie.
  3. Attempt to access /admin and confirm access is denied.
  4. Download a wordlist of common JWT secrets.
  5. Run Hashcat in mode 16500 with the JWT and wordlist to crack the signing key.
  6. Use jwt.io to change the sub claim from wiener to administrator, re-sign with the recovered key, and replace the session cookie to access /admin and delete user carlos.

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 tamper-proof ID card that the server gives you after login. The server signs it with a secret key so it can tell if someone changed it. Here the secret was easy to guess, so an attacker could make their own ID card claiming to be an administrator.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.