Skip to content

JWT security checker

Flag tokens signed with alg none or a well-known secret, with no expiry or a long lifetime, with keys in the header, or with secrets in the claims.

Runs in your browser. Nothing you paste is sent to us.

Token

A deliberately weak sample token is filled in. Paste yours; it stays in your browser.

To check its length and whether it verifies this token. Use a test secret, not a live one.

Findings

2 serious2 warnings
  • FailNo expiry (exp)A stolen token works forever. Access tokens should expire within minutes.
  • FailClaims that look secret: passwordAnyone holding the token can read its claims. Never put passwords or secrets in a JWT.
  • WarningHS256 uses a shared secretEvery service that verifies the token can also create one. For tokens checked by many services, an asymmetric algorithm such as RS256 or ES256 is safer.
  • WarningNo audience (aud)Without aud, a token meant for one service can be replayed against another that trusts the same issuer.
  • NoteNo token id (jti)Needed only if you track or revoke single tokens.
These checks read the token only. They cannot see how your app verifies it, which matters just as much.

How to use it

  1. Paste the token.
  2. For an HMAC token, optionally enter your secret to check its length.
  3. Read the findings, most serious first.
  4. Fix the issuer or the verifier for each serious finding.

What to know

Many JWT attacks work because a verifier trusts what the token says about itself: alg none, a key embedded in the header, or a jku URL that points to the attacker’s keys.

For HMAC tokens the tool tries a short list of secrets from tutorials and default configs. A match means anyone can forge tokens.

Keycloak signs tokens with keys held in the realm and sets exp on every access token. Most findings on Keycloak tokens come from very long lifespans or from custom mappers that add data that should stay private.

Why check a token for weaknesses

JWTs are simple, and that simplicity hides traps. Many real incidents with JWTs came not from broken cryptography but from choices: a verifier that accepted alg: none, a secret copied from a tutorial, a token that never expires, a password put into a claim.

Most of these choices leave traces in the token itself. This checker reads the header and payload, tries a short list of well-known HMAC secrets, and reports what it finds, most serious first.

What the checker looks for

FindingWhy it matters
alg: noneThe token is unsigned; anyone can write one
Signed with a well-known secretAnyone can forge tokens with that secret
HMAC algorithmEvery verifier can also create tokens
Empty signatureThe header claims a signature that is not there
jku or x5u in the headerPoints the verifier to keys chosen by the sender
jwk or x5c in the headerCarries its own key, which proves nothing
Unusual characters in kidMay be an injection attempt against a key lookup
No exp, or a very long lifetimeA stolen token stays useful for too long
No iss or audVerifiers cannot tell who issued it or who it is for
Claims that look secretAnyone holding the token can read them
Larger than 4096 bytesWill not fit in one cookie

The attacks behind the findings

The none algorithm

RFC 7518 defines none for tokens whose integrity is protected some other way. A verifier that reads alg from the token and honors none accepts any token an attacker writes. Correct verifiers have a fixed list of allowed algorithms and never include none.

Algorithm confusion

If a verifier lets the token choose the algorithm, an attacker can take the issuer’s RSA public key, which is public, and use it as an HMAC secret to sign a token with HS256. A naive verifier then “verifies” it with the same public key. Pinning the algorithm and checking that the key type fits prevents this.

Keys supplied by the token

The jku, x5u, jwk and x5c header parameters let a token name or carry a key. If a verifier trusts them, an attacker signs with their own key and points to it. Keys must come from the verifier’s configuration, such as the issuer’s JWKS URL.

Guessable secrets

An HS256 token can be checked against a candidate secret offline, as fast as a computer can compute HMACs. Short secrets, words and defaults from documentation fall quickly. RFC 7518 requires at least 32 bytes for HS256, and they should be random.

How to check a token

  1. Paste the token. A deliberately weak sample is filled in so you can see the findings.
  2. For an HMAC token, optionally enter your secret. The tool reports its length and whether it verifies the token.
  3. Read the findings, from serious to informational.
  4. Fix each serious finding in the issuer or in the verifier, then check a new token.

The weak-secret test tries 29 secrets seen in tutorials, defaults and sample code. A match means the secret must be replaced. No match does not mean the secret is strong.

What a clean Keycloak token looks like

A Keycloak access token is signed with the realm’s private key, RS256 by default, so the shared-secret findings do not apply. It has exp, iat, iss and jti, and a kid in the header that matches the realm’s certs endpoint. It never carries jku, x5u or an embedded key.

The findings that do appear on Keycloak tokens usually come from configuration:

  • Long lifetimes, when Access Token Lifespan was raised to hours to avoid refresh logic.
  • Missing or broad audience, when no Audience mapper names the API.
  • Data that should stay private, added by custom mappers from user attributes.
  • Large tokens, from many groups or client roles.

Use cases

Reviewing a third-party integration

When a partner sends you tokens, check one here before you write the verifier. HMAC with a shared secret, missing audience or long lifetimes are things to raise early.

Auditing your own issuer

Check tokens from each of your issuers, including small internal services that sign their own tokens. Those are where defaults like secret survive.

Teaching the team

The sample token on this page shows several mistakes at once. It is a quick way to show why each check exists.

What the checker cannot see

Most JWT vulnerabilities live in the verifier, not the token. This tool reads tokens only. It cannot tell whether your API pins the algorithm, fetches keys safely, checks aud, or handles key rotation. Review the verifier code and its library configuration as well.

A clean result means the token shows none of these signs. It does not mean the system that issues or accepts it is secure.

Fixes, finding by finding

  • alg: none accepted: configure the verifier with an explicit list of algorithms.
  • Weak or known secret: replace it with 32 or more random bytes, and treat existing tokens as compromised.
  • Shared secret across many services: move to RS256 or ES256 so only the issuer can sign.
  • Key URL or key in the header: ignore these parameters; take keys from configuration only.
  • No expiry or long lifetime: set short access token lifetimes and use refresh tokens.
  • Missing audience: add an audience for each API and check it on every request.
  • Secrets in claims: remove them; JWT payloads are readable by anyone.

A verifier configuration that avoids these problems

Most JWT libraries can be configured safely. The settings below exist under different names in almost every one of them.

Settings for a resource server trusting the sample realm acme
issuer:          https://auth.example.com/realms/acme
audience:        orders-api
algorithms:      [RS256]
jwks_uri:        https://auth.example.com/realms/acme/protocol/openid-connect/certs
clock_tolerance: 30s
required claims: exp, iat, iss, aud, sub

With a fixed algorithm list, keys only from the configured jwks_uri, and required issuer and audience, the attacks described above have nothing to work with.

Reading the sample findings

The sample token on this page is made up and deliberately weak. It shows several findings at once.

  • It is signed with HS256 using the secret secret, so anyone can forge it.
  • It has no exp, so it never expires.
  • It has no aud, so any service trusting the issuer would accept it.
  • It carries a password claim, readable by anyone who holds it.

Paste a token from your own issuer to compare. A well-configured Keycloak realm’s access token should show only informational notes.

Severity levels

Findings come in four levels. Fail means anyone could forge, replay or read something they should not. Warning means a risky choice that is acceptable only with a good reason. Note is information worth knowing. Pass confirms a check that went well. Fix every Fail before relying on the tokens.

Privacy

All checks run in your browser, including the weak-secret test. Nothing is sent to us. If you enter your own secret, use a test secret; a production secret should never be typed into a web page.

Questions

Frequently asked questions

Is HS256 insecure?

Not with a long random secret. The risks are that every service that verifies an HS256 token can also create one, and that short or reused secrets can be guessed offline.

Why is a missing `aud` a problem?

A token without an audience is valid for every service that trusts the issuer, so a token stolen from one can be replayed against another.

Does a clean result mean my setup is secure?

No. The tool reads the token only. Your verifier must still check the signature with a fixed algorithm and trusted keys, and check `exp`, `iss` and `aud`.

What is the alg none attack?

An attacker sends a token with `alg: none` and no signature, hoping the verifier skips the check. Verifiers that allow only specific algorithms are not affected.

Is my secret tested on a server?

No. The weak-secret list is tried in your browser with Web Crypto, and any secret you type stays on the page.

How long should an access token live?

Minutes rather than hours. Keycloak’s default Access Token Lifespan is 5 minutes, with refresh tokens to get new ones.

Why is putting a password in a JWT bad if it is signed?

Signing protects integrity, not confidentiality. Anyone who holds the token can decode the payload and read the password.

What should I do if my token was signed with a known secret?

Replace the secret with a long random one at once, and stop trusting every token signed with the old one. Anyone could have created such tokens.

Can I use this to test my own secret’s strength?

Partly. The tool checks whether your secret is on a short list of well-known ones and whether it is long enough. A secret that passes both can still be weak if it is a word or a pattern, so use random bytes.

Why is `kid` with a slash or quote flagged?

Some verifiers once used `kid` in a file path or a database query. Unusual characters there may be an attempt to read another file or inject into the query. Treat `kid` as an opaque lookup key.

Rather not run Keycloak yourself?

We run it for you on a cluster of your own, with backups, upgrades and written support. Starter and Premium begin with a 7-day trial.