CVE-2026-102274
Malformed RSA JWK aborts PyJWKSet building, causing auth failures/DOS.
- CVSS 7.5
- CWE-755
- Input Validation and Sanitization
- Remote
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. Consequently, applications can experience authentication failures or request-level denial of service. This issue is fixed in version 2.14.0.
- CWE
- CWE-755
- CVSS base score
- 7.5
- Published
- 2026-09-28
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- PyJWT
- Fixed by upgrading
- Yes
Solution
Upgrade PyJWT to version 2.14.0 or later.
Vulnerable code sample
import jwt
from jwt import PyJWKSet
def load_jwks(jwks_json: str) -> PyJWKSet:
# VULNERABLE: does not handle malformed RSA JWK entries
return PyJWKSet.from_dict(jwt.json_decode(jwks_json))Patched code sample
import jwt
from jwt import PyJWKSet
def load_jwks(jwks_json: str) -> PyJWKSet:
# FIX: skip malformed RSA JWK entries to avoid aborting the whole set
raw = jwt.json_decode(jwks_json)
cleaned = {"keys": []}
for jwk in raw.get("keys", []):
try:
# Attempt to construct the key; this will raise ValueError for malformed RSA JWKs
PyJWKSet.from_dict({"keys": [jwk]})
cleaned["keys"].append(jwk)
except ValueError:
continue
return PyJWKSet.from_dict(cleaned)Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Skip malformed JWKs in JWK sets (jpadilla/pyjwt)
jwt/api_jwk.py · PyJWK.__init__
Cite this entry
@misc{vaitp:cve2026102274,
title = {{Malformed RSA JWK aborts PyJWKSet building, causing auth failures/DOS.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-102274},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-102274/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
