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. Per HCSEC-2026-60, cap/jwt ≤ 0.13.0 (fixed 0.14.0); exploitation needs attacker-controlled claims in a token signed by a trusted key (compromised or misconfigured IdP), and only bypasses Expected.Issuer/Expected.Subject when those are configured; no impact shown in Vault or Boundary (HCSEC-2026-60). The lesson is a validate-vs-consume parser differential: the claims checked must be the exact claims returned.
  • 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 (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.

Sources