1001Ferramentas
🛡️Validators

JWT alg Allowlist Policy Checker

Decodes the JWT header, reads its alg field and flags the token when the value is none or absent from the comma-separated list of algorithms you allow.

Resultado

Never let the token pick the algorithm

A sloppily configured JWT library trusts whatever algorithm the token declares. That hands the attacker the choice of how their own token gets verified, which is where the two classic attacks come from: switch alg to none and drop the signature entirely, or switch RS256 to HS256 and sign with the public key, which is, by definition, public. The fix is a fixed list of algorithms the server accepts.

What happens here: the first segment is decoded, the alg field of the header is read, and it is matched against the comma separated list you type. The match is exact and case sensitive, so rs256 will not match RS256, and it pays to write the list exactly the way your library spells it. The alg=none case gets its own message, with the CVE-2015-9235 reference attached.

Worth stating what this does not do: it never verifies the signature, never fetches a key from a JWKS endpoint, and knows nothing about JWE, where alg describes key management and the content algorithm lives in enc. It is a policy check, not an authenticity check. Use it during review to confirm that the tokens reaching your service line up with the allowlist you configured. The header is decoded in the browser.

Frequently asked questions

What is the alg=none attack?
It is a token that declares it carries no signature. Libraries that trust the header will accept any payload sent that way. The hole is documented as CVE-2015-9235 and still turns up in hand rolled verification code.
Why is mixing HS256 and RS256 in one allowlist risky?
Because an attacker can take the RSA public key, which is handed out freely, and use it as the HMAC secret. Keep a single algorithm family per allowlist.
Does this validate the signature?
No. It only reads the alg field from the header and compares it with the list you provide. The cryptographic verification remains your library's job.

Related Tools