/

CVE-2026-32597

Severity:

HIGH RISK

(7.5)

Improper Validation of Token Headers in PyJWT

CVE-2026-32597

Modified

Vulnerability type

Category:

Improper Validation of Token Headers

CWE:

CWE-345, CWE-863, CWE-347

Impact:

Authentication and Authorization Bypass

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

PyJWT, a popular Python library for handling JSON Web Tokens (JWTs), previously failed to validate the crit (Critical) header parameter as required by RFC 7515.

When tokens included unknown critical extensions in the crit header, PyJWT would still accept them, potentially allowing attackers to bypass security logic that assumes strict standards compliance.

Affected context

This vulnerability affects applications that:

  • Use PyJWT for verifying JWS/JWT tokens, and
  • Rely on standards-compliant handling of JOSE/JWT headers, including crit, and
  • Operate in environments where other services, identity providers, or intermediaries may issue tokens with extensions or critical claims.

The risk is most pronounced in distributed or federated authentication scenarios where different components may interpret token headers differently but assume that unknown critical extensions are rejected.

Exploit preconditions

  • Attack surface: Any API endpoint, service, or component that accepts and verifies JWTs using vulnerable versions of PyJWT.
  • Required access: Ability to supply or influence JWTs consumed by the application (e.g., as an Authorization header, cookie, or request parameter).
  • Trigger point: Submission of a token that includes a crit header listing extensions that PyJWT does not support or understand.
  • Why exploitation is possible: Instead of rejecting tokens with unknown critical extensions as mandated by RFC 7515 §4.1.11, PyJWT treats them as valid, allowing tokens that relying systems may have intended to be rejected or handled differently.

Why this happens

The underlying issue is an incomplete implementation of JWT/JWS header validation logic.

RFC 7515 requires that when the crit parameter is present, the recipient must understand and process all listed extensions, rejecting the token otherwise.

PyJWT did not enforce this requirement and would accept tokens even when the crit array referenced unsupported extensions.

This maps primarily to CWE-345: Insufficient Verification of Data Authenticity, because the library signaled successful verification without fully validating all security-relevant metadata, and is related to CWE-863: Incorrect Authorization where trust decisions can be made based on incompletely validated tokens.

Potential impact

  • Tokens with unrecognized critical extensions may be treated as fully valid.
  • Security controls that depend on strict JWT processing semantics can be bypassed.
  • Authorization decisions may be made on the basis of tokens that should have been rejected.
  • In multi-service ecosystems, differences in how components treat crit can allow protocol-level confusion and potential privilege escalation.

General mitigation guidance

Mitigation focuses on enforcing strict token header validation and minimizing assumptions about partially validated tokens:

  • Ensure JWT libraries validate all critical header parameters and reject tokens containing unknown or unsupported crit entries.
  • Favor configurations and parsing modes that fail closed when encountering unexpected headers, algorithms, or extensions.
  • Limit reliance on opaque or custom token extensions unless all validating components explicitly support and correctly process them.
  • Apply defense-in-depth by combining token verification with explicit, server-side authorization checks rather than trusting token structure alone.
  • Reduce token lifetime and scope to limit the blast radius of any misvalidated token.

How teams detect issues like this

Effective detection strategies generally include:

  • Static analysis & library review: Flag use of JWT libraries with known gaps in standards compliance, especially around header handling (crit, alg, kid).
  • Code review practices: Verify that authentication middleware and token verification paths explicitly validate headers and reject unexpected metadata instead of ignoring it.
  • Security testing: Incorporate tests that send JWTs with malformed or unexpected headers (including crit with unsupported values) to confirm that they are rejected.
  • Runtime monitoring: Log and inspect token verification errors and unusual header patterns; enforce policies that treat acceptance of unknown critical extensions as a misconfiguration.
  • Automated application security testing tools that understand JWT semantics can help highlight non-compliant verification behavior.

Sources

SourceLink
github.comgithub.com/jpadilla/pyjwt/security/advisories/GHSA-752w-5fwx-jx9f
lists.debian.orglists.debian.org/debian-lts-announce/2026/05/msg00008.html
access.redhat.comaccess.redhat.com/errata/RHSA-2026:10140
access.redhat.comaccess.redhat.com/errata/RHSA-2026:10141
access.redhat.comaccess.redhat.com/errata/RHSA-2026:10184
access.redhat.comaccess.redhat.com/errata/RHSA-2026:12176
access.redhat.comaccess.redhat.com/errata/RHSA-2026:13508
access.redhat.comaccess.redhat.com/errata/RHSA-2026:13512
access.redhat.comaccess.redhat.com/errata/RHSA-2026:13545
access.redhat.comaccess.redhat.com/errata/RHSA-2026:13553
access.redhat.comaccess.redhat.com/errata/RHSA-2026:13672
access.redhat.comaccess.redhat.com/errata/RHSA-2026:13916
access.redhat.comaccess.redhat.com/errata/RHSA-2026:17083
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19138
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19355
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19375
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19712
access.redhat.comaccess.redhat.com/errata/RHSA-2026:21431
access.redhat.comaccess.redhat.com/errata/RHSA-2026:21517
access.redhat.comaccess.redhat.com/errata/RHSA-2026:22330
access.redhat.comaccess.redhat.com/errata/RHSA-2026:24977
access.redhat.comaccess.redhat.com/errata/RHSA-2026:26226
access.redhat.comaccess.redhat.com/errata/RHSA-2026:37275
access.redhat.comaccess.redhat.com/errata/RHSA-2026:42644
access.redhat.comaccess.redhat.com/errata/RHSA-2026:6568
access.redhat.comaccess.redhat.com/errata/RHSA-2026:6720
access.redhat.comaccess.redhat.com/errata/RHSA-2026:6912
access.redhat.comaccess.redhat.com/errata/RHSA-2026:6926
access.redhat.comaccess.redhat.com/errata/RHSA-2026:8437
access.redhat.comaccess.redhat.com/errata/RHSA-2026:8746
access.redhat.comaccess.redhat.com/errata/RHSA-2026:8747
access.redhat.comaccess.redhat.com/errata/RHSA-2026:8748
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-32597
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2447194
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-32597.json

Frequently asked

questions

Yes. Any external party that can supply JWTs to an application using the vulnerable PyJWT behavior could potentially exploit the issue by crafting tokens with unsupported critical extensions.

The attacker only needs the ability to present or influence JWTs consumed by the application (for example, as a client controlling the Authorization header). No direct server or database access is required, though other weaknesses (like leaked signing keys) would amplify impact.

Use JWT verification logic that strictly adheres to the JOSE/JWT specifications: validate all token headers, reject tokens that contain unknown or unsupported critical extensions, and default to a fail-closed behavior whenever header values are unexpected or non-standard.

Treat token parsing and verification as security-critical: adopt standards-compliant libraries, enable strict validation modes, add tests for malformed and edge-case tokens, and pair token verification with explicit, server-side authorization checks rather than relying solely on the presence of a "valid" token.

Find out what's already
exploitable in your codebase.