CVE-2026-63312: NLTK StreamBackedCorpusView pathsec.ENFORCE bypass

CVE-2026-63312 · Severity: high · CVSS 7.5 · Published 2026-08-22

NLTK is a natural language processing library commonly used in NLP pipelines and web applications. Applications that enable NLTK's strict file-access control mode (pathsec.ENFORCE = True) are intended to prevent unauthorized file reads. However, the StreamBackedCorpusView class bypasses this protection, allowing attackers who can influence file path parameters to read any file on the system, including system configuration files and sensitive credentials stored in environment variables or config files.

Technologies: nltk (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2026-63312 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-63312 being exploited in the wild.
How severe is CVE-2026-63312?
High severity, with a CVSS score of 7.5, published 22 August 2026.
Which products and versions are affected?
nltk (PyPI) <= 3.9.4, ECOSYSTEM:introduced=0,fixed=3.10.0.
Is there a fix for CVE-2026-63312?
Yes. nltk (PyPI): upgrade to 3.10.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-63312 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-63312?
Check whether you run nltk (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • nltk (PyPI): upgrade to 3.10.0 or later
    pip install "nltk>=3.10.0"

Technical details

The vulnerability is a security control bypass (CWE-22, CWE-284). StreamBackedCorpusView._open() in nltk/corpus/reader/util.py calls builtins.open() and os.stat() directly on line 171 and 208, rather than routing through nltk.pathsec.open() which enforces path validation via pathsec.validate_path(). When user input controls the fileid argument (common in REST APIs and web apps serving NLTK-based NLP), an unauthenticated attacker can request arbitrary file paths such as /etc/passwd, /proc/self/environ, or application config files. The attack requires network access but no privileges. XMLCorpusView and other corpus reader subclasses passing string fileids are also affected. The fix, available in NLTK 3.10.0, replaces direct builtins.open() calls with nltk.pathsec.open().

Affected products

  • NLTK NLTK <= 3.9.4

Identifiers

  • CVE-2026-63312
  • GHSA-x5ph-mj9p-rfr8
  • PYSEC-2026-3730

Timeline

  • 2026-09-08: disclosed: GHSA-x5ph-mj9p-rfr8 and CVE-2026-63312 published
  • 2026: patched: Fixed in NLTK 3.10.0

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.