CVE-2026-32597: PyJWT accepts unknown `crit` header extensions (RFC 7515 §4.1.11 MUST violation)

Published Mar 12, 2026
·
Updated

Summary

PyJWT does not validate the crit (Critical) Header Parameter defined in RFC 7515 §4.1.11. When a JWS token contains a crit array listing extensions that PyJWT does not understand, the library accepts the token instead of rejecting it. This violates the MUST requirement in the RFC.

This is the same class of vulnerability as CVE-2025-59420 (Authlib), which received CVSS 7.5 (HIGH).

---

RFC Requirement

RFC 7515 §4.1.11:

> The "crit" (Critical) Header Parameter indicates that extensions to this > specification and/or [JWA] are being used that MUST be understood and > processed. [...] If any of the listed extension Header Parameters are > not understood and supported by the recipient, then the JWS is invalid.

---

Proof of Concept

python import jwt # PyJWT 2.8.0 import hmac, hashlib, base64, json

Construct token with unknown critical extension header = {"alg": "HS256", "crit": ["x-custom-policy"], "x-custom-policy": "require-mfa"} payload = {"sub": "attacker", "role": "admin"}

def b64url(data): return base64.urlsafeb64encode(data).rstrip(b"=").decode()

h = b64url(json.dumps(header, separators=(",", ":")).encode()) p = b64url(json.dumps(payload, separators=(",", ":")).encode()) sig = b64url(hmac.new(b"secret", f"{h}.{p}".encode(), hashlib.sha256).digest()) token = f"{h}.{p}.{sig}"

Should REJECT — x-custom-policy is not understood by PyJWT try: result = jwt.decode(token, "secret", algorithms=["HS256"]) print(f"ACCEPTED: {result}") # Output: ACCEPTED: {'sub': 'attacker', 'role': 'admin'} except Exception as e: print(f"REJECTED: {e}")

Expected: jwt.exceptions.InvalidTokenError: Unsupported critical extension: x-custom-policy Actual: Token accepted, payload returned.

Comparison with RFC-compliant library

python jwcrypto — correctly rejects from jwcrypto import jwt as jwjwt, jwk key = jwk.JWK(kty="oct", k=b64url(b"secret")) jwjwt.JWT(jwt=token, key=key, algs=["HS256"]) raises: InvalidJWSObject('Unknown critical header: "x-custom-policy"')

---

Impact

- Split-brain verification in mixed-library deployments (e.g., API gateway using jwcrypto rejects, backend using PyJWT accepts) - Security policy bypass when crit carries enforcement semantics (MFA, token binding, scope restrictions) - Token binding bypass — RFC 7800 cnf (Proof-of-Possession) can be silently ignored - See CVE-2025-59420 for full impact analysis

---

Suggested Fix

In jwt/apijwt.py, add validation in validateheaders() or decode():

python SUPPORTEDCRIT = {"b64"} # Add extensions PyJWT actually supports

def validatecrit(self, headers: dict) -> None: crit = headers.get("crit") if crit is None: return if not isinstance(crit, list) or len(crit) == 0: raise InvalidTokenError("crit must be a non-empty array") for ext in crit: if ext not in self.SUPPORTEDCRIT: raise InvalidTokenError(f"Unsupported critical extension: {ext}") if ext not in headers: raise InvalidTokenError(f"Critical extension {ext} not in header")

---

CWE

- CWE-345: Insufficient Verification of Data Authenticity - CWE-863: Incorrect Authorization

References

- RFC 7515 §4.1.11 - CVE-2025-59420 — Authlib crit bypass (CVSS 7.5) - RFC 7800 — Proof-of-Possession Key Semantics

Other sources

PyJWT is a JSON Web Token implementation in Python. Prior to 2.12.0, PyJWT does not validate the crit (Critical) Header Parameter defined in RFC 7515 §4.1.11. When a JWS token contains a crit array listing extensions that PyJWT does not understand, the library accepts the token instead of rejecting it. This violates the MUST requirement in the RFC. This vulnerability is fixed in 2.12.0.

MITRE

Affected Software

4 affected componentsFixes available
pypi/pyjwt<2.12.0
pip/PyJWT<=2.11.0
2.12.0
Pyjwt Project Pyjwt<2.12.0
IBM API Connect<=V10.0.8.0 - V10.0.8.9

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/PyJWT to a version that resolves this vulnerability.

    Fixed in 2.12.0
  2. Upgrade

    Upgrade PyJWT to a version that resolves this vulnerability.

    Fixed in 2.12.0
  3. Configuration

    In PyJWT, add/enable _validate_crit() so that when headers include a "crit" array, every listed extension is understood and present; if an extension in crit is not in the header or not supported, raise jwt.exceptions.InvalidTokenError (e.g., "Unsupported critical extension: {ext}" / "Critical extension {ext} not in header"). Ensure crit is a non-empty array and reject otherwise. Prior to 2.12.0, unknown crit header extensions were accepted.

    PyJWT crit header validation (_validate_crit) = Reject tokens when crit lists any unsupported extension

Event History

Mar 12, 2026
CVE Published
via MITRE·09:41 PM
Data Sourced
via MITRE·09:41 PM
DescriptionSeverityWeakness
Data Sourced
via Red Hat·10:01 PM
DescriptionSeverityAffected Software
Mar 13, 2026
Data Sourced
via NVD·07:55 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·07:55 PM
Affected Software
Advisory Published
via GitHub·08:05 PM
Data Sourced
via GitHub·08:05 PM
DescriptionSeverityWeaknessAffected Software
Jul 7, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-32597?

CVE-2026-32597 is considered a moderate severity vulnerability due to the improper handling of the crit header in JSON Web Tokens.

2

How do I fix CVE-2026-32597?

To fix CVE-2026-32597, upgrade PyJWT to version 2.12.0 or later where the crit header validation is properly implemented.

3

What versions of PyJWT are affected by CVE-2026-32597?

Versions of PyJWT prior to 2.12.0 are affected by CVE-2026-32597.

4

What impact does CVE-2026-32597 have on applications using PyJWT?

CVE-2026-32597 allows attackers to bypass security checks by exploiting the lack of validation on the crit header in JSON Web Tokens.

5

Is there any workaround for CVE-2026-32597?

No known workarounds exist for CVE-2026-32597; upgrading to the patched version is recommended.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203