{"vuln_id":"CVE-2026-63312","aliases":[],"description":"NLTK before 3.10.0 contains an arbitrary local file read vulnerability in StreamBackedCorpusView that bypasses pathsec.ENFORCE by calling builtins.open() directly instead of pathsec.open(). Attackers who control the fileid argument can read arbitrary local files regardless of the ENFORCE setting, including sensitive system files and application credentials.","published_at":"2026-08-22T15:16:19.367000Z","modified_at":"2026-10-14T13:10:00.187000Z","first_seen_at":"2026-11-21T19:15:19.369916Z","severity":"high","severity_source":"nvd","cvss_score":8.7,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","cwe":["CWE-22"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":0.00651,"epss_percentile":0.52143,"nvd_status":"Analyzed","enriched_at":"2026-11-22T18:07:56.411457Z","links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-63312"},"matched_alias":null,"items":[{"id":10695,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-w674-vqhw-g3pg: NLTK: StreamBackedCorpusView constructor os.stat leaks out-of-root file existence, size, and mtime bypassing pathsec ENFORCE","summary":"NLTK: StreamBackedCorpusView constructor os.stat leaks out-of-root file existence, size, and mtime bypassing pathsec ENFORCE\n\n## Summary\n\n`StreamBackedCorpusView`, a public API in `nltk/corpus/reader/util.py`, applies the pathsec sandbox to the file content it reads but not to the file metadata it probes in its constructor. When the view is created with a plain string fileid, `__init__` calls `os.stat(self._fileid).st_size` with no pathsec validation, so an application that passes an attacker influenced path to the constructor discloses whether an arbitrary out of root file exists and, if it does, its exact byte size and modification time, even when `nltk.pathsec.ENFORCE` is `True`. This is the residual metadata channel left open by the fix for CVE-2026-63312 (GHSA-x5ph-mj9p-rfr8), which closed arbitrary content read on the same code path but did not bring the sibling `os.stat` under the sandbox.\n\n## Root Cause\n\nThe pathsec sandbox is intended to confine all NLTK filesystem access to allowed data roots. The fix for CVE-2026-63312 enforced this for content reads by routing `StreamBackedCorpusView._open` through `nltk.pathsec.open` (`_secure_open`). The constructor, however, computes the end of file position eagerly, and on the non `PathPointer` branch it stats the caller supplied path directly. The `PathPointer` branch is validated (it calls `PathPointer.file_size()`), but the plain string branch reaches `os.stat` with no `validate_path`, `_secure_open`, or `required_root` check. The security invariant \"no filesystem access outside allowed roots under ENFORCE\" is therefore violated for the metadata channel: `os.stat` is filesystem access, and it is performed on the same untrusted string entry point that the content read fix protected.\n\n```text\nAffected component: nltk.corpus.reader.util.StreamBackedCorpusView.__init__\nSink:   nltk/corpus/reader/util.py, os.stat(self._fileid).st_size on the plain-string branch\nGuarded sibling: _open() (routes through nltk.pathsec.open); the constructor os.stat is not guarded\n```\n\n## Impact\n\nAn attacker who can influence the fileid string passed to `StreamBackedCorpusView(...)` (the same attacker model under which CVE-2026-63312 was published for content read) obtains a filesystem oracle that operates across the process visible filesystem regardless of the pathsec data roots and with `ENFORCE=True`:\n\n- Existence: a present path returns a size; a missing path raises `ValueError` whose message embeds the underlying OS error, so ENOENT, EACCES, and ENOTDIR are distinguishable, adding a permission and type probe.\n- Exact size: `st_size` of the target file is exposed (demonstrated below: `1850` for `/etc/passwd`, matching the real size).\n- Modification time: `st_mtime` is available from the same stat result.\n\nFile content is not disclosed: iterating the view still routes through the sandboxed open and is refused. The demonstrated capability is therefore metadata only (existence, exact size, mtime, and error class discrimination). Reachability is application conditional: in tree corpus readers construct views from validated `PathPointer` objects\n\nAffected: PyPI:nltk\n\nFixed in: 3.10.4\n\nReferences:\nhttps://github.com/nltk/nltk/security/advisories/GHSA-w674-vqhw-g3pg\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-129233\nhttps://github.com/nltk/nltk/pull/3888\nhttps://github.com/nltk/nltk/commit/2c563b13f9dce7c15eefd4b03463e1b69b64f1f3\nhttps://github.com/nltk/nltk/commit/68434c0427f8d296f3adfddb518525038d1f7bfa\nhttps://github.com/nltk/nltk\nhttps://github.com/nltk/nltk/releases/tag/v3.10.4","url":"https://osv.dev/vulnerability/GHSA-w674-vqhw-g3pg","published_at":"2026-11-19T23:47:58Z","updated_at":"2026-11-20T00:00:05.083219Z","fetched_at":"2026-11-21T19:15:55.946110Z","severity":"high","cvss_score":8.7,"epss":0.00651,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"nltk","vuln_id":"CVE-2026-129233","vuln_ids":["CVE-2026-129233","CVE-2026-63312","GHSA-W674-VQHW-G3PG","GHSA-X5PH-MJ9P-RFR8"],"tags":["osv","pypi","fix-available"],"cluster_id":2157,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10695","html":"https://vulnwatch.ve1ve2.com/item/10695"}},{"id":2366,"source":{"id":"ghsa","name":"GitHub Security Advisories"},"title":"GHSA-w674-vqhw-g3pg / CVE-2026-129233: NLTK: StreamBackedCorpusView constructor os.stat leaks out-of-root file existence, size, and mtime bypassing pathsec ENFORCE","summary":"NLTK: StreamBackedCorpusView constructor os.stat leaks out-of-root file existence, size, and mtime bypassing pathsec ENFORCE\n\n## Summary\n\n`StreamBackedCorpusView`, a public API in `nltk/corpus/reader/util.py`, applies the pathsec sandbox to the file content it reads but not to the file metadata it probes in its constructor. When the view is created with a plain string fileid, `__init__` calls `os.stat(self._fileid).st_size` with no pathsec validation, so an application that passes an attacker influenced path to the constructor discloses whether an arbitrary out of root file exists and, if it does, its exact byte size and modification time, even when `nltk.pathsec.ENFORCE` is `True`. This is the residual metadata channel left open by the fix for CVE-2026-63312 (GHSA-x5ph-mj9p-rfr8), which closed arbitrary content read on the same code path but did not bring the sibling `os.stat` under the sandbox.\n\n## Root Cause\n\nThe pathsec sandbox is intended to confine all NLTK filesystem access to allowed data roots. The fix for CVE-2026-63312 enforced this for content reads by routing `StreamBackedCorpusView._open` through `nltk.pathsec.open` (`_secure_open`). The constructor, however, computes the end of file position eagerly, and on the non `PathPointer` branch it stats the caller supplied path directly. The `PathPointer` branch is validated (it calls `PathPointer.file_size()`), but the plain string branch reaches `os.stat` with no `validate_path`, `_secure_open`, or `required_root` check. The security invariant \"no filesystem access outside allowed roots under ENFORCE\" is therefore violated for the metadata channel: `os.stat` is filesystem access, and it is performed on the same untrusted string entry point that the content read fix protected.\n\n```text\nAffected component: nltk.corpus.reader.util.StreamBackedCorpusView.__init__\nSink:   nltk/corpus/reader/util.py, os.stat(self._fileid).st_size on the plain-string branch\nGuarded sibling: _open() (routes through nltk.pathsec.open); the constructor os.stat is not guarded\n```\n\n## Impact\n\nAn attacker who can influence the fileid string passed to `StreamBackedCorpusView(...)` (the same attacker model under which CVE-2026-63312 was published for content read) obtains a filesystem oracle that operates across the process visible filesystem regardless of the pathsec data roots and with `ENFORCE=True`:\n\n- Existence: a present path returns a size; a missing path raises `ValueError` whose message embeds the underlying OS error, so ENOENT, EACCES, and ENOTDIR are distinguishable, adding a permission and type probe.\n- Exact size: `st_size` of the target file is exposed (demonstrated below: `1850` for `/etc/passwd`, matching the real size).\n- Modification time: `st_mtime` is available from the same stat result.\n\nFile content is not disclosed: iterating the view still routes through the sandboxed open and is refused. The demonstrated capability is therefore metadata only (existence, exact size, mtime, and error class discrimination). Reachability is application conditional: in tree corpus readers construct views from validated `PathPointer` objects\n\nAffected packages: pip:nltk\nPatched: nltk 3.10.4","url":"https://github.com/advisories/GHSA-w674-vqhw-g3pg","published_at":"2026-11-19T23:47:58Z","updated_at":"2026-11-19T23:47:59Z","fetched_at":"2026-11-21T19:15:18.416782Z","severity":"high","cvss_score":8.7,"epss":0.00651,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"nltk","vuln_id":"CVE-2026-129233","vuln_ids":["CVE-2026-129233","CVE-2026-63312","GHSA-W674-VQHW-G3PG","GHSA-X5PH-MJ9P-RFR8"],"tags":["ghsa","pip","CWE-200","CWE-538"],"cluster_id":2157,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/2366","html":"https://vulnwatch.ve1ve2.com/item/2366"}}]}