PT-2026-66886 · Pypi · Nltk
CVE-2026-12072
·
Published
2026-07-31
·
Updated
2026-08-13
CVSS v3.1
7.5
High
| Vector | AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
Name of the Vulnerable Software and Affected Versions
nltk versions prior to 3.9.5
Description
A path-traversal issue in
NKJPCorpusReader allows an attacker to read files outside the designated corpus root by influencing the fileids argument. This occurs because the reader uses plain string concatenation and the builtin open() function without performing containment checks, effectively bypassing the nltk.pathsec sandbox and its ENFORCE = True strict mode. The vulnerability is present in the add root() function and affects public read methods including header(), raw(), words(), sents(), and tagged words(). Specifically, the header() method can return the parsed content of an arbitrary out-of-root file to the caller. The issue stems from the use of os.path.join and builtin open() instead of the hardened FileSystemPathPointer API.Recommendations
Update nltk to a version where the
NKJPCorpusReader and related components use FileSystemPathPointer.open() and validate path() to ensure file access is restricted to allowed directories.
As a temporary mitigation, avoid passing user-influenced values to the fileids argument in NKJPCorpusReader methods.Fix
Path traversal
Found an issue in the description? Have something to add? Feel free to write us 👾
Weakness Enumeration
Related Identifiers
Affected Products
Nltk