{"vuln_id":"GHSA-g58v-j9g9-5gfg","aliases":["CVE-2026-128137"],"description":"NLTK corpus-reader view methods bypass the scoped root sandbox via intermediate-directory symlinks","published_at":"2026-11-19T23:56:30Z","modified_at":"2026-11-20T00:15:06.485749Z","first_seen_at":"2026-11-21T19:15:19.348995Z","severity":"medium","severity_source":"ghsa","cvss_score":5.5,"cvss_vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","cwe":["CWE-59"],"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-g58v-j9g9-5gfg"},"matched_alias":null,"items":[{"id":10683,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-g58v-j9g9-5gfg: NLTK corpus-reader view methods bypass the scoped root sandbox via intermediate-directory symlinks","summary":"NLTK corpus-reader view methods bypass the scoped root sandbox via intermediate-directory symlinks\n\n> **affected**: PyPI `nltk` `>= 3.9.4` — `CorpusReader.abspaths()`/`abspath()` and the `PlaintextCorpusReader` / `SyntaxCorpusReader` view methods\n> **dynamically reproduced**: `nltk` `3.9.4` (8/9, scoped-escape checks), `3.10.3` (wheel, 9/9 checks) and `master` `6818767b9` (9/9 checks)\n\n---\n\n_Source references (`file:line`) are to commit `303f6e2b` (release tag `v3.10.3`). Line numbers in the released `nltk` wheel match this tag exactly; `master` `6818767b9` contains the same code (pathsec.py renumbered by +44 lines from added hardening comments). In `3.9.4` the same logic exists at earlier line numbers (`api.py:222-236` for `open()`, `api.py:161-203` for `abspath()`/`abspaths()`, `data.py:382-388` for the pointer open, `pathsec.py:105-114` for the scoped branch); the affected code is identical._\n\n### Summary\n\n`CorpusReader.open()` (`nltk/corpus/reader/api.py:235-257`) is NLTK's hardened file-access entry point: after a lexical guard it calls `validate_path(..., required_root=self._root)` (`api.py:246-249`), and the scoped branch of `pathsec.validate_path` (`nltk/pathsec.py:168-179`) resolves symlinks and raises `ValueError` when the resolved target is not inside the corpus root. The view methods do **not** use this entry point: `PlaintextCorpusReader.words/sents/paras` (`nltk/corpus/reader/plaintext.py:67-118`) and `SyntaxCorpusReader.parsed_sents/tagged_sents/sents/tagged_words/words` (`api.py:473-519`) build their streams from `self.abspaths(fileids, ...)` (`api.py:174-217`), which only does a lexical `self._root.join(fileid)` (`nltk/data.py:452-469`) and returns a `FileSystemPathPointer`. That pointer is opened via `FileSystemPathPointer.open()` → `pathsec.open(raw_path, \"rb\")` with `required_root` left at its default `None` (`data.py:438-447`, `nltk/pathsec.py:752,783`), so only the **global** allowed-roots check runs. The `O_NOFOLLOW` in `_hardened_open` (`pathsec.py:676-731`) protects only the final path component, so an **intermediate-directory symlink inside the corpus root** pointing at a sibling allowed root is followed by the kernel. **A caller who places such a symlink (or loads an untrusted corpus containing one) can read any file that `open()` would refuse — files outside the corpus root yet inside the global NLTK data sandbox — via `PlaintextCorpusReader.words([...])` / `SyntaxCorpusReader.words([...])` (and the `abspaths()`-returned pointer), defeating the scoped escape protection that GHSA-p4rw-class fixes and `test_required_root_blocks_symlink_escape` were added for.**\n\n### Details\n\nRoot cause: two sibling file-access channels on the same `CorpusReader` disagree about the scoped sandbox.\n\n1. `CorpusReader.open()` (`api.py:235-257`) — the guarded channel:\n   - Layer 1 lexical guard (`api.py:240-242`) rejects absolute paths and `..`.\n   - Layer 2 scoped guard (`api.py:246-249`) calls `pathsec.validate_path(path, context=\"CorpusReader\", required_root=self._root)`.\n   - The `required_root` branch (`pathsec.py:168-179`) resolves th\n\nAffected: PyPI:nltk\n\nFixed in: 3.10.4\n\nReferences:\nhttps://github.com/nltk/nltk/security/advisories/GHSA-g58v-j9g9-5gfg\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-128137\nhttps://github.com/nltk/nltk/pull/3761\nhttps://github.com/nltk/nltk/commit/9f7cf06b4af4ca5c65381ed0abc17e989dc54400\nhttps://github.com/nltk/nltk\nhttps://github.com/nltk/nltk/releases/tag/v3.10.4","url":"https://osv.dev/vulnerability/GHSA-g58v-j9g9-5gfg","published_at":"2026-11-19T23:56:30Z","updated_at":"2026-11-20T00:15:06.485749Z","fetched_at":"2026-11-21T19:15:55.946101Z","severity":"medium","cvss_score":5.5,"epss":0.00158,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"nltk","vuln_id":"CVE-2026-128137","vuln_ids":["CVE-2026-128137","GHSA-G58V-J9G9-5GFG"],"tags":["osv","pypi","fix-available"],"cluster_id":2133,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10683","html":"https://vulnwatch.ve1ve2.com/item/10683"}},{"id":2350,"source":{"id":"ghsa","name":"GitHub Security Advisories"},"title":"GHSA-g58v-j9g9-5gfg / CVE-2026-128137: NLTK corpus-reader view methods bypass the scoped root sandbox via intermediate-directory symlinks","summary":"NLTK corpus-reader view methods bypass the scoped root sandbox via intermediate-directory symlinks\n\n> **affected**: PyPI `nltk` `>= 3.9.4` — `CorpusReader.abspaths()`/`abspath()` and the `PlaintextCorpusReader` / `SyntaxCorpusReader` view methods\n> **dynamically reproduced**: `nltk` `3.9.4` (8/9, scoped-escape checks), `3.10.3` (wheel, 9/9 checks) and `master` `6818767b9` (9/9 checks)\n\n---\n\n_Source references (`file:line`) are to commit `303f6e2b` (release tag `v3.10.3`). Line numbers in the released `nltk` wheel match this tag exactly; `master` `6818767b9` contains the same code (pathsec.py renumbered by +44 lines from added hardening comments). In `3.9.4` the same logic exists at earlier line numbers (`api.py:222-236` for `open()`, `api.py:161-203` for `abspath()`/`abspaths()`, `data.py:382-388` for the pointer open, `pathsec.py:105-114` for the scoped branch); the affected code is identical._\n\n### Summary\n\n`CorpusReader.open()` (`nltk/corpus/reader/api.py:235-257`) is NLTK's hardened file-access entry point: after a lexical guard it calls `validate_path(..., required_root=self._root)` (`api.py:246-249`), and the scoped branch of `pathsec.validate_path` (`nltk/pathsec.py:168-179`) resolves symlinks and raises `ValueError` when the resolved target is not inside the corpus root. The view methods do **not** use this entry point: `PlaintextCorpusReader.words/sents/paras` (`nltk/corpus/reader/plaintext.py:67-118`) and `SyntaxCorpusReader.parsed_sents/tagged_sents/sents/tagged_words/words` (`api.py:473-519`) build their streams from `self.abspaths(fileids, ...)` (`api.py:174-217`), which only does a lexical `self._root.join(fileid)` (`nltk/data.py:452-469`) and returns a `FileSystemPathPointer`. That pointer is opened via `FileSystemPathPointer.open()` → `pathsec.open(raw_path, \"rb\")` with `required_root` left at its default `None` (`data.py:438-447`, `nltk/pathsec.py:752,783`), so only the **global** allowed-roots check runs. The `O_NOFOLLOW` in `_hardened_open` (`pathsec.py:676-731`) protects only the final path component, so an **intermediate-directory symlink inside the corpus root** pointing at a sibling allowed root is followed by the kernel. **A caller who places such a symlink (or loads an untrusted corpus containing one) can read any file that `open()` would refuse — files outside the corpus root yet inside the global NLTK data sandbox — via `PlaintextCorpusReader.words([...])` / `SyntaxCorpusReader.words([...])` (and the `abspaths()`-returned pointer), defeating the scoped escape protection that GHSA-p4rw-class fixes and `test_required_root_blocks_symlink_escape` were added for.**\n\n### Details\n\nRoot cause: two sibling file-access channels on the same `CorpusReader` disagree about the scoped sandbox.\n\n1. `CorpusReader.open()` (`api.py:235-257`) — the guarded channel:\n   - Layer 1 lexical guard (`api.py:240-242`) rejects absolute paths and `..`.\n   - Layer 2 scoped guard (`api.py:246-249`) calls `pathsec.validate_path(path, context=\"CorpusReader\", required_root=self._root)`.\n   - The `required_root` branch (`pathsec.py:168-179`) resolves th\n\nAffected packages: pip:nltk\nPatched: nltk 3.10.4","url":"https://github.com/advisories/GHSA-g58v-j9g9-5gfg","published_at":"2026-11-19T23:56:30Z","updated_at":"2026-11-19T23:56:31Z","fetched_at":"2026-11-21T19:15:18.416770Z","severity":"medium","cvss_score":5.5,"epss":0.00158,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"nltk","vuln_id":"CVE-2026-128137","vuln_ids":["CVE-2026-128137","GHSA-G58V-J9G9-5GFG"],"tags":["ghsa","pip","CWE-59"],"cluster_id":2133,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/2350","html":"https://vulnwatch.ve1ve2.com/item/2350"}},{"id":9067,"source":{"id":"nvd","name":"NVD CVE API 2.0"},"title":"CVE-2026-128137: 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.9.4 until 3.10.4, NLTK corpus-reader path pointers and view methods validate a requested relative path without consistently resolving intermediate directory symlinks against the reader's scoped root. A local attacker who can place such a symlink can make abspaths or words reach a readable file outside the corpus root and disclose its contents. On releases with pathsec enforcement, the file must remain inside a global NLTK allowed root; version 3.9.4 has enforcement disabled and permits a broader escape. This issue is fixed in version 3.10.4.\n\nReferences:\nhttps://github.com/nltk/nltk/commit/9f7cf06b4af4ca5c65381ed0abc17e989dc54400\nhttps://github.com/nltk/nltk/pull/3761\nhttps://github.com/nltk/nltk/releases/tag/v3.10.4\nhttps://github.com/nltk/nltk/security/advisories/GHSA-g58v-j9g9-5gfg","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-128137","published_at":"2026-11-19T19:17:20.880000Z","updated_at":"2026-11-19T21:17:48.537000Z","fetched_at":"2026-11-21T19:15:31.484714Z","severity":"medium","cvss_score":5.5,"epss":0.00158,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":null,"vuln_id":"CVE-2026-128137","vuln_ids":["CVE-2026-128137","GHSA-G58V-J9G9-5GFG"],"tags":["CWE-59"],"cluster_id":833,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/9067","html":"https://vulnwatch.ve1ve2.com/item/9067"}}]}