JSON Web Tokens
A JWT is a signed (JWS) or encrypted (JWE) set of JSON claims used as a bearer credential; the vulnerability class is the gap between a token the server should trust and one it does trust — almost always a verification flaw that lets an attacker forge or misuse tokens.
What it is
A JWS JWT is three base64url segments — header.payload.signature — joined by dots. The header (JOSE header) names the signing algorithm in alg and may carry key hints (kid, jwk, jku, x5c, x5u); the payload holds claims (iss, sub, aud, exp, nbf, iat, jti, plus app claims); the signature is HMAC (HS, symmetric) or a public-key signature (RS/PS/ES/EdDSA). The payload is encoded, not encrypted — anything secret in it is readable by anyone holding the token. (“JWT” in practice means JWS; JWE encrypts the contents.)
The trust boundary that breaks: the header is attacker-controlled and is read before the signature is checked, because the verifier needs it to know how to check the signature. Every major JWT bug is a server trusting that pre-verification input — the algorithm, the key reference, or a claim — more than it should. As PortSwigger puts it, the flaws almost always mean the signature is not verified properly, or the key that backs it is not actually secret. Curity’s framing: JWT security comes from implementation and validation, not the format.
Why it matters
JWTs gate authentication, authorization and SSO across APIs, OAuth2/OIDC and microservices. A token-verification bug is usually a complete authentication bypass: forge a token with arbitrary sub/role/isAdmin and you impersonate any user or escalate to admin — often pre-auth, often with only public information (the public key).
Impact ladder:
- Tamper claims when the signature is unchecked → privilege escalation / user impersonation (XBEN-027, Newspack).
- Forge any token via algorithm confusion,
none, empty key, header injection or a cracked/leaked secret → full account takeover with no victim interaction. - Pivot further: forged admin → SSTI/RCE (Intigriti CTF, TryHackMe Hammer), or into ICS/SCADA and IoT root (CIRCUTOR PowerStudio, Cudy routers).
- Cross-tenant / cross-service: missing
iss/audchecks accept tokens meant for another realm or service (Apache Camel, Argo CD).
Severity drivers: whether HMAC and asymmetric algorithms share a verifier, whether the secret is strong and secret, whether key references in the header are trusted, whether iss/aud/exp are asserted, and how fast a bad token can be revoked. 2026 saw this class land as maximum-severity CVEs across Keycloak, pac4j, Parse Server, PAN-OS, Hono and the Python JOSE ecosystem.
How it works (mechanism and variants)
Each variant links its detailed page.
- JWT Algorithm Confusion — force the verifier onto a different algorithm than intended, classically RS256→HS256 with the server’s public key as the HMAC secret. Root cause:
alg-driven dispatch plus a raw key shared across algorithm families. Still shipping: Hono (CVE-2026-22817), PAN-OS (CVE-2026-0265), Keycloak (CVE-2026-11800), Parse Server (CVE-2026-27804), fast-jwt (CVE-2026-107722). - JWT None Algorithm — accept an unsecured token (
alg:none, empty signature) or otherwise skip the signature check (unknown-alg empty signature, null signature,decode()vsverify(), plain JWT inside JWE). CIRCUTOR SCADA (CVE-2026-120387), Cudy (CVE-2026-75491), pac4j (CVE-2026-29000), HarbourJwt (CVE-2026-23993). - JWT Header Injection — abuse
jwk/jku/x5c/x5u/kidso the verifier trusts an attacker key, or turnkidlookup into path-traversal / SQLi / SSRF. Authlib (CVE-2026-27962), Dart jose (CVE-2026-34240), PortSwigger labs. - JWT Empty Key Forgery — a zero-length HMAC key makes the signature a public, reproducible function. Authlib (CVE-2026-114616), ruby-jwt (USN-9059-1), python-jose (CVE-2026-120459), PyJWT PyJWK (CVE-2026-102266), libjwt, fast-jwt (CVE-2026-107720).
- JWT Secret Cracking — recover a weak HS* secret offline (hashcat
-m 16500), or find a hardcoded/default/leaked one (Tensei, Simple Admin Core, JS-bundle fallback, Trint client-side generation). - JWT Claim Validation Failures — valid signature but wrong/expired/replayed token: missing
aud(Argo CD), missingiss(Apache Camel), clock-skew and never-expiring tokens (@fastify/jwt CVE-2026-107275),jtilist bypass (joserfc), non-canonical claim names (cap CVE-2026-19194),critignored (PyJWT CVE-2026-32597). - JWT Token Lifecycle and Revocation — stateless tokens outlive logout/reset; storage, theft, expiry, refresh rotation and revocation strategy set the blast radius.
- Python JWT Library Vulnerabilities — the PyJWT/Authlib/joserfc/python-jose/jwcrypto run of public-key-as-HMAC, empty-HMAC and Python type-quirk bugs (python topic — linked, not duplicated here).
Where to find it
- Carriers:
Authorization: Bearer eyJ..., session cookies,access_token/id_tokenin OAuth/OIDC flows, WebSocketconnectionParams, GraphQL auth directives, custom headers. Regex[= ]eyJ[A-Za-z0-9_-]*\.[A-Za-z0-9._-]*. - Key endpoints:
/.well-known/jwks.json,/jwks.json, OIDCjwks_uri, embedded in mobile/JS bundles and source maps. - JWKS hygiene: a public JWKS must hold only public parameters.
d/p/q/dp/dq/qion an RSA key (ordon EC) means a published private key;kty: "oct"withkmeans a published HMAC secret; also flag missing or duplicatekid, RSA < 2048 bits, andalg/ktyoruse/key_opsmismatches (JWKS and kid). - Hot spots: custom verification code; libraries configured with a mixed HS+RS allow-list;
kid-driven key lookups; JWE/nested tokens; OAuth adapters (Parse Server), SSO bridges (Jitsi, Trint), IoT/SCADA auth plugins, GraphQL auth (@neo4j/graphqlCVE-2026-92683), WordPress JWT plugins, edge/serverless frameworks (Hono on Workers/Deno/Bun). - Frameworks/libs: PyJWT, Authlib, python-jose, joserfc, jwcrypto (Python); jsonwebtoken, @fastify/jwt, jose, Hono (Node); ruby-jwt; golang-jwt; libjwt/cjwt (C); lua-resty-jwt; Spring Security, JWTKit (Swift).
How to test
Methodology (jwt_tool playbook / OWASP WSTG / PortSwigger), roughly in order:
- Find and replay. Locate the token via an intercepting proxy; replay it to confirm a stable, authorized response (a profile endpoint works well).
- Is it required / checked / persistent? Remove it; truncate the signature. If a truncated signature is still accepted, the signature is not verified — tamper the payload directly.
- Unsigned / skip-verify. Try
alg:noneand case/encoding variants, unknownalgwith empty signature, zero-length signature with the originalalg. - Algorithm confusion. Fetch or derive the public key (JWKS, OIDC, TLS cert, or
rsa_sign2n/sig2n from 1–2 tokens); re-sign with HS* using multiple key encodings (PEM ±trailing newline, PKCS#1/SPKI, raw JWK, DER).- For a JWKS-published key: JWK → PEM → base64 of the whole PEM as the symmetric
k; keepkid, switchalgto HS256 (juangrate).
- For a JWKS-published key: JWK → PEM → base64 of the whole PEM as the symmetric
- Empty key. Re-sign HS* with an empty secret
"". - Header injection. Embed a
jwk; pointjku/x5uat a collaborator host (watch for SSRF, test allow-list bypasses); setkidto../../../dev/null(empty secret), SQL metacharacters, command/SSRF payloads. - Secret cracking. Offline hashcat/jwt_tool/CookieMonster against captured tokens; search bundles/config for secrets.
- Claims. Edit
aud/iss; send expired tokens (measure grace); set claims tonull/booleans/arrays; cross-service replay; unknowncrit. - Edge cases. Nested JWT (
cty: JWT) where only the outer token is validated; claim type confusion ("role": ["admin"]vs"admin") and fullwidth-Unicode normalization mismatches between filter and consumer (robinx0).
Checklist (ship-gate):
- Signature verified on every request (verify, not decode); truncated/empty signatures rejected.
-
noneand unknown algorithms rejected; algorithm allow-list pinned from config. - No verifier mixes HMAC with asymmetric algorithms on one key.
- Zero-length and sub-256-bit HMAC keys rejected.
- Header key references (
jwk/jku/x5c/x5u) ignored or strictly allow-listed;kidmapped via allow-list, never a path/SQL/shell. -
issandaudasserted;exp/nbfchecked with tight skew;exprequired. - Short access-token lifetime; refresh rotation; revocation on reset/logout.
- No secrets in client bundles; secrets ≥256-bit from a CSPRNG; asymmetric signing preferred.
- Library version postdates the relevant CVEs; negative tests prove each fix.
Exploitation and escalation
- Claim tampering → Broken Access Control / privilege escalation when the signature is unchecked.
- Forged admin token → chain to Server-Side Template Injection/RCE, or to SSRF via
jku. kidinjection → path traversal, SQLi, command injection, SSRF key fetch.- Stolen token replay / cross-service relay → account takeover across services sharing an issuer (see JWT Claim Validation Failures, JWT Token Lifecycle and Revocation).
- Nested JWE → inner unsigned JWT accepted (pac4j); invalid-curve attacks on JWE/ECDH (RFC 7516 errata; “Off the Curve” CTF).
- Pre-auth DoS through the verifier: header values that drive cost (the PBES2
p2citeration count fed unbounded tohash_pbkdf2()in web-token jwt-framework, CVE-2026-134461) or malformed signatures that makeverify()throw instead of return false (lcobucci/jwt ECDSA, see below) need no key and no valid token (web-token, lcobucci). An exception path can also skip logic that only runs on afalseresult: failed-attempt counters, rate limiting, audit logging.
Bypassing defenses
none-filter bypass: mixed case (None,NONE), unexpected encodings; filters that string-matchnone.- Public-key-guard bypass (algorithm confusion): a library sniffs “is this a public key?” and the denylist misses an encoding — leading non-whitespace byte (fast-jwt), OpenSSH/DER (Authlib, joserfc), raw JWK JSON container (PyJWT). Content-sniffing is not a fix.
jku/x5uallow-list bypass:startsWith/containsinstead of parsed scheme+host+port equality; open redirect on the trusted host; attacker-writable content on the trusted origin (see URL Parser Differentials).- Claim-check bypass: empty-string/array-coerced
aud(golang-jwt), partialissmatch (PyJWT CVE-2024-53861),jtilist membership (joserfc), JSONnull/boolean claims (jwcrypto), non-canonical claim names (cap), silently ignoredcrit. - Expiry bypass: default multi-minute clock skew; malformed time spans producing never-expiring tokens (@fastify/jwt).
- Incomplete-patch bypass: fast-jwt CVE-2026-107722 (re-enabled CVE-2026-34950), Authlib CVE-2026-114615 — re-test after a vendor “fix”.
Real-world cases
- CIRCUTOR PowerStudio SCADA WAVE (CVE-2026-120387) —
alg:noneidentity forgery → RCE chain in ICS/SCADA. JWT None Algorithm - Cudy TR3000/AX3000 (CVE-2026-75491) —
alg none+ trusted client cert → root command execution over MQTT. JWT None Algorithm - PAN-OS / Panorama (CVE-2026-0265) — algorithm confusion in
pan_auth_verify; pre-auth login as any user when CAS attached. JWT Algorithm Confusion - Keycloak (CVE-2026-11800) — algorithm confusion in the JWT Authorization Grant; forge assertions for any federated user. JWT Algorithm Confusion
- pac4j-jwt (CVE-2026-29000, max severity) — unsigned PlainJWT inside RSA JWE accepted; impersonation. JWT None Algorithm
- Parse Server (CVE-2026-27804, CVSS 9.3) — OAuth adapters passed header
algintojwt.verify;noneor HS256-with-Google-key ATO. JWT Algorithm Confusion - Hono (CVE-2026-22817) — RS256→HS256 on edge runtimes. JWT Algorithm Confusion
- Authlib (CVE-2026-27962 jwk-injection; CVE-2026-114616 empty HMAC; CVE-2026-114615 confusion-fix bypass) — three distinct 2026 verification bypasses. JWT Header Injection / JWT Empty Key Forgery
- Apache Camel KeycloakSecurityPolicy (CVE-2026-23552) — unverified
iss→ cross-realm acceptance. JWT Claim Validation Failures - Argo CD (IBB, critical) — unverified
audon OIDC tokens. JWT Claim Validation Failures - @neo4j/graphql (CVE-2026-92683, and connectionParams bypass) — multi-condition
@authenticationfilter bypass; subscription auth via unverifiedconnectionParams.jwt. - Jitsi Meet (GHSA-45ff-37jm-xjfx) — public key as HMAC secret into protected rooms. JWT Algorithm Confusion
- JS-bundle fallback secret (siteguarding) — production HS256 key shipped in client code → auth bypass + cross-user write. JWT Secret Cracking
- Tensei (CVE-2026-129552) / Simple Admin Core — hardcoded/default JWT secret → forged super-admin; Tensei ≤ 0.11.5 falls back to
auth-secret-keywhenJWT_SECRETis unset (CWE-1394) (VulnCheck). JWT Secret Cracking - BISHENG < 3.0.0 (CVE-2026-130840, CVSS 9.3, CWE-321) — hard-coded default
jwt_secret: offline HS256 token foruser_id1 with admin role, sent asaccess_token_cookie. JWT Secret Cracking (VulnCheck) - Intel/CBSE AI Student Community — HS256 secret
intelcracked with rockyou; forged token + sequential/dashboard/{ID}brute force + email enumeration → ATO; fixed by rotation, session invalidation and authz. JWT Secret Cracking (Intel Inside) - API-gateway RS256→HS256 ($4,500) — unpinned verification at a central gateway let a guest forge an admin token. JWT Algorithm Confusion (Medium)
- @fastify/jwt (CVE-2026-107275) — malformed time spans → never-expiring tokens. JWT Claim Validation Failures
- python-jwt + jwcrypto (CVE-2022-39227) — parser-inconsistency claim forgery. Python JWT Library Vulnerabilities
- HarbourJwt (CVE-2026-23993) — any unknown
alg→ empty-signature bypass; found by LLM-assisted triage. JWT None Algorithm - Better Auth Expo (GHSA-4wq4-2ppv-q3hg) — signing oracle: a public endpoint signed attacker
state, accepted elsewhere → zero-click ATO. - jsonwebtoken (CVE-2022-23529) — RCE on crafted token given a separate secret-management flaw; later downgraded (caller-side risk).
- Nextcloud Whiteboard (SSRF → DevTools) — SSRF leaking JWT auth tokens; token theft as impact. JWT Token Lifecycle and Revocation
- HashiCorp cap/jwt ≤ 0.13.0 (CVE-2026-19194, HCSEC-2026-60) — non-canonical claim names bypass
Expected.Issuer/Expected.Subject; needs a trusted-but-compromised IdP; fixed 0.14.0. JWT Claim Validation Failures (HCSEC-2026-60) - web-token jwt-framework / jwt-library (CVE-2026-134461) —
PBES2AESKW::unwrapKey()passed attackerp2ctohash_pbkdf2()with no upper bound; one JWE with a huge iteration count exhausts CPU unauthenticated; fixed 3.4.10, 4.0.7, 4.1.7 (GHSA-gxh8-83xg-w4p6) - lcobucci/jwt 5.6.1 / 6.0.x (GHSA-g3gx-p6xp-9gxq) —
MultibyteStringConverter::toAsn1()writes DER lengths with unpaddeddechex(); an ES256/384/512 signature whose R or S has ≥17 leading zero bytes (e.g. R = S = 1) yields odd-length hex,hex2bin()fails, andverify()throws (ErrorExceptionunder Laravel/Symfony,TypeErrorotherwise) → HTTP 500 instead of 401; the 5.6.1ConversionFailedcatch does not cover it (advisory) - PyJWT (USN-9177-1) — non-canonical signature-segment encodings accepted, with possible bypass of token revocation checks. JWT Token Lifecycle and Revocation (USN-9177-1)
Prevention
- Pin algorithms from configuration, never from the token (RFC 8725 §3.1); each key bound to exactly one algorithm.
- Pin by
kid: select the JWK whosekidmatches the header (never the first key); on an unknownkidrefresh the JWKS cache once, then reject; publish new keys before signing with them and keep old ones until their tokens expire (JWKS and kid). - Never mix HMAC and asymmetric algorithms on one verifier; use typed key objects so cross-family use is refused.
- Prefer asymmetric signing (RS/ES/EdDSA): the verification key is useless for forgery and no HMAC secret sits in verifier config. If HMAC is used, ≥256-bit CSPRNG secret (32/48/64 bytes for HS256/384/512), rotated, never hardcoded or client-side, distinct per environment, and checked for length at startup (Avada Labs).
- Bound attacker-controlled cost and fail cleanly: cap PBES2
p2c(or disable PBES2 algorithms), and make every malformed-signature path return a rejection rather than an exception (web-token, lcobucci). - Canonical revocation keys: revoke by
jti, not by the raw token string, since some libraries accepted non-canonical signature encodings (USN-9177-1). - Reject
none, unknown algorithms, zero-length keys, and empty/zero-length signatures; compare in constant time. - Ignore header key references unless a protocol needs them; then strict parsed-URL allow-lists, no redirects, no cookies, chain validation to a pinned root. Map
kidvia allow-list only. - Assert claims:
iss,aud,exp/nbfwith tight skew; exactjtisemantics; reject unknowncrit; keep ID and access tokens non-interchangeable. - Lifecycle: short access tokens, rotating/revocable refresh tokens (rotated atomically, reuse revokes the family), invalidation on password reset and logout,
HttpOnly/Secure/SameSitecookie scoped byPathor in-memory storage, no tokens in URLs, TLS always; DPoP for sender-constrained tokens (Moorthy). - Nothing sensitive in the payload (it is only encoded). Consider phantom/split-token patterns to keep data server-side.
- Prove fixes with negative tests and re-test after vendor patches (incomplete-patch history).
Tools
- Testing/forging: jwt_tool (playbook mode,
-M pb), Burp JWT Editor, PortSwigger JWT Scanner, JOSEPH (JSON Web Token Attacker), jwt-hack, jwtXploiter, JWTweak, JWTAuditor, jwt-auditor, jwt-pwn, HipaLab/HakLuke client-side suites. - Key recovery: rsa_sign2n / sig2n (
portswigger/sig2n), JWT-Key-Recover. - Cracking: hashcat (
-m 16500), John the Ripper, c-jwt-cracker, CookieMonster, Flask-Unsign. - References/checklists: OWASP WSTG “Testing JWTs”, RFC 8725 (BCP 225) / rfc8725bis, PortSwigger Web Security Academy, six2dez/Chintan Gurjar/Cyber Frogy pentest checklists.
Sub-pages
- JWT Algorithm Confusion — forcing HS256 verification with the server’s public key, and the library key-format guards that keep failing.
- JWT None Algorithm — unsigned tokens and every other way the signature check gets skipped.
- JWT Header Injection —
jwk/jku/x5c/x5u/kidkey-reference abuse andkidinjection sinks. - JWT Empty Key Forgery — zero-length HMAC keys as a reproducible signature, across PyJWT/Authlib/ruby-jwt/libjwt/fast-jwt.
- JWT Secret Cracking — offline HMAC brute force and hardcoded/default/leaked secrets.
- JWT Claim Validation Failures —
aud/iss/exp/jti/critchecks skipped, loosened, or type-confused. - JWT Token Lifecycle and Revocation — statelessness, storage, theft, expiry, refresh rotation and revocation.
- Python JWT Library Vulnerabilities — Python JOSE ecosystem CVE run (owned by the python topic).
Sources
- JWT attacks (PortSwigger Web Security Academy) · original
- Algorithm confusion attacks (PortSwigger) · original
- OWASP WSTG: Testing JSON Web Tokens · original
- RFC 8725: JSON Web Token Best Current Practices · original
- draft-ietf-oauth-rfc8725bis: JWT BCP · original
- The Ultimate Guide to JWT Vulnerabilities and Attacks · original
- WorkOS: JWT algorithm confusion attacks explained · original
- Auth0: Critical vulnerabilities in JSON Web Token libraries · original
- Curity: JWT Security Best Practices · original
- jwt_tool Attack Methodology wiki · original
- Known Exploits and Attacks (jwt_tool Wiki) · original
- Intigriti: Exploiting JWT vulnerabilities — advanced guide · original
- HackTricks: JWT vulnerabilities · original
- Insecure JSON Web Tokens (The Hacker Recipes) · original
- JSON Web Token Vulnerabilities (0xn3va cheat sheet) · original
- CVE-2026-120387: PowerStudio SCADA JWT signature validation bypass · original
- Cudy MQTT JWT auth bypass (alg none) to root command execution · original
- PAN-OS CAS authentication bypass (CVE-2026-0265) · original
- Keycloak authentication bypass via JWT algorithm confusion (CVE-2026-11800) · original
- CVE-2026-29000: Authentication Bypass in pac4j-jwt · original
- CVE-2026-22817: JWT Algorithm Confusion in Hono · original
- HackerOne: Argo CD JWT audience claim not verified · original
- Neo4j GraphQL JWT @authentication filter bypass (CVE-2026-92683) · original
- JWT signing key in a JavaScript bundle: case study · original
- @fastify/jwt never-expiring tokens (CVE-2026-107275) · original
- Account takeover in @better-auth/expo via a signing oracle · original
- Why Your Logout Button Doesn't Log Out a JWT · original
- These are the security issues with JWT · original
- Severe Security Flaw Found in jsonwebtoken Library (CVE-2022-23529) · original
- Nextcloud Whiteboard SSRF to Chrome DevTools leaks JWTs · original
- Vaadata: JWT vulnerabilities, common attacks and best practices · original
- JWT Vulnerabilities List: 2026 (Red Sentry) · original
- Intel Inside: How a Cracked JWT Key led to Full Account Takeover · original
- JWT authentication bypass via algorithm confusion · original
- JWKS and kid Explained: How to Find the Key That Signed Your Token (and Spot a Leaked Private Key) · original
- How a JWT Algorithm Confusion Vulnerability Allowed a $4,500 Authentication Bypass · original
- JWT algorithm confusion: none, HS256/RS256 mix-ups, and kid injection · original
- BISHENG auth bypass via hard-coded JWT signing secret · original
- Tensei auth bypass via hard-coded JWT secret (VulnCheck) · original
- HCSEC-2026-60: cap JWT claims validation bypass · original
- web-token jwt-framework PBES2 p2c DoS · original
- lcobucci/jwt ECDSA verify() throws on crafted signature · original
- Your JWT Secret Is Probably Too Weak · original
- JWT Is More Than You Think: Refresh Tokens & DPoP · original
- USN-9177-1: PyJWT non-canonical signature vulnerability · original