{"vuln_id":"CVE-2026-128140","aliases":["GHSA-pcm8-fqjx-rvx8"],"description":"nltk: nltk: Denial of Service via circular collection references","published_at":"2026-11-19T17:23:24Z","modified_at":"2026-11-22T21:00:06.782096Z","first_seen_at":"2026-11-21T19:15:15.262588Z","severity":"medium","severity_source":"nvd","cvss_score":6.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H","cwe":["CWE-835"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":0.00356,"epss_percentile":0.2989,"nvd_status":"Awaiting Analysis","enriched_at":null,"links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-128140"},"matched_alias":null,"items":[{"id":10706,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-pcm8-fqjx-rvx8: NLTK: Downloader cyclic collection indices cause an infinite closure walk","summary":"NLTK: Downloader cyclic collection indices cause an infinite closure walk\n\n> **affected**: PyPI `nltk` `>= 3.6.7` — `nltk.downloader` index parsing (`Downloader._update_index`)\n> **dynamically reproduced**: `nltk` `3.6.7` (4/4 checks), `3.9.2` (4/4), `3.10.3` (4/4), and `develop` `6818767b9` (4/4)\n\n---\n\n_Source references (`nltk/downloader.py:NNN`) are to commit `6818767b9` (`develop`, `v3.10.3-15-g6818767b9`). The `v3.10.3` tag and the released `3.10.3` wheel carry the identical code at the identical line numbers (the vulnerable closure BFS sits at `downloader.py:1300-1310`). Dynamically verified wheels additionally show the same defect at `downloader.py:972` (`3.9.2`) and `downloader.py:987` (`3.6.7`)._\n\n### Summary\n\n`Downloader._update_index` (`nltk/downloader.py:1253-1313`) is the mandatory first step of every downloader operation (`download()`, `info()`, `packages()`, `collections()`, `list()`, `status()`). After replacing each `\n` string with the actual `Collection`/`Package` object (`downloader.py:1285-1290`), it computes each collection's recursive package closure with a breadth-first walk that has **no visited set and no depth cap**:\n\n```python\n# nltk/downloader.py:1300-1310\nfor collection in self._collections.values():\npackages = {}\nqueue = [collection]\nfor child in queue:\nif isinstance(child, Collection):\nqueue.extend(child.children)\nelif isinstance(child, Package):\npackages[child.id] = child\ncollection.packages = packages.values()\n```\n\n**A self-referencing or mutually-referencing index — e.g. `\n` — turns `a.children` into an object-level cycle, and the `for child in queue: queue.extend(child.children)` loop appends to the very list it is iterating, so the queue grows forever.** The function never returns: CPU spins at 100% and memory grows without bound until the process is killed or the host runs out of memory. The identical finite input (one collection containing one package) completes in ~0.2 s on the control index, so the input is perfectly ordinary in size — only its self-reference is abnormal, and nothing validates it.\n\n### Details\n\nRoot cause is the combination of three unguarded steps:\n\n1. `Collection.fromxml` (`nltk/downloader.py:362-369`) stores each `\n` attribute verbatim as a string. It never checks whether a ref targets the collection's own id, or participates in a reference cycle.\n2. `_update_index` (`nltk/downloader.py:1285-1290`) replaces those ref strings with the live objects from `self._collections` / `self._packages`. A self- or mutual-reference therefore becomes an object-level cycle in `children`.\n3. The closure walk (`nltk/downloader.py:1300-1310`) iterates `for child in queue` while doing `queue.extend(child.children)` inside the loop. Python's list iterator consumes elements appended during iteration, so with a cycle the iterator and the queue length advance in lockstep forever. There is no `visited` set, no node-count cap, and no cycle detection.\n\nThe input\n\nAffected: PyPI:nltk\n\nFixed in: 3.10.4\n\nReferences:\nhttps://github.com/nltk/nltk/security/advisories/GHSA-pcm8-fqjx-rvx8\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-128140\nhttps://github.com/nltk/nltk/pull/3767\nhttps://github.com/nltk/nltk/commit/b77d329db934711e053520588b22b4ac73539fa2\nhttps://github.com/nltk/nltk\nhttps://github.com/nltk/nltk/releases/tag/v3.10.4","url":"https://osv.dev/vulnerability/GHSA-pcm8-fqjx-rvx8","published_at":"2026-11-19T23:54:33Z","updated_at":"2026-11-20T00:00:04.063068Z","fetched_at":"2026-11-21T19:15:55.946118Z","severity":"medium","cvss_score":6.5,"epss":0.00356,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"nltk","vuln_id":"CVE-2026-128140","vuln_ids":["CVE-2026-128140","GHSA-PCM8-FQJX-RVX8"],"tags":["osv","pypi","fix-available"],"cluster_id":2139,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10706","html":"https://vulnwatch.ve1ve2.com/item/10706"}},{"id":2353,"source":{"id":"ghsa","name":"GitHub Security Advisories"},"title":"GHSA-pcm8-fqjx-rvx8 / CVE-2026-128140: NLTK: Downloader cyclic collection indices cause an infinite closure walk","summary":"NLTK: Downloader cyclic collection indices cause an infinite closure walk\n\n> **affected**: PyPI `nltk` `>= 3.6.7` — `nltk.downloader` index parsing (`Downloader._update_index`)\n> **dynamically reproduced**: `nltk` `3.6.7` (4/4 checks), `3.9.2` (4/4), `3.10.3` (4/4), and `develop` `6818767b9` (4/4)\n\n---\n\n_Source references (`nltk/downloader.py:NNN`) are to commit `6818767b9` (`develop`, `v3.10.3-15-g6818767b9`). The `v3.10.3` tag and the released `3.10.3` wheel carry the identical code at the identical line numbers (the vulnerable closure BFS sits at `downloader.py:1300-1310`). Dynamically verified wheels additionally show the same defect at `downloader.py:972` (`3.9.2`) and `downloader.py:987` (`3.6.7`)._\n\n### Summary\n\n`Downloader._update_index` (`nltk/downloader.py:1253-1313`) is the mandatory first step of every downloader operation (`download()`, `info()`, `packages()`, `collections()`, `list()`, `status()`). After replacing each `\n` string with the actual `Collection`/`Package` object (`downloader.py:1285-1290`), it computes each collection's recursive package closure with a breadth-first walk that has **no visited set and no depth cap**:\n\n```python\n# nltk/downloader.py:1300-1310\nfor collection in self._collections.values():\npackages = {}\nqueue = [collection]\nfor child in queue:\nif isinstance(child, Collection):\nqueue.extend(child.children)\nelif isinstance(child, Package):\npackages[child.id] = child\ncollection.packages = packages.values()\n```\n\n**A self-referencing or mutually-referencing index — e.g. `\n` — turns `a.children` into an object-level cycle, and the `for child in queue: queue.extend(child.children)` loop appends to the very list it is iterating, so the queue grows forever.** The function never returns: CPU spins at 100% and memory grows without bound until the process is killed or the host runs out of memory. The identical finite input (one collection containing one package) completes in ~0.2 s on the control index, so the input is perfectly ordinary in size — only its self-reference is abnormal, and nothing validates it.\n\n### Details\n\nRoot cause is the combination of three unguarded steps:\n\n1. `Collection.fromxml` (`nltk/downloader.py:362-369`) stores each `\n` attribute verbatim as a string. It never checks whether a ref targets the collection's own id, or participates in a reference cycle.\n2. `_update_index` (`nltk/downloader.py:1285-1290`) replaces those ref strings with the live objects from `self._collections` / `self._packages`. A self- or mutual-reference therefore becomes an object-level cycle in `children`.\n3. The closure walk (`nltk/downloader.py:1300-1310`) iterates `for child in queue` while doing `queue.extend(child.children)` inside the loop. Python's list iterator consumes elements appended during iteration, so with a cycle the iterator and the queue length advance in lockstep forever. There is no `visited` set, no node-count cap, and no cycle detection.\n\nThe input\n\nAffected packages: pip:nltk\nPatched: nltk 3.10.4","url":"https://github.com/advisories/GHSA-pcm8-fqjx-rvx8","published_at":"2026-11-19T23:54:33Z","updated_at":"2026-11-19T23:54:33Z","fetched_at":"2026-11-21T19:15:18.416772Z","severity":"medium","cvss_score":6.5,"epss":0.00356,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"nltk","vuln_id":"CVE-2026-128140","vuln_ids":["CVE-2026-128140","GHSA-PCM8-FQJX-RVX8"],"tags":["ghsa","pip","CWE-835"],"cluster_id":2139,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/2353","html":"https://vulnwatch.ve1ve2.com/item/2353"}},{"id":15167,"source":{"id":"osv","name":"OSV.dev"},"title":"DEBIAN-CVE-2026-128140: 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. From 3.6.7 until 3.10.4, nltk.downloader follows collection membership without tracking already visited collection nodes. A self-referencing or mutually referencing collection index can therefore make the package-closure walk loop indefinitely while its queue and memory usage grow, denying service when a victim processes the attacker-influenced index. This issue is fixed in version 3.10.4.\n\nAffected: Debian:12:nltk, Debian:13:nltk, Debian:14:nltk\n\nNo fixed version published yet\n\nReferences:\nhttps://security-tracker.debian.org/tracker/CVE-2026-128140","url":"https://osv.dev/vulnerability/DEBIAN-CVE-2026-128140","published_at":"2026-11-19T18:18:06.453000Z","updated_at":"2026-11-22T21:00:06.782096Z","fetched_at":"2026-11-23T03:05:53.019732Z","severity":"medium","cvss_score":6.5,"epss":0.00356,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"debian","product":"12:nltk","vuln_id":"CVE-2026-128140","vuln_ids":["CVE-2026-128140","DEBIAN-CVE-2026-128140","GHSA-PCM8-FQJX-RVX8"],"tags":["osv","debian","no-fix-yet"],"cluster_id":843,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/15167","html":"https://vulnwatch.ve1ve2.com/item/15167"}},{"id":9032,"source":{"id":"nvd","name":"NVD CVE API 2.0"},"title":"CVE-2026-128140: 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. From 3.6.7 until 3.10.4, nltk.downloader follows collection membership without tracking already visited collection nodes. A self-referencing or mutually referencing collection index can therefore make the package-closure walk loop indefinitely while its queue and memory usage grow, denying service when a victim processes the attacker-influenced index. This issue is fixed in version 3.10.4.\n\nReferences:\nhttps://github.com/nltk/nltk/commit/b77d329db934711e053520588b22b4ac73539fa2\nhttps://github.com/nltk/nltk/pull/3767\nhttps://github.com/nltk/nltk/releases/tag/v3.10.4\nhttps://github.com/nltk/nltk/security/advisories/GHSA-pcm8-fqjx-rvx8","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-128140","published_at":"2026-11-19T18:18:06.453000Z","updated_at":"2026-11-19T19:17:21.153000Z","fetched_at":"2026-11-21T19:15:31.484686Z","severity":"medium","cvss_score":6.5,"epss":0.00356,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":null,"vuln_id":"CVE-2026-128140","vuln_ids":["CVE-2026-128140","GHSA-PCM8-FQJX-RVX8"],"tags":["CWE-835"],"cluster_id":843,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/9032","html":"https://vulnwatch.ve1ve2.com/item/9032"}},{"id":1104,"source":{"id":"redhat","name":"Red Hat Security Data API"},"title":"CVE-2026-128140: nltk: nltk: Denial of Service via circular collection references","summary":"nltk: nltk: Denial of Service via circular collection references","url":"https://access.redhat.com/security/cve/cve-2026-128140","published_at":"2026-11-19T17:23:24Z","updated_at":null,"fetched_at":"2026-11-21T19:15:08.893775Z","severity":"medium","cvss_score":6.5,"epss":0.00356,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"redhat","product":null,"vuln_id":"CVE-2026-128140","vuln_ids":["CVE-2026-128140","GHSA-PCM8-FQJX-RVX8"],"tags":["redhat"],"cluster_id":843,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/1104","html":"https://vulnwatch.ve1ve2.com/item/1104"}}]}