MEDIUMCVSS v3.1 5.3Vulnerability

CVE-2026-129232

## Summary NLTK's `XMLCorpusView.read_block` rebuilds the full root-to-node context path with `"/".join(context)` on every start tag while it is still searching for a matching element. Because the context stack grows with XML nesting depth and the join is repeated once per start tag, a single corpus file containing deeply nested tags forces O(n^2) pure-Python work, where n is the number of nested elements. Any application that parses attacker-influenced XML corpus data through an `XMLCorpusView` subclass (for example the `nps_chat`, `framenet`, `bnc`, `mte`, `nkjp`, or `semcor` readers) can be driven to exhaust a CPU core for an extended period, producing a denial of service without any authentication or special privilege. ## Root Cause `read_block` maintains a `context` list that is appended on each start tag and popped on each end tag, so it grows monotonically to the maximum nesting depth while an element is being sought. For every start tag, while no target element has been located yet (`elt_start is None`), the code recomputes the entire path string from scratch and matches it against the reader's tagspec. The tagspec is anchored (`tagspec + "\\Z"`), so a nested path such as `a/a/a/...` never completes a full match against a concrete tagspec like `Session/Posts/Post`; `elt_start` therefore stays `None` for the entire file and the per-start-tag join runs for all n tags over depths 1..n. Summing those join costs yields O(n^2). There is no nesting-depth limit, context-length bound, or cumulative-work budget in `read_block`, and the per-call regex timeout used elsewhere in the file does not observe this cumulative pure-Python string cost. ```text nltk/corpus/reader/xmldocs.py : XMLCorpusView.read_block context.append(name) # start-tag: stack grows with depth if elt_start is None: if tagspec.match("/".join(context)): # full path rebuilt per start tag -> O(depth) ... # empty-element variant rebuilds "/".

Properties

Severity
medium
Summary
NLTK: Quadratic CPU exhaustion in NLTK XMLCorpusView.read_block via deeply nested XML corpus tags
Nvd fetched at
2026-11-22T12:30:49.958423+00:00
Epss score
0.00536
Cvss severity
MEDIUM
Cvss score
5.3
Retrieved at
2026-11-22T12:32:26+00:00
Ghsa published
2026-11-19T23:48:18Z
Source url
https://github.com/advisories/GHSA-cj8f-5fp3-6m88
Ghsa updated
2026-11-19T23:48:19Z
Ghsa id
GHSA-cj8f-5fp3-6m88
Last source
FIRST EPSS
Score
5.3
Cvss version
3.1
Cve id
CVE-2026-129232
Cvss vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
First seen by Signal
2026-11-19T19:29:21+00:00
Name
CVE-2026-129232
Is ghsa only
false
Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Related Entities (4)

AFFECTS (1)

→[Software]pip/nltk

VULNERABLE_TO (1)

←[Software]pip/nltk

Related research

Explore deeper with Ninja Signal's threat intelligence graph

CVE-2026-129232 (CVSS v3.1 5.3) — Ninja Signal Threat Intelligence | Ninja Signal