# JWT Claim Validation Failures > A valid signature is not enough: bugs in checking `aud`, `iss`, `exp`/`nbf`, `jti` and other registered claims let a correctly signed token be used in the wrong context, past its lifetime, or under a bypassed constraint. ## How it works Once the signature verifies, the token still has to be the *right* token: issued by the expected issuer, for this audience, still within its validity window, and not replayed. Each check is easy to skip, loosen, or defeat with a type/encoding quirk. These flaws need no forgery — a token the attacker legitimately holds (or steals) is accepted where it should not be. ### Audience (`aud`) `aud` names the intended recipient(s); the recipient MUST validate it (string or array). Skipping it means any token from the same issuer is accepted — an OIDC provider that also serves other audiences (a file store) hands tokens that a sibling service will honour, and a stolen token's blast radius widens. - **Argo CD (all ≥ v1.8.2, critical, IBB)**: validated the OIDC signature but not `aud`; tokens minted for another audience granted Argo CD privileges via their `groups` claim. - **golang-jwt/jwt-go (CVE-2020-28361)**: `VerifyAudience` accepted a double-quoted empty string `""`, passing audience checks that should fail; fix only in v4.0.0-preview1, so master-tracking projects stayed vulnerable. - **Spring/OAuth2 resource servers**: "a token can be valid and still not be meant for your API" — correct signature and `exp` but wrong `iss`/`aud`. ### Issuer (`iss`) - **Apache Camel KeycloakSecurityPolicy (CVE-2026-23552, 4.15.0–4.17.x, CVSS 9.1)**: verified the signature but not that `iss` matched the configured realm, so a validly signed token from *any* Keycloak realm (including an attacker's) was accepted — multi-tenant isolation gone. - **PyJWT (CVE-2024-53861)**: issuer check changed from list to sequence membership in 2.10.0, so `'urn:'` partial-matched a required `'urn:expected'`; fixed 2.10.1. ### Expiry / not-before (`exp`, `nbf`) - **ASP.NET Core / .NET 10**: default `ClockSkew` grants a 5-minute grace, so a token that expired a minute ago still returns 200 — surprising but by design; tighten `ClockSkew` for sensitive APIs. - **@fastify/jwt (CVE-2026-107275)**: malformed time spans (`1h30m`, `1 month`, ISO-8601 `PT1H`, `1,5h`, whitespace) silently return a non-finite value, so the signing path omits `exp` (never-expiring token) and the verify path ignores `maxAge`. CWE-390. Fixed 10.2.3/10.2.5. - **@fastify/jwt earlier**: per-call `sign`/`verify` options dropped global defaults like `expiresIn`/`maxAge` (fixed 10.2.5). ### Replay / uniqueness (`jti`) and claim-name handling - **joserfc < 1.7.6 (GHSA-mcm9-p458-pjmc)**: a `jti` configured for exact string match accepted a list containing the expected value, turning exact-match into membership — array `["expected"]` passed. - **HashiCorp cap (CVE-2026-19194)**: non-canonical claim names interpreted differently during validation vs. when returned to the app, so authorization ran on claim values different from those validated. - **jwcrypto ≤ 1.6.1**: JSON `null` satisfied a required-claim presence check (`claims[name] is None` returned early, skipping value checks); and because Python `bool` subclasses `int`, booleans passed `NumericDate` integer checks — plus unhandled-exception DoS. - **PyJWT (CVE-2026-32597)**: unrecognised RFC 7515 `crit` header parameters were silently ignored instead of rejected (CWE-345), bypassing controls that relied on `crit`. - **Type and normalization confusion**: `{"role": ["admin"]}` vs `{"role": "admin"}` compared differently across layers; fullwidth `admin` can miss a lowercase filter yet pass a downstream check; nested JWTs (`cty: JWT`) where only the outer token is validated ([[raw/robinx0.github.io/jwt-algorithm-confusion-none-hs256-rs256-mix-ups-and-kid-injection-15974|robinx0]]). ## Detection and testing - Replay a valid token against a *different* service/tenant sharing the issuer (cross-service relay); if accepted, `aud`/`iss` is unchecked. - Submit an expired token and measure the accepted grace; set `exp` far future or malformed spans to probe never-expiring issuance. - Edit `aud`/`iss` to empty string, `""`, arrays, substrings; set `jti` to a list; set registered claims to JSON `null` or booleans. - Add an unknown `crit` header value and see whether it is rejected. - Code review: verify `aud` and `iss` are asserted (not just signature); confirm exact-match semantics on `jti`; check clock-skew config; ensure library version predates these CVEs. ## Defenses - Always assert `iss` (exact match to configured issuer) and `aud` (this service's identifier) after signature verification; reject empty/array-coerced bypasses. - Validate `exp` and `nbf` with a small, explicit clock skew (seconds, not minutes for sensitive APIs); fail if `exp` is absent. - Treat `jti` with the configured comparison semantics (exact = exact), and track it for replay defence on single-use tokens. - Reject unrecognised `crit` parameters; normalise/validate claim names canonically; reject `null`/wrong-typed registered claims. - Keep ID tokens and access tokens non-interchangeable; see [[OpenID Connect Security]] and [[OAuth 2.0 Vulnerabilities]]. ## Related - [[JSON Web Tokens]] - [[JWT Token Lifecycle and Revocation]] - [[JWT None Algorithm]] - [[Python JWT Library Vulnerabilities]] - [[OAuth 2.0 Vulnerabilities]] - [[OpenID Connect Security]] ## Sources - [[raw/hackerone.com/hackerone-argo-cd-jwt-audience-claim-not-verified-4109|HackerOne: Argo CD JWT audience claim not verified]] - [[raw/stackoverflow.com/jwt-json-web-token-audience-aud-versus-client-id-what-s-the-difference-6970|JWT Audience (aud) versus Client_Id]] - [[raw/medium.com/a-token-can-be-valid-and-still-not-be-meant-for-your-api-15115|A token can be valid and still not be meant for your API]] - [[raw/snyk.io/golang-jwt-access-restriction-bypass-vulnerability-4121|Golang JWT access restriction bypass vulnerability (CVE-2020-28361)]] - [[raw/dev.to/jwt-algorithm-confusion-attacks-cve-2026-22817-fix-guide-4366|Apache Camel Keycloak cross-realm iss bypass (CVE-2026-23552)]] - [[raw/vulert.com/cve-2024-53861-pyjwt-issuer-field-partial-match-4547|CVE-2024-53861: PyJWT Issuer Field Partial Match]] - [[raw/medium.com/a-jwt-that-expired-a-minute-ago-still-returned-200-what-i-hit-on-net-1-13090|A JWT That Expired a Minute Ago Still Returned 200 (.NET ClockSkew)]] - [[raw/sentinelone.com/fastify-jwt-malformed-time-spans-create-never-expiring-tokens-cve-2026-12874|@fastify/jwt malformed time spans create never-expiring tokens (CVE-2026-107275)]] - [[raw/github.com/fastify-jwt-missing-token-expiration-when-per-call-options-drop-defaul-13359|@fastify/jwt missing token expiration when per-call options drop defaults]] - [[raw/github.com/joserfc-list-valued-jti-accepted-by-exact-value-jwt-claim-validation-14525|joserfc: list-valued jti accepted by exact-value claim validation]] - [[raw/ibm.com/cap-jwt-claims-validation-bypass-using-non-canonical-claim-names-14755|CAP JWT claims validation bypass using non-canonical claim names (CVE-2026-19194)]] - [[raw/medium.com/breaking-jwt-validation-how-json-nulls-python-booleans-and-unhandled-e-12779|Breaking JWT Validation: JSON nulls, Python booleans, unhandled exceptions (jwcrypto)]] - [[raw/sentinelone.com/cve-2026-32597-pyjwt-information-disclosure-vulnerability-4961|CVE-2026-32597: PyJWT crit header validation (information disclosure)]] - [[raw/robinx0.github.io/jwt-algorithm-confusion-none-hs256-rs256-mix-ups-and-kid-injection-15974|JWT algorithm confusion: none, HS256/RS256 mix-ups, and kid injection]]