CVE-2026-71514: NLTK 3.9.4 through 3.10.2 Path Traversal via CrubadanCorpusReader pathsec Bypass
NLTK 3.9.4 through 3.10.2 contains a path traversal vulnerability in CrubadanCorpusReader. loadlangngrams joins the corpus root with crubadancode, the column-0 value read from the corpus table.txt mapping file, and opens the result with the builtin open() rather than the pathsec-validated opener, so os.path.join discards the root when that value is absolute and the read escapes the corpus directory without the containment check nltk.pathsec applies when ENFORCE is set. An attacker who controls a corpus package can disclose file contents outside the corpus root through langfreq, limited to paths ending in -3grams.txt whose contents parse as token count lines.
Affected Software
Event History
Frequently Asked Questions
Who is realistically exposed to this issue?
Applications using NLTK 3.9.4 through 3.10.2 and loading a Crubadan corpus package whose table.txt mapping file is attacker-controlled are exposed. The affected path is reached when CrubadanCorpusReader loads language n-grams through lang_freq.
What does an attacker need to exploit it?
The attacker must control a corpus package, including the column-0 crubadan_code value in table.txt, and induce a user to use it. The crafted value must point to a path ending in -3grams.txt, and the target file's contents must parse as token-count lines.
Does enabling NLTK pathsec enforcement prevent exploitation?
No. The vulnerable code uses the builtin open() after joining the corpus root and crubadan_code, rather than the pathsec-validated opener, so an absolute value can bypass the containment check even when nltk.pathsec enforcement is enabled.
How can I determine whether a corpus package is malicious or affected?
Inspect the package's table.txt mapping file for column-0 crubadan_code values that are absolute paths or otherwise resolve outside the corpus root. Also review whether those entries reference files ending in -3grams.txt, since those are the files the vulnerable loader attempts to read.