CVE-2026-12243 NLTK Path Traversal Vulnerability: Percent-Encoding Bypass Allows Arbitrary File Read
NLTK 3.9.4 contains a path traversal vulnerability that allows an attacker to read files from the server by crafting specially-encoded resource names. The vulnerability exists because the security check looks for obvious traversal patterns (like `../`) but misses percent-encoded variations (like `..%2f`). When the validation passes, a decoding step reveals the actual path traversal sequence, giving attackers access to sensitive files that the Python process can read. Any application using NLTK to load data from user-controlled input is at risk.
Source data · NVD / CISA · public domain
- CVSS
- 3.0 · 7.5 HIGH · CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
- Weaknesses (CWE)
- CWE-22
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-06-30 / 2026-06-30
NVD description (verbatim)
NLTK version 3.9.4 is vulnerable to a path traversal attack due to an incomplete fix for GitHub Issue #3504. The `_UNSAFE_NO_PROTOCOL_RE` regex in `nltk/data.py` checks for literal `../` sequences but fails to account for percent-encoded traversal sequences such as `..%2f`. The `url2pathname()` function decodes these sequences after the validation step, allowing an attacker to bypass the protection. This vulnerability enables an attacker to read arbitrary files accessible to the Python process by controlling the resource name parameter passed to `nltk.data.load()` or `nltk.data.find()`. The issue affects applications that rely on NLTK for resource loading, including NLP web applications, Jupyter notebooks, and CLI tools. The default `pathsec.ENFORCE=False` setting exacerbates the impact by not blocking the file read at the `open()` stage.
2 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
NLTK's `nltk/data.py` implements a regex check (`_UNSAFE_NO_PROTOCOL_RE`) designed to block path traversal attempts in the `nltk.data.load()` and `nltk.data.find()` functions. The regex detects literal `../` sequences, but the validation occurs before URL decoding. An attacker can submit percent-encoded traversal sequences (e.g., `..%2f`) that bypass the regex, then pass decoding in the `url2pathname()` function, where the traversal intent becomes apparent. The vulnerability is exacerbated by NLTK's default `pathsec.ENFORCE=False` setting, which means no additional file-access restrictions are enforced at the `open()` call stage. This is a bypass of a previous incomplete fix for GitHub Issue #3504.
Business impact
Affected organizations face unauthorized disclosure of sensitive data. Applications using NLTK—including NLP web services, Jupyter-based data science platforms, and command-line tools—can expose configuration files, API keys, database credentials, source code, or other files readable by the application process. The impact depends on what files the Python process has permission to access, but in typical deployments, this could include the entire application codebase and configuration directory.
Affected systems
NLTK version 3.9.4 is confirmed vulnerable. Organizations running NLP applications, chatbot platforms, text analysis tools, and data science environments that depend on NLTK for resource loading should audit their deployments. The vulnerability affects any code path that calls `nltk.data.load()` or `nltk.data.find()` with untrusted or user-supplied resource names.
Exploitability
Exploitation requires no authentication, no user interaction, and no special network configuration—a remote attacker can craft a malicious resource name and submit it to an exposed API endpoint or web interface. The attack is trivial to execute: an attacker simply needs to provide a percent-encoded path traversal string such as `..%2f..%2fetc%2fpasswd` as the resource parameter. The low complexity and lack of prerequisites make this vulnerability highly practical to exploit in the wild.
Remediation
Upgrade NLTK to a patched version that correctly validates resource names before and after URL decoding. Additionally, configure `pathsec.ENFORCE=True` to enable strict file-access restrictions as a defense-in-depth measure. Organizations should audit their code to identify all calls to `nltk.data.load()` and `nltk.data.find()` and ensure resource names are not derived from untrusted input; if they must be, implement strict allowlisting of permitted resource names.
Patch guidance
Check the official NLTK GitHub repository and PyPI for a patched release addressing CVE-2026-12243. Verify against the vendor advisory before patching. Once a patch is released, update via your standard package management process (e.g., `pip install --upgrade nltk`). Test the update in a development environment first, particularly if your application relies on custom NLTK data paths or custom resource loading logic. Document the patched version in your dependency manifest.
Detection guidance
Monitor application logs for suspicious calls to `nltk.data.load()` or `nltk.data.find()` containing percent-encoded characters (e.g., `%2f`, `%2e`), particularly in patterns that resemble `..%2f`. Look for access attempts to files outside the expected NLTK data directory. Network-based detection can flag HTTP requests containing percent-encoded traversal sequences in parameters passed to endpoints that invoke NLTK resource loading. File integrity monitoring may alert if unexpected files are accessed by the Python process.
Why prioritize this
This vulnerability merits immediate attention despite not being on the CISA KEV list. It scores 7.5 (HIGH) with a network-exploitable vector, no authentication required, and straightforward bypass mechanics. The vulnerability affects a widely-used NLP library in web applications and data platforms where user input often flows to resource loading functions. The incomplete nature of the prior fix suggests a pattern of underestimating encoding bypass techniques, raising confidence in real-world exploitation.
Risk score, explained
CVSS 3.0 score of 7.5 reflects: (1) Network-accessible attack vector with no authentication or user interaction required; (2) Low attack complexity—simple percent-encoding bypass; (3) High confidentiality impact—arbitrary file read; (4) No integrity or availability impact; (5) Unchanged scope. The score appropriately reflects the severity for information disclosure but acknowledges no system compromise or DoS risk.
Frequently asked questions
Can an attacker modify or delete files, or crash the application?
No. This vulnerability only permits reading files. The attacker has no ability to modify, delete, or create files, nor to execute code or cause denial of service. Impact is limited to confidentiality.
Does this affect NLTK installations if all resource names are hardcoded in the application?
No, not directly. The vulnerability requires the resource name parameter to be influenced by untrusted input. If your application only calls `nltk.data.load()` with static, hardcoded resource names, you are not at risk. However, if any user input—even indirectly through a configuration file or API parameter—controls the resource name, you are vulnerable.
Is the percent-encoding bypass difficult to discover or exploit?
No. This is a straightforward encoding bypass. The technique is well-known in web security and would be discovered quickly by any attacker fuzzing the endpoint. Exploit development requires minimal skill.
What is the relationship between this CVE and GitHub Issue #3504?
GitHub Issue #3504 prompted an earlier fix to the path traversal validation in NLTK. However, that fix only addressed literal `../` sequences and did not account for percent-encoded variants. This CVE documents the incomplete nature of that earlier patch.
This analysis is provided for informational and defensive security purposes only. The information herein reflects the state of the vulnerability as of the publication date. Vendors and security researchers may release updated information, patches, or corrections that supersede this analysis. Readers should verify all technical details, patch availability, and applicability to their environment against official vendor advisories before taking action. SEC.co makes no warranty regarding the completeness, accuracy, or timeliness of this information and shall not be liable for any damages arising from its use or misuse. Source: NVD (public-domain), retrieved 2026-08-08. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-54293HIGHNLTK Path Traversal via Encoded URL Separators (CVSS 7.5)
- CVE-2016-20076HIGHWordPress Simple-Backup 2.7.11 Unauthenticated File Access & Deletion Vulnerability
- CVE-2016-20081HIGHHB Audio Gallery Lite Path Traversal Vulnerability – Unauthenticated File Download
- CVE-2017-20248HIGHApptha Slider Gallery Path Traversal Vulnerability
- CVE-2017-20250HIGHMac Photo Gallery 3.0 Path Traversal File Download Vulnerability
- CVE-2018-25408HIGHOpen ISES Project Path Traversal Vulnerability (High Severity)
- CVE-2024-32729HIGHPath Traversal in QuantumCloud Conversational Forms for ChatBot (CVSS 7.5)
- CVE-2024-40646HIGHVertex Path Traversal Vulnerability – Remote File Access Risk