CVE-2026-63312: NLTK: StreamBackedCorpusView Bypasses pathsec.ENFORCE - Arbitrary Local File Read
Setting nltk.pathsec.ENFORCE = True is documented to sandbox all file access to allowed NLTK data directories and raise PermissionError on unauthorized access. However, StreamBackedCorpusView opens files via builtins.open() directly, bypassing pathsec.validate_path() entirely. An attacker who can influence the fileid argument can read arbitrary local files regardless of the ENFORCE setting.
References
- github.com/advisories/GHSA-x5ph-mj9p-rfr8
- github.com/nltk/nltk/commit/674ea75accdf08eca3782dee0a9c4ed7e0d0025b
- github.com/nltk/nltk/pull/3588
- github.com/nltk/nltk/releases/tag/v3.10.0
- github.com/nltk/nltk/security/advisories/GHSA-x5ph-mj9p-rfr8
- github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3730.yaml
- nvd.nist.gov/vuln/detail/CVE-2026-63312
- www.vulncheck.com/advisories/nltk-streambackedcorpusview-bypasses-pathsec-enforce-arbitrary-file-read
Code Behaviors & Features
Detect and mitigate CVE-2026-63312 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →