CVE-2026-129232: Quadratic CPU exhaustion in NLTK XMLCorpusView.read_block via deeply nested XML corpus tags
Affects gptlineSource GCVE Database
Not known to be exploited · CVSS 5.3 Medium : upgrade to 1.0.8_25 when convenient.
Data as of 24 Nov 2026, 21:27 UTC
Thin evidence
One scorer or none| CNA (GitHub_M) | CVSS 3.1 | 5.3 |
|---|
- Patch
- Available – fixed in 1.0.8_25
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:LExploitation evidence
Disclosed: evidence found.
CVE published 19 Nov 2026
Detectable: no evidence on record.
No public nuclei template indexed
Weaponized: no evidence on record.
No public exploit code indexed in Metasploit or Exploit-DB
Exploited in the wildExploited: no evidence on record.
Not in CISA KEV and no source reports exploitation
Observed by OffSeq MirageSeen by Mirage: no evidence on record.
No attack traffic recorded by OffSeq Mirage sensors
A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 24 Nov 2026.
What to do
Upgrade gptline to 1.0.8_25.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
Homebrewgptlinepkg:brew/gptlineOther threats | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
Description
## 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 "/".join(context) + "/" + name the same way ``` ## Impact An unauthenticated attacker who can supply or influence an XML corpus file processed by an `XMLCorpusView` subclass can cause quadratic CPU consumption. A crafted file of roughly 200 KB consumes several seconds of a single core; a few-megabyte file pins a core for minutes, and an arbitrarily large or unclosed nested file can hang the affected process indefinitely on that core. The result is a denial-of-service condition (CWE-407 / CWE-400). No confidentiality or integrity impact is demonstrated; the impact is availability of the processing thread or process. The prerequisite is that the application feed untrusted or attacker-influenced corpus XML into one of the affected readers, which is the same trust boundary already accepted for the seed issue in the same file. ## Proof of Concept `Requires only the nltk package and its standard XML corpus reading path; no network or special configuration.` Reproduction drives a real `SeekableUnicodeStreamReader` and the real `read_block` with an `nps_chat`-style tagspec, comparing nested input (growing context depth) against a flat negative control with an identical tag count. ```python import time, io from nltk.corpus.reader.xmldocs import XMLCorpusView def measure(build, label): print(label) prev = None for n in (4000, 8000, 16000, 32000): body = build(n).encode("utf-8") # write to a temp file and open through an XMLCorpusView subclass tagspec import tempfile, os fd, path = tempfile.mkstemp(suffix=".xml") os.write(fd, b"<Session>" + body + b"</Session>"); os.close(fd) view = XMLCorpusView(path, "Session/Posts/Post") t = time.time() try: list(view) except Exception: pass dt = time.time() - t ratio = "" if prev is None else f"({dt/prev:.1f}x)" print(f" n={n:>6} time={dt:7.3f}s {ratio}") prev = dt os.remove(path) measure(lambda n: "<a>"*n + "</a>"*n, "NESTED (context depth = n):") measure(lambda n: "<a></a>"*n, "FLAT (context depth = 1, negative control):") ``` ```text NESTED (context depth = n): n= 4000 time= 0.162s n= 8000 time= 0.484s (2.99x) n= 16000 time= 1.595s (3.29x) n= 32000 time= 5.667s (3.6x) -> ratios trend toward 4x per 2x input = O(n^2) FLAT (context depth = 1, negative control): n= 8000 time= 0.145s n= 16000 time= 0.293s (2.03x) n= 32000 time= 0.580s (2.0x) -> 2x per 2x input = linear ``` ## Attack Chain 1. **Exposure:** An application uses an `XMLCorpusView` subclass (`nps_chat`, `framenet`, `bnc`, `mte`, `nkjp`, `semcor`, and similar) to read an XML corpus file whose contents an attacker can supply or influence. 2. **Control:** The attacker controls the XML body and nests a tag the view's tagspec never fully matches, for example `"<a>"` repeated n times followed by `"</a>"` repeated n times. 3. **Path:** `read_block` consumes the whole
References
- github.com/nltk/nltk/security/advisories/GHSA-cj8f-5fp3-6m88 (opens in a new tab)
- nvd.nist.gov/vuln/detail/CVE-2026-129232 (opens in a new tab)
- github.com/nltk/nltk/pull/3895 (opens in a new tab)
- github.com/nltk/nltk/commit/002bcf714ef8cb8baf94436f4be73e5516914412 (opens in a new tab)
- github.com/nltk/nltk (opens in a new tab)
- github.com/nltk/nltk/releases/tag/v3.10.4 (opens in a new tab)