CVE-2026-101918
Unauthenticated RecursionError in PyJWT 2.0.0a1–2.15.0 causes HTTP 500 responses.
- CVSS 7.5
- CWE-248
- Resource Management
- Remote
PyJWT is a Python implementation of JSON Web Token standards. From 2.0.0a1 until 2.15.0, PyJWT 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. Consequently, an unauthenticated request can raise an exception that may produce an HTTP 500 response. The advisory-defined affected implementation also includes jwt/api_jwt.py, verify_signature=False. This issue is fixed in version 2.15.0.
- CWE
- CWE-248
- CVSS base score
- 7.5
- Published
- 2026-09-28
- OWASP
- A06 Vulnerable and Outdated Components
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Resource Management
- Subcategory
- Resource Exhaustion
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- PyJWT
- Fixed by upgrading
- Yes
Solution
Upgrade PyJWT to version 2.15.0 or newer.
Vulnerable code sample
import jwt
from jwt import PyJWKClient
def get_key(token, jwks_url):
# VULNERABLE: catches only ValueError, allows RecursionError to propagate
jwk_client = PyJWKClient(jwks_url)
try:
signing_key = jwk_client.get_signing_key_from_jwt(token)
except ValueError as e:
raise jwt.InvalidTokenError("Invalid token") from e
return signing_key.keyPatched code sample
import jwt
from jwt import PyJWKClient
def get_key(token, jwks_url):
# FIX: also catches RecursionError to prevent resource exhaustion
jwk_client = PyJWKClient(jwks_url)
try:
signing_key = jwk_client.get_signing_key_from_jwt(token)
except (ValueError, RecursionError) as e:
raise jwt.InvalidTokenError("Invalid token") from e
return signing_key.keyPublished 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.
- fix: normalize recursive JWT payload errors (jpadilla/pyjwt)
jwt/api_jwt.py · PyJWT._decode_payload
Cite this entry
@misc{vaitp:cve2026101918,
title = {{Unauthenticated RecursionError in PyJWT 2.0.0a1–2.15.0 causes HTTP 500 responses.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-101918},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-101918/}}
}
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 ::
