{"vuln_id":"GHSA-cj8f-5fp3-6m88","aliases":["CVE-2026-129232"],"description":"NLTK: Quadratic CPU exhaustion in NLTK XMLCorpusView.read_block via deeply nested XML corpus tags","published_at":"2026-11-19T23:48:18Z","modified_at":"2026-11-20T00:00:05.087378Z","first_seen_at":"2026-11-21T19:15:19.367509Z","severity":"medium","severity_source":"ghsa","cvss_score":5.3,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","cwe":["CWE-400","CWE-407"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":null,"epss_percentile":null,"nvd_status":null,"enriched_at":null,"links":{"nvd":"https://github.com/advisories/GHSA-cj8f-5fp3-6m88"},"matched_alias":null,"items":[{"id":10692,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-cj8f-5fp3-6m88: NLTK: Quadratic CPU exhaustion in NLTK XMLCorpusView.read_block via deeply nested XML corpus tags","summary":"NLTK: Quadratic CPU exhaustion in NLTK XMLCorpusView.read_block via deeply nested XML corpus tags\n\n## Summary\n\nNLTK'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.\n\n## Root Cause\n\n`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.\n\n```text\nnltk/corpus/reader/xmldocs.py : XMLCorpusView.read_block\n  context.append(name)                              # start-tag: stack grows with depth\n  if elt_start is None:\n      if tagspec.match(\"/\".join(context)):          # full path rebuilt per start tag -> O(depth)\n          ...\n  # empty-element variant rebuilds \"/\".join(context) + \"/\" + name the same way\n```\n\n## Impact\n\nAn 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.\n\n## Proof of Concept\n\n`Requires only the nltk package and its standard XML corpus reading path; no network or special configuration.`\n\nReproduction drives a real `Seeka\n\nAffected: PyPI:nltk\n\nFixed in: 3.10.4\n\nReferences:\nhttps://github.com/nltk/nltk/security/advisories/GHSA-cj8f-5fp3-6m88\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-129232\nhttps://github.com/nltk/nltk/pull/3895\nhttps://github.com/nltk/nltk/commit/002bcf714ef8cb8baf94436f4be73e5516914412\nhttps://github.com/nltk/nltk\nhttps://github.com/nltk/nltk/releases/tag/v3.10.4","url":"https://osv.dev/vulnerability/GHSA-cj8f-5fp3-6m88","published_at":"2026-11-19T23:48:18Z","updated_at":"2026-11-20T00:00:05.087378Z","fetched_at":"2026-11-21T19:15:55.946108Z","severity":"medium","cvss_score":5.3,"epss":0.00536,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"nltk","vuln_id":"CVE-2026-129232","vuln_ids":["CVE-2026-129232","GHSA-CJ8F-5FP3-6M88"],"tags":["osv","pypi","fix-available"],"cluster_id":2156,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10692","html":"https://vulnwatch.ve1ve2.com/item/10692"}},{"id":2365,"source":{"id":"ghsa","name":"GitHub Security Advisories"},"title":"GHSA-cj8f-5fp3-6m88 / CVE-2026-129232: NLTK: Quadratic CPU exhaustion in NLTK XMLCorpusView.read_block via deeply nested XML corpus tags","summary":"NLTK: Quadratic CPU exhaustion in NLTK XMLCorpusView.read_block via deeply nested XML corpus tags\n\n## Summary\n\nNLTK'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.\n\n## Root Cause\n\n`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.\n\n```text\nnltk/corpus/reader/xmldocs.py : XMLCorpusView.read_block\n  context.append(name)                              # start-tag: stack grows with depth\n  if elt_start is None:\n      if tagspec.match(\"/\".join(context)):          # full path rebuilt per start tag -> O(depth)\n          ...\n  # empty-element variant rebuilds \"/\".join(context) + \"/\" + name the same way\n```\n\n## Impact\n\nAn 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.\n\n## Proof of Concept\n\n`Requires only the nltk package and its standard XML corpus reading path; no network or special configuration.`\n\nReproduction drives a real `Seeka\n\nAffected packages: pip:nltk\nPatched: nltk 3.10.4","url":"https://github.com/advisories/GHSA-cj8f-5fp3-6m88","published_at":"2026-11-19T23:48:18Z","updated_at":"2026-11-19T23:48:19Z","fetched_at":"2026-11-21T19:15:18.416781Z","severity":"medium","cvss_score":5.3,"epss":0.00536,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"nltk","vuln_id":"CVE-2026-129232","vuln_ids":["CVE-2026-129232","GHSA-CJ8F-5FP3-6M88"],"tags":["ghsa","pip","CWE-400","CWE-407"],"cluster_id":2156,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/2365","html":"https://vulnwatch.ve1ve2.com/item/2365"}},{"id":8973,"source":{"id":"nvd","name":"NVD CVE API 2.0"},"title":"CVE-2026-129232: NLTK (Natural Language Toolkit) is a suite of open source Python modules, data sets, and tutorials supporting research and development in Natural Language Proc…","summary":"NLTK (Natural Language Toolkit) is a suite of open source Python modules, data sets, and tutorials supporting research and development in Natural Language Processing. Prior to 3.10.4, XMLCorpusView.read_block rebuilds the full root-to-node context path with \"/\".join(context) for every start tag while searching for a matching element. Deeply nested attacker-influenced corpus XML therefore causes quadratic pure-Python work and can pin a processing worker, resulting in denial of service. This issue is fixed in version 3.10.4.\n\nReferences:\nhttps://github.com/nltk/nltk/commit/002bcf714ef8cb8baf94436f4be73e5516914412\nhttps://github.com/nltk/nltk/pull/3895\nhttps://github.com/nltk/nltk/releases/tag/v3.10.4\nhttps://github.com/nltk/nltk/security/advisories/GHSA-cj8f-5fp3-6m88\nhttps://github.com/nltk/nltk/security/advisories/GHSA-cj8f-5fp3-6m88","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-129232","published_at":"2026-11-19T17:17:56.083000Z","updated_at":"2026-11-20T22:17:49.433000Z","fetched_at":"2026-11-21T19:15:31.484637Z","severity":"medium","cvss_score":5.3,"epss":0.00536,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":null,"vuln_id":"CVE-2026-129232","vuln_ids":["CVE-2026-129232","GHSA-CJ8F-5FP3-6M88"],"tags":["CWE-400","CWE-407"],"cluster_id":848,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/8973","html":"https://vulnwatch.ve1ve2.com/item/8973"}}]}