PyJWT vulnerabilities
17 known CVE vulnerabilities in PyJWT, translated and rated.
- CVE-2017-11424High
In PyJWT versions 1.5.0 and below, the `invalid_strings` check in `HMACAlgorithm.prepare_key` does not account for all PEM encoded public keys. Specifically, the PKCS1 PEM encoded format is allowed, enabling symmetric/asymmetric key confusion attacks.
- CVE-2026-102268Critical
PyJWT is a Python implementation of JSON Web Token standards. Prior to version 2.14.0, is_pem_format in jwt/utils.py does not recognize every PEM representation accepted by the cryptography loader. When an application mixes HMAC and asymmetric algorithms and supplies a mutated public-key PEM as raw key bytes, HMACAlgorithm.prepare_key treats the unrecognized asymmetric public key as an HMAC secret. An attacker who knows the public key can forge authenticated HMAC tokens. This issue is fixed in version 2.14.0.
- CVE-2026-103001Medium
PyJWT is a Python implementation of JSON Web Token standards. From 2.11.0 through 2.13.0, PyJWT._merge_options() can modify a caller-supplied mutable options mapping when verify_signature is false. If an application reuses that same mapping for a later decode() or decode_complete() call and changes verify_signature to true, the mapping can retain false values for expiration, not-before, issued-at, audience, issuer, subject, and JWT ID checks, allowing a signed token with invalid registered claims to be accepted without disabling signature verification; applications that create a fresh options mapping for each call are not affected.
- CVE-2026-102275Medium
PyJWT is a Python implementation of JSON Web Token standards. From 2.1.0 until 2.15.0, PyJWT OKPAlgorithm.from_jwk in jwt/algorithms.py is affected because private-JWK import path does not compare the public key derived from d with x. This occurs when an OKP private JWK supplies non-corresponding x and d components. As a result, identity derived from x can differ from operations performed with d.
- CVE-2026-102274Medium
PyJWT is a Python implementation of JSON Web Token standards. From 2.9.0 until 2.14.0, PyJWKSet does not catch the plain ValueError raised for malformed RSA JWK components by RSAAlgorithm.from_jwk in jwt/api_jwk.py. This occurs when a JWK Set contains a malformed RSA key alongside otherwise usable keys. As a result, one malformed member aborts construction of the entire PyJWKSet.
- CVE-2026-102273High
PyJWT is a Python implementation of JSON Web Token standards. From 2.13.0 until 2.14.0, HMACAlgorithm.prepare_key is affected because the HMAC key guard only recognizes top-level public JWK forms and misses container representations. When an application allows HMAC and asymmetric algorithms and passes a public JWK container as the raw key, public asymmetric key material is accepted as the HMAC secret. Consequently, an attacker who knows the public key can forge a token with arbitrary authenticated claims.
- CVE-2026-102272High
PyJWT is a Python implementation of JSON Web Token standards. From 2.13.0 until 2.14.0, HMACAlgorithm.prepare_key in jwt/algorithms.py is affected because the raw-JWK detector does not normalize accepted Unicode byte-order marks before checking for JSON. When a public JWK is prefixed with a UTF-8 BOM and used in a mixed-algorithm verification path, the public JWK bypasses asymmetric-key detection and becomes the HMAC secret. Consequently, an attacker who knows the public key can forge authenticated tokens.
- CVE-2026-102271High
PyJWT is a Python implementation of JSON Web Token standards. From 2.4.0 until 2.14.0, PyJWT HMACAlgorithm.prepare_key is affected because the asymmetric-key guard relies on textual markers that are absent from DER encoding. When an application mixes HMAC and asymmetric algorithms and supplies a DER public key as the shared verification key, PyJWT uses public DER bytes as an HMAC secret. Consequently, an attacker who knows the public key can forge authenticated HMAC tokens.
- CVE-2026-102270Medium
PyJWT is a Python implementation of JSON Web Token standards. Prior to 2.14.0, PyJWT is_pem_format is affected because lazy PEM regular expression backtracks extensively. This occurs when a certificate-like input contains repeated BEGIN markers without a matching END marker. As a result, is_pem_format performs unbounded backtracking while searching for a PEM end marker.
- CVE-2026-102269Medium
PyJWT is a Python implementation of JSON Web Token standards. Prior to 2.14.0, PyJWT signature segment is affected because signature segment decoding accepts characters outside the canonical Base64URL representation. This occurs when non-Base64URL characters are appended to a valid compact JWS signature segment. As a result, base64url_decode produces the same signature bytes for different serialized segments.
- CVE-2026-102267High
PyJWT is a Python implementation of JSON Web Token standards. Prior to 2.14.0, PyJWT PyJWKClient is affected because redirect destinations are not revalidated against the JWKS trust boundary. When a configured trusted JWKS endpoint returns an attacker-influenced redirect, PyJWKClient follows the redirect and consumes the redirected response as key material. Consequently, forwarded credentials may be disclosed or verification keys may be substituted.
- CVE-2026-102266High
PyJWT is a Python implementation of JSON Web Token standards. From 2.13.0 until 2.14.0, HMACAlgorithm.from_jwk is affected because the PyJWK verification path used the decoded key without applying prepare_key validation. When a trusted JWK Set contains an oct entry with an empty k value, an attacker signs an HMAC token with the same zero-length key accepted by PyJWT. Consequently, a forged token can carry arbitrary authenticated claims.
- CVE-2026-102265Medium
PyJWT is a Python implementation of JSON Web Token standards. From 2.13.0 until 2.14.0, PyJWS._load in jwt/api_jws.py is affected because parser catches ValueError but not RecursionError. This occurs when a deeply nested token header reaches json.loads. As a result, RecursionError escapes the documented PyJWT error hierarchy.
- CVE-2026-101918Medium
PyJWT is a Python implementation of JSON Web Token standards. From 2.0.0a1 until 2.15.0, PyJWKClient.get_signing_key_from_jwt is affected because payload parser catches ValueError but not RecursionError. This occurs when an attacker-controlled recursively nested payload reaches json.loads. As a result, documented PyJWT exception handling does not contain the failure, potentially leading to HTTP 500 responses on unauthenticated requests. Fixed in version 2.15.0.
- CVE-2026-101917Medium
PyJWT is a Python implementation of JSON Web Token standards. Prior to 2.14.0, get_signing_key_from_jwt is affected because unknown kid misses force refreshes without a negative cache or minimum refresh interval. This occurs when unauthenticated tokens repeatedly use the same unknown kid or varying kid values absent from the cached JWKS. As a result, each cache miss causes PyJWKClient to refresh the JWKS, allowing attacker traffic to amplify outbound requests to the configured JWKS endpoint. Fixed in version 2.14.0.
- CVE-2026-48526High
PyJWT library in Python prior to 2.13.0 does not validate the use of JSON Web Keys in HMAC algorithm, allowing an attacker to use the issuer's public key as the HMAC secret key.
- CVE-2026-32597High
PyJWT before version 2.12.0 does not validate the crit (Critical) Header Parameter defined in RFC 7515. When a JWS token contains a crit array listing extensions that PyJWT does not understand, the library accepts the token instead of rejecting it, violating the MUST requirement in the RFC.
Vulnerability data from NVD (NIST) · CISA KEV · EPSS

