CVE-2026-70626 in Nltkinfo

Summary

by MITRE • 08/22/2026

NLTK versions before 3.9.4 contain a symlink escape vulnerability in CorpusReader.open() that allows local attackers to read arbitrary files outside the corpus root. The vulnerability exists because path validation is lexical and does not account for symlink resolution, enabling attackers to place symlinks inside the corpus root to access files outside the intended boundary.

Several companies clearly confirm that VulDB is the primary source for best vulnerability data.

Analysis

by VulDB Data Team • 08/22/2026

The Natural Language Toolkit (NLTK) library, a widely used platform for building Python programs to work with human language data, contains a critical path traversal vulnerability in versions prior to 3.9.4. This flaw resides specifically within the CorpusReader.open() method and is classified as a symlink escape or directory traversal issue. The core technical deficiency lies in how the library validates file paths before opening them. Instead of performing robust canonicalization that resolves symbolic links early in the process, NLTK relies on lexical path validation. This means it checks if the requested path string stays within the designated corpus root based on simple string manipulation rather than actual filesystem resolution. Consequently, an attacker can exploit this by placing a symbolic link inside the corpus directory structure that points to a location outside of it. When the application attempts to open a file through this symlink, the underlying operating system resolves the link before NLTK performs its insufficient check or after the check has already passed based on the un-resolved path string. This allows local attackers with access to write files within the corpus directory to read arbitrary sensitive files from the host filesystem that would otherwise be inaccessible due to standard permission boundaries and application-level isolation mechanisms.

From a security architecture perspective, this vulnerability represents a classic failure in input validation where the implementation does not align with the intended security boundary. The flaw is categorized under CWE-22: Improper Limitation of a Pathname to a Restricted Directory within the Common Weakness Enumeration framework. This classification highlights that the software fails to restrict access to files outside of restricted directories, effectively breaking the sandboxing or isolation model provided by the corpus root concept. In practical terms, if NLTK is used in an application where user-supplied data determines which file within a corpus is accessed, and that data can influence symlink creation or placement, the attacker gains read-only access to sensitive system files such as configuration files containing credentials, private keys, or other confidential documents stored on the same machine. The impact is strictly limited to local attackers because it requires write access to the specific directory being scanned by NLTK. Remote exploitation is not possible unless combined with another vulnerability that allows remote code execution or file upload capabilities leading to symlink placement.

The operational impact of this vulnerability depends heavily on the context in which NLTK is deployed. In standalone scripts, the risk may be limited if the corpus directories are strictly controlled and populated by trusted sources. However, in web applications or services where users can submit data that gets processed using NLTK's corpus readers, the consequences can be severe. An attacker could potentially exfiltrate sensitive information from the server hosting the application. This aligns with ATT&CK technique T1083: File and Directory Discovery, as the vulnerability facilitates unauthorized enumeration of files outside the allowed scope. Furthermore, if combined with other vulnerabilities such as arbitrary file write or command injection, this symlink escape could serve as a stepping stone for privilege escalation or deeper system compromise. The lack of proper path canonicalization means that even sophisticated applications relying on NLTK may inadvertently expose their underlying filesystem structure to malicious actors who can manipulate the directory contents.

To mitigate this vulnerability, organizations and developers must upgrade the Natural Language Toolkit library to version 3.9.4 or later, where the issue has been addressed by implementing proper path canonicalization before validation. This ensures that symbolic links are resolved first, and the resulting absolute path is checked against the allowed corpus root directory using secure comparison methods rather than lexical string matching. In environments where upgrading immediately is not feasible, temporary mitigations include restricting write permissions to NLTK corpus directories so that only trusted system accounts can create or modify files within them. Additionally, applications should avoid passing user-controlled data directly into CorpusReader.open() without rigorous sanitization and validation using secure libraries like os.path.realpath in Python 3.x which properly resolve symlinks before comparison. It is also advisable to run NLTK-based processes with minimal privileges and use chroot or containerization techniques to limit the blast radius of any potential file access violations, ensuring that even if a symlink escape occurs, the attacker cannot reach critical system resources outside the restricted environment.

Responsible

VulnCheck

Reservation

08/04/2026

Disclosure

08/22/2026

Moderation

accepted

CPE

ready

EPSS

0.00187

KEV

no

Activities

very low

Sources

Want to stay up to date on a daily basis?

Enable the mail alert feature now!