CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-101918

CVE-2026-101918: Unauthenticated Denial of Service via Recursion Exhaustion in PyJWT

Alon Barad
Alon Barad
Software Engineer

Sep 30, 2026·5 min read·40 visits

Executive Summary (TL;DR)

An unauthenticated remote attacker can crash Python web servers using PyJWT by transmitting a token with thousands of nested JSON brackets, triggering an uncaught RecursionError and resulting in a Denial of Service (DoS).

A Denial of Service (DoS) vulnerability exists in the PyJWT library when parsing unverified token payloads containing deeply nested JSON structures. Because PyJWT fails to catch RecursionError during payload parsing, an unauthenticated remote attacker can crash the application thread or worker by sending a specially crafted token.

Vulnerability Overview

PyJWT is a Python implementation of the JSON Web Token (JWT) standards. The vulnerability resides in the pre-verification payload parsing routines of PyJWT. Specifically, when applications perform dynamic signing key lookups (such as using PyJWKClient.get_signing_key_from_jwt) or decode tokens with signature verification explicitly disabled (verify_signature=False), PyJWT decodes and parses the token's payload prior to validating its cryptographic signature.

This architecture creates an unauthenticated attack surface. An attacker can submit an arbitrary payload that forces parsing operations before cryptographic validation is performed. This issue is classified under CWE-248 (Uncaught Exception) and CWE-400 (Uncontrolled Resource Consumption), allowing an unauthenticated remote attacker to trigger a Denial of Service (DoS) against applications utilizing vulnerable versions of PyJWT.

Root Cause Analysis

The root cause of this vulnerability lies in PyJWT's failure to catch the native RecursionError raised by CPython's standard library JSON parser during payload deserialization. The default parser, json.loads, uses a recursive-descent parsing algorithm to process nested structures. Each layer of nested arrays ([ or ]) or objects ({ or }) increases the depth of the interpreter's call stack.

CPython enforces a hard execution call stack depth limit, typically set to 1,000 frames. When the standard JSON parser encounters structures with nesting that exceeds this threshold, the interpreter halts execution and raises a native RecursionError to prevent process-level stack overflow. PyJWT wrapped the parsing statement json.loads(decoded["payload"]) in a try-except block configured to catch only ValueError. Because RecursionError inherits from RuntimeError rather than ValueError, the exception bubbles up through the application execution context and crashes the thread or process handling the request.

Code Analysis

The vulnerability exists in jwt/api_jwt.py within the helper function _decode_payload. Below is a code block illustrating the vulnerable implementation alongside the subsequent patch implemented in version 2.15.0.

# Vulnerable Code in PyJWT < 2.15.0
def _decode_payload(self, decoded: dict[str, Any]) -> dict[str, Any]:
    try:
        # Highly nested payload structures raise a RecursionError here
        payload: dict[str, Any] = json.loads(decoded["payload"])
    except ValueError as e:
        # Only ValueError (and its subclass JSONDecodeError) is intercepted
        raise DecodeError(f"Invalid payload string: {e}") from e
    if not isinstance(payload, dict):
        raise DecodeError("Invalid payload string: must be a json object")

The fix updates the exception target to handle both ValueError and RecursionError. This converts interpreter-level stack crashes into structured, catchable application-level exceptions.

# Patched Code in PyJWT >= 2.15.0
def _decode_payload(self, decoded: dict[str, Any]) -> dict[str, Any]:
    try:
        payload: dict[str, Any] = json.loads(decoded["payload"])
    except (ValueError, RecursionError) as e:
        # RecursionError is now safely caught and wrapped
        raise DecodeError(f"Invalid payload string: {e}") from e
    if not isinstance(payload, dict):
        raise DecodeError("Invalid payload string: must be a json object")

This adjustment ensures that payload parsing errors do not cause the entire process or execution worker to terminate.

Exploitation Methodology

To exploit this vulnerability, a remote attacker generates a JWT with a payload containing deeply nested JSON arrays or objects. Because payload parsing occurs before signature verification, the token's cryptographic signature block can be left empty or contain dummy bytes. No secret keys or credentials are required.

The typical attack workflow is described below:

By repeatedly transmitting this payload to endpoints that perform dynamic key lookup or unverified decodes, an attacker can consume and crash all available application worker threads, leading to complete service exhaustion.

Impact Assessment

The primary impact of this vulnerability is service degradation or complete Denial of Service. In synchronous web frameworks (such as Django, Flask, or WSGI deployments), crashing a worker thread with an unhandled exception interrupts active client connections and drops active tasks. In asynchronous runtimes (such as FastAPI or Sanic), unhandled errors in async paths can disrupt the entire event loop.

The exploit is highly asymmetric. A payload containing 20,000 open brackets occupies roughly 40 kilobytes of space, yet it is sufficient to exhaust the execution stack on a default CPython environment. This allows an attacker with minimal network resource constraints to impair the availability of identity management and API gateway systems.

Remediation and Mitigation

The primary remediation step is upgrading PyJWT to version 2.15.0 or higher, which catches the stack exhaustion exception and raises a standard DecodeError instead.

In environments where upgrading the library is not immediately possible, security teams should implement pre-verification middleware to restrict payload depth. The following filter validates token string structure prior to parsing:

import base64
 
def validate_jwt_nesting_depth(raw_token: str, max_depth: int = 50) -> bool:
    parts = raw_token.split(".")
    if len(parts) < 2:
        return False
    try:
        # Safely pad and decode base64 payload bytes
        payload_bytes = base64.urlsafe_b64decode(parts[1] + "==")
        depth = 0
        for byte in payload_bytes:
            if byte in (91, 123):  # '[' or '{'
                depth += 1
                if depth > max_depth:
                    return False
            elif byte in (93, 125):  # ']' or '}'
                depth = max(0, depth - 1)
        return True
    except Exception:
        return False

Enforcing rate limiting on public-facing endpoints and establishing restrictive HTTP request timeout parameters will also mitigate exploitation attempts.

Official Patches

jpadillaOfficial patch fixing the RecursionError handling

Fix Analysis (1)

Technical Appendix

CVSS Score
5.3/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
EPSS Probability
0.29%
Top 80% most exploited

Affected Systems

Python web applications and microservices using PyJWT versions >= 2.0.0a1 and < 2.15.0 to decode tokens pre-verification or with disabled signature validation.

Affected Versions Detail

Product
Affected Versions
Fixed Version
pyjwt
jpadilla
>= 2.0.0a1, < 2.15.02.15.0
AttributeDetail
CWE IDCWE-248 / CWE-400
Attack VectorNetwork (AV:N)
CVSS Score5.3 (Medium)
EPSS Score0.00291 (Percentile: 19.51%)
ImpactDenial of Service (DoS)
Exploit StatusProof-of-Concept
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1499.004Endpoint Denial of Service: Application Exhaustion
Impact
CWE-248
Uncaught Exception

The software does not explicitly handle or catch an exception that can be thrown within its execution block, resulting in sudden termination of the program or thread.

Known Exploits & Detection

GitHub AdvisoryExploit methodology and context details regarding unauthenticated payload recursion limits

Vulnerability Timeline

Pre-verification security issue identified in PyJWT payload parsing
2026-09-11
Fix commit 5fde08a6cf906aa7698de2d6391d88b73006b17b merged
2026-09-22
PyJWT 2.15.0 released and GHSA-42vr-xj54-vc7v published
2026-09-28

References & Sources

  • [1]GitHub Security Advisory GHSA-42vr-xj54-vc7v
  • [2]PyJWT 2.15.0 Release Notes
  • [3]NVD Vulnerability Details for CVE-2026-101918

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•10 minutes ago•CVE-2026-62297
7.5

CVE-2026-62297: Uncontrolled Memory Allocation and Denial of Service in ag-psd

An uncontrolled memory allocation vulnerability exists in ag-psd versions prior to 31.0.0. When parsing Adobe Photoshop Document (PSD) files, the readPsd() function reads image dimensions and color depth directly from the file header and allocates off-heap typed arrays without validating whether the requested memory size is proportional to the input stream or bounded by operational thresholds. An unauthenticated attacker can supply a crafted 52-byte PSD payload that triggers an immediate 3.35 GB memory allocation, resulting in process termination via the operating system Out-Of-Memory (OOM) killer.

Amit Schendel
Amit Schendel
0 views•10 min read
•about 1 hour ago•CVE-2026-126297
7.5

CVE-2026-126297: Algorithmic Complexity Denial of Service in NLTK ConllCorpusReader

CVE-2026-126297 (GHSA-v8f3-6phw-6mh9) is an uncontrolled resource consumption and algorithmic complexity vulnerability in the Natural Language Toolkit (NLTK) prior to version 3.10.4. Located in the Semantic Role Labeling (SRL) parser within `nltk/corpus/reader/conll.py`, the flaw allows an attacker to trigger quadratic O(N^2) CPU processing overhead by providing crafted CoNLL-formatted corpus inputs containing decoy span columns or nested full-width verb spans. Applications parsing untrusted linguistic corpora can experience prolonged CPU exhaustion and application-level Denial of Service (DoS).

Amit Schendel
Amit Schendel
2 views•12 min read
•about 2 hours ago•CVE-2026-126298
7.5

CVE-2026-126298: Quadratic Algorithmic Complexity Denial of Service in NLTK Tree.chomsky_normal_form

CVE-2026-126298 (also tracked as GHSA-r53h-rw34-8h97) is an algorithmic complexity Denial of Service (DoS) vulnerability in the Natural Language Toolkit (NLTK) Python library affecting all versions prior to 3.10.4. The vulnerability resides in the nltk.tree.transforms.chomsky_normal_form function and its corresponding public method Tree.chomsky_normal_form(). When transforming a parse tree into Chomsky Normal Form using the default right-factoring strategy, the function repeatedly invokes list.pop(0) inside a loop iterating over all children of a node. In CPython, removing the initial element of a standard list requires an O(N) memory shift operation, causing the overall binarization algorithm to degrade to O(N^2) quadratic time complexity relative to the width of a node. Furthermore, converting horizontal node width into vertical tree depth bypasses initial parsing depth bounds, triggering subsequent stack exhaustion (RecursionError) when recursive methods traverse the mutated structure. Unauthenticated remote attackers who can submit bracketed tree strings to applications invoking this transformation can exhaust single-threaded CPU resources or induce unhandled application exceptions.

Alon Barad
Alon Barad
5 views•12 min read
•about 3 hours ago•CVE-2026-126299
7.5

CVE-2026-126299: Quadratic Algorithmic Complexity Denial of Service in NLTK CCG Lexicon Parser

An algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) before version 3.10.4 allows remote unauthenticated attackers to cause a denial of service via crafted Combinatory Categorial Grammar (CCG) lexicon strings. The parser in nltk.ccg.lexicon.fromstring performs repeated immutable string slicing, concatenation, and regex tail capturing, resulting in O(n^2) CPU consumption when processing wide, flat category definitions.

Alon Barad
Alon Barad
4 views•10 min read
•about 4 hours ago•CVE-2026-126295
7.1

CVE-2026-126295: Path Traversal and Unconfined File Access in NLTK BllipParser

CVE-2026-126295 (also tracked as GHSA-fg9w-wfp5-j933) is a path confinement bypass vulnerability in the Natural Language Toolkit (NLTK) affecting versions 3.10.0 prior to 3.10.4. The flaw resides in nltk/parse/bllip.py within the BllipParser class and its factory method BllipParser.from_unified_model_dir(). Unlike sibling tool wrappers in NLTK that enforce data-root confinement via the nltk.pathsec module, BllipParser passes caller-supplied filesystem paths directly into the third-party bllipparser native C extension without validation. When an application passes untrusted input as model paths or directories to BllipParser, an attacker can force the native extension to open arbitrary files on the local filesystem. This leads to information disclosure through parser diagnostic oracles, local model tampering via shared directories, and denial of service by hanging worker threads on blocking special files (such as FIFOs or device nodes) or exhausting memory via oversized files.

Amit Schendel
Amit Schendel
2 views•11 min read
•about 5 hours ago•CVE-2026-126300
5.3

CVE-2026-126300: Algorithmic Complexity Denial of Service in NLTK TreebankWordTokenizer.span_tokenize

CVE-2026-126300 (GHSA-ffr9-mgrr-wcvr) is an inefficient algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) Python library affecting versions 3.2.5 prior to 3.10.4. The flaw resides in the quote-restoration routine of TreebankWordTokenizer.span_tokenize and NLTKWordTokenizer.span_tokenize, where repeated calls to list.pop(0) over matched quote tokens introduce quadratic O(n^2) time complexity. An unauthenticated remote attacker who supplies input containing long sequences of double-quote characters can exhaust CPU resources and degrade service availability.

Amit Schendel
Amit Schendel
3 views•10 min read