Lion Cipher Lab

Forge a JWT with an algorithm-confusion attack (RS256 to HS256)

Why it matters

A JWT is the little signed token that says 'this is who the user is' on countless APIs and single-page apps. If the code that CHECKS the token trusts the token to name its own signing algorithm, an attacker can rewrite the token to say 'I am admin' and re-sign it with a key everyone already has. Algorithm confusion is one of the most common critical JWT flaws, and once you've forged one by hand you will never again write a verifier that trusts the header.

What you'll learn

Steps in this lab

  1. What a JWT is, in one breath
  2. Set up a clean workspace
  3. Generate the server's RSA keypair
  4. Mint a legitimate RS256 token
  5. Build the vulnerable verifier (the real bug pattern)
  6. Forge an admin token with the public key
  7. Land the attack
  8. Fix it: pin the algorithm allowlist
  9. When it bites, and how a pro shuts the door

Open the full interactive lab →