/toolkit / tools

JWT inspector

Decode a JSON Web Token, flag risky headers and claims, test it against well-known default secrets and verify its signature. Runs entirely in your browser.

A token is a credential#

A JSON Web Token (JWT) in an Authorization header is as good as a password for as long as it is valid. Pasting it into an online decoder hands that credential to a third party, and to everything in between: the site’s logs, its analytics, the browser extensions on the page.

This inspector runs entirely in your browser. It makes no network requests, and it keeps the token out of the URL, the browser history and local storage. Spellchecking is switched off in the input fields, because some browsers send the text of spellchecked fields to a cloud service.

What it checks#

The decoder shows the header and the payload. A JWT is signed, not encrypted, so anyone holding one can read every claim in it. The findings flag what an attacker or a reviewer would look at first:

  • Unsigned tokens (alg: none) and tokens with an empty signature. A server that accepts either one accepts forgeries.
  • Keys the token supplies itself: an embedded jwk, or a jku / x5u URL to fetch keys from. A server must decide which keys it trusts, never the token.
  • A suspicious kid (key ID) containing path traversal or injection characters. Servers often put it into a file path or a database query.
  • Symmetric algorithms (HS256 and friends). Every service that can verify the token can also create one, and a server that also accepts RSA or EC keys may be open to algorithm confusion, where the public key is used as an HMAC secret.
  • Lifetime problems: no exp at all, a lifetime longer than a day, an iat in the future, or a token that is already expired or not valid yet.
  • No audience (aud), which lets a token issued for one service be replayed against another that trusts the same issuer.
  • Claims that look sensitive, such as passwords, API keys or card numbers.
  • Well-known secrets. For HMAC-signed tokens, the inspector tries several dozen secrets copied from documentation and tutorials, such as secret or your-256-bit-secret. These keep turning up in production. If one matches, anyone can forge tokens for that issuer.

Encrypted tokens (JWE, five parts instead of three) can’t be decoded without the key, so only their header is shown and checked.

Verifying a signature#

Signatures are verified with the browser’s built-in Web Crypto API. HS256/384/512 use the shared secret, plain or base64-encoded. RS, PS, ES and EdDSA tokens use the issuer’s public key, as a PEM PUBLIC KEY or as a JWK. A whole key set (JWKS) works too: the key is selected by the token’s kid.

Use a test secret wherever you can: whoever knows an HMAC secret can sign tokens with it. The inspector refuses private keys outright. Verification never needs one, and a private key does not belong in any web page.

What it can’t tell you#

The findings describe the token, not the server that accepts it. A token without exp may be harmless if the server enforces its own session timeout, and a perfectly formed token is still dangerous if the server never checks the signature. To find those problems, change the token and send it back: strip the signature, switch the algorithm to none, edit a claim. Then watch what the server accepts.