Junglewise Threat Intelligence

CVE-2026-71514: NLTK CrubadanCorpusReader path traversal in corpus reader

CVE-2026-71514 · Severity: low · CVSS 2.5 · Published 2026-08-22

Executive brief

NLTK is a widely-used natural language processing library that includes corpus readers for accessing language datasets. The CrubadanCorpusReader component, which provides access to n-gram statistics for language identification, contains a path traversal vulnerability that allows an attacker who controls a malicious corpus package to read arbitrary files from the system. An attacker could access sensitive files outside the intended corpus directory, though the impact is limited to file contents ending in specific patterns and to local file access only.

Technical details

The vulnerability exists in the CrubadanCorpusReader._load_lang_ngrams method, which reads language codes from a corpus table.txt mapping file and constructs file paths using os.path.join without validation. When the crubadan_code value is an absolute path, os.path.join discards the corpus root prefix, allowing directory traversal. The method then opens the resulting path using the built-in open() function rather than nltk.pathsec.open, which bypasses the containment checks that would otherwise apply when pathsec.ENFORCE is enabled. An attacker who controls a corpus package can craft a malicious table.txt that points to files outside the corpus directory. File disclosure is limited to paths ending in -3grams.txt whose contents parse as token count lines. The vulnerability requires local access and user interaction to exploit. The fix, released in NLTK 3.10.3, routes all corpus reader file operations through a hardened pathsec sandbox that validates opened file descriptors against the trusted corpus root.

Affected products

  • NLTK Project NLTK >=3.9.4, <3.10.3

Timeline

  • 2026-08-22: disclosed: Vulnerability published to GitHub Advisory Database
  • 2026-08-10: patched: Fix committed to nltk repository (commit 10d34b3)
  • 2026-08-22: patched: Patched version 3.10.3 released

References

Related threats