DEV Community

Jason Y. (dev_in_the_fog)
Jason Y. (dev_in_the_fog)

Posted on

Stop Pasting Production JWTs Into Online Decoders: Auditing alg: none, Missing exp, and Payload Leaks Locally

When debugging a 401/403 incident, it is tempting to copy a live Authorization: Bearer eyJ... header into the first JWT decoder returned by search. If that site logs inputs or runs third-party trackers, you just leaked a valid production session token.

Because JWT headers and payloads are plain Base64URL JSON (not encrypted), inspecting and auditing them takes zero network calls.

1. Header Traps That Still Show Up in Audits

  • alg: "none": Always pin an explicit algorithm allowlist (e.g., RS256, ES256) on the verifier rather than trusting header.alg.
  • RS256 -> HS256 Key Confusion: Passing a PEM public key into a verifier that accepts HS256 lets anyone forge tokens signed with the public key bytes.
  • Unsanitized kid / Remote jkuยทx5u: Never interpolate kid directly into file paths or SQL queries, and block arbitrary remote key URLs.

2. Claim & Operational Footguns

  • Missing exp creates tokens that stay valid forever if leaked.
  • Missing aud / iss allows cross-service token replay inside shared IdP tenants.
  • >4 KB JWT bloat (stuffing giant permission arrays into claims) triggers Nginx/CloudFront 431 Request Header Fields Too Large failures.

3. Zero-Dependency Offline CLI & 0B-Upload Browser Inspector

I built a tiny zero-dependency MIT CLI (jwt-audit-cli, node --test passing) to decode and flag these issues locally, alongside client-side browser decoders that never send a byte over the network:

Top comments (0)