Lion Cipher Lab

Build a PASETO v4 token service from scratch -- and see why it kills JWT's algorithm bugs by design

Why it matters

JWT's worst wounds are self-inflicted by its own design: it carries the algorithm INSIDE the token, in a header the attacker controls. That single choice spawned two infamous attack classes -- `alg:none` (trick a verifier into accepting an unsigned token) and RS256->HS256 confusion (sign a token with the server's PUBLIC key used as an HMAC secret) -- both documented in the IETF's own JWT Best Current Practices. PASETO's answer is not a better validator; it is a different shape. The version and purpose (`v4.public`) ARE the crypto suite, fixed and out of band, so there is no algorithm field to…

What you'll learn

Steps in this lab

  1. What you're building, and the one idea it rests on
  2. Set up: one install, everything else by hand
  3. The wire format and PAE, before we code it
  4. Write the token service (the full program)
  5. Run it and read the real output
  6. Why JWT's alg:none and RS256->HS256 cannot happen here
  7. The payoff: PAE catches a forgery a naive verifier accepts
  8. Judgment: what this token does NOT do, and when to still pick JWT

Open the full interactive lab →