CVE-2026-70626: NLTK: symlink escape allows arbitrary file read
GHSA-r6gq-whwq-mvg9 MEDIUM PoC AVAILABLE CISA: TRACK*NLTK's CorpusReader.open() blocks absolute paths and '..' traversal, but never resolves symlinks before checking that a requested file stays inside the configured corpus root, so a symlink planted inside an otherwise-trusted directory lets an attacker read any file the application process can access. This matters because NLTK sits in 2,897 downstream dependents, and any pipeline that treats a corpus or dataset directory as a trust boundary — extracted archives, user-uploaded datasets, shared training data folders — inherits the bypass. There is no CISA KEV listing, no public exploit or Nuclei template, and EPSS sits at 0.2% (bottom of the exploitation-likelihood range), so this is not an active-exploitation emergency; it is a quiet but real sandbox-escape bug (CVSS 6.2, CWE-59). Patch to nltk >= 3.9.4 on your next maintenance window, and until then avoid loading corpus/data directories built from untrusted or attacker-influenced archives, since a single symlink dropped during extraction is enough to trigger the read. Detection-wise, flag symlinks appearing inside corpus/data directories at ingestion time and monitor for unexpected reads of files like /etc/hostname or /proc/self/environ by processes that only should be touching NLTK corpora.
What is the risk?
Medium severity (CVSS 6.2, local attack vector, no privileges or user interaction required, high confidentiality impact only). Exploitability is low-to-moderate in practice: the attacker needs some ability to place a file (a symlink) inside a directory the target application later treats as an NLTK corpus root — typically via dataset upload, archive extraction, or shared storage rather than remote network access. EPSS (0.2%, bottom decile) and the absence of a KEV listing or public PoC/scanner template both indicate this is not being actively exploited or mass-scanned today. The realistic risk driver is scale: NLTK's broad footprint (2,897 dependents) means many applications may unknowingly rely on CorpusReader as a filesystem trust boundary, making this a supply-chain-adjacent exposure rather than a directly internet-exploitable one.
How does the attack unfold?
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| HF Datasets | pip | <= 3.9.3 | 3.9.4 |
Do you use HF Datasets? You're affected.
How severe is it?
What is the attack surface?
What should I do?
1 step-
Upgrade to nltk >= 3.9.4, which resolves the symlink-before-boundary-check issue (fixed via PR #3522 / GHSA-r6gq-whwq-mvg9). Until patched, do not point CorpusReader/nltk.data at directories built from untrusted archives, user uploads, or any location where an attacker could have planted a symlink (e.g., dataset zips extracted without sanitization). Where corpora are built from external sources, extract archives with a tool that strips or rejects symlinks, and run corpus-consuming processes with least-privilege filesystem access (containerized, read-only mounts limited to the actual corpus data) so a successful escape has minimal blast radius. For detection, add a periodic or ingestion-time scan for symlinks inside configured corpus roots, and alert on file reads outside the expected corpus directory tree if your environment supports filesystem auditing (auditd/eBPF).
What does CISA's SSVC say?
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2026-70626?
NLTK's CorpusReader.open() blocks absolute paths and '..' traversal, but never resolves symlinks before checking that a requested file stays inside the configured corpus root, so a symlink planted inside an otherwise-trusted directory lets an attacker read any file the application process can access. This matters because NLTK sits in 2,897 downstream dependents, and any pipeline that treats a corpus or dataset directory as a trust boundary — extracted archives, user-uploaded datasets, shared training data folders — inherits the bypass. There is no CISA KEV listing, no public exploit or Nuclei template, and EPSS sits at 0.2% (bottom of the exploitation-likelihood range), so this is not an active-exploitation emergency; it is a quiet but real sandbox-escape bug (CVSS 6.2, CWE-59). Patch to nltk >= 3.9.4 on your next maintenance window, and until then avoid loading corpus/data directories built from untrusted or attacker-influenced archives, since a single symlink dropped during extraction is enough to trigger the read. Detection-wise, flag symlinks appearing inside corpus/data directories at ingestion time and monitor for unexpected reads of files like /etc/hostname or /proc/self/environ by processes that only should be touching NLTK corpora.
Is CVE-2026-70626 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2026-70626, increasing the risk of exploitation.
How to fix CVE-2026-70626?
Upgrade to nltk >= 3.9.4, which resolves the symlink-before-boundary-check issue (fixed via PR #3522 / GHSA-r6gq-whwq-mvg9). Until patched, do not point CorpusReader/nltk.data at directories built from untrusted archives, user uploads, or any location where an attacker could have planted a symlink (e.g., dataset zips extracted without sanitization). Where corpora are built from external sources, extract archives with a tool that strips or rejects symlinks, and run corpus-consuming processes with least-privilege filesystem access (containerized, read-only mounts limited to the actual corpus data) so a successful escape has minimal blast radius. For detection, add a periodic or ingestion-time scan for symlinks inside configured corpus roots, and alert on file reads outside the expected corpus directory tree if your environment supports filesystem auditing (auditd/eBPF).
What systems are affected by CVE-2026-70626?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, data pipelines, RAG pipelines.
What is the CVSS score for CVE-2026-70626?
CVE-2026-70626 has a CVSS v3.1 base score of 6.2 (MEDIUM). The EPSS exploitation probability is 0.21%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.002 Data AML.T0025 Exfiltration via Cyber Means AML.T0037 Data from Local System Compliance Controls Affected
What are the technical details?
Original Advisory
### Summary `nltk.corpus.reader.api.CorpusReader.open()` can be used to read files outside the intended corpus root via a symlink placed inside that root. Although NLTK blocks absolute paths and `..` traversal, the current boundary check is only lexical and does not account for symlink resolution. This leads to an arbitrary local file read / filesystem sandbox bypass for applications that rely on `CorpusReader` or `FileSystemPathPointer` to restrict file access. ### Details The vulnerable flow is: - [`nltk/corpus/reader/api.py:222`](/mnt/Data/my_brains/test/nltk/nltk/corpus/reader/api.py#L222) - `CorpusReader.open()` blocks absolute paths and `..`, then calls `self._root.join(file).open()` - [`nltk/data.py:398`](/mnt/Data/my_brains/test/nltk/nltk/data.py#L398) - `FileSystemPathPointer.join()` joins the requested file ID and checks whether the resulting path still appears to remain under the configured root The problem is that the check is based on the lexical path after `os.path.normpath()`, not on the resolved path after following symlinks. Current behavior: 1. `CorpusReader.open()` rejects: - absolute paths - `..` path traversal 2. `FileSystemPathPointer.join()` computes: - `joined = os.path.normpath(os.path.join(self._path, fileid))` - `root = os.path.normpath(self._path)` 3. It allows the access if `joined` starts with `root` This misses the case where a path stays inside the root lexically, but resolves outside the root via a symlink already present under the allowed directory. Example: ```text JOINED=/tmp/nltk-root/link/secret.txt REALPATH=/tmp/outside/secret.txt ``` `JOINED` still appears to be inside the root, but `REALPATH` is outside it. This is distinct from simple `../` traversal: - the file ID is not absolute - the file ID does not contain `..` - the escape only happens after filesystem resolution of a symlink under the allowed root ### PoC Reproduced in an isolated Docker sandbox using the local `nltk` clone. Minimal Python PoC: ```python import os import tempfile from nltk.corpus.reader.api import CorpusReader root = tempfile.mkdtemp(prefix="nltk-root-") outside_dir = tempfile.mkdtemp(prefix="nltk-out-") outside_file = os.path.join(outside_dir, "secret.txt") with open(outside_file, "w") as f: f.write("secret-data") os.symlink(outside_dir, os.path.join(root, "link")) corpus = CorpusReader(root, ["link/secret.txt"]) with corpus.open("link/secret.txt") as f: print(f.read()) ``` Observed result: ```text secret-data ``` Docker re-test output: ```text ROOT=/tmp/nltk-root-jjxay3if OUTSIDE_DIR=/tmp/nltk-out-1kef36e0 JOINED=/tmp/nltk-root-jjxay3if/link/secret.txt REALPATH=/tmp/nltk-out-1kef36e0/secret.txt READ_OK=secret-data INSIDE_ROOT=True REAL_INSIDE_ROOT=False ``` Additional impact validation using a system file: ```text ROOT=/tmp/nltk-root-_h5x4m19 JOINED=/tmp/nltk-root-_h5x4m19/hostfile REALPATH=/etc/hostname HOSTNAME_READ=48dafb244af3 INSIDE_ROOT=True REAL_INSIDE_ROOT=False ``` This shows that the issue is not limited to attacker-created files outside the root; it can also read existing system files that are readable by the application user. ### Impact This is an arbitrary local file read / symlink escape issue. Who is impacted: - applications that accept attacker-controlled corpus directories, extracted datasets, or package contents - applications that rely on NLTK corpus readers as a trust boundary for file access - any deployment where an attacker can place or influence files inside the allowed corpus root Practical impact includes disclosure of: - application secrets stored on disk - local configuration files - private datasets - process-exposed files such as `/proc/self/environ` - system files readable by the running user The issue is best described as a filesystem sandbox bypass caused by improper link resolution before file access.
Exploitation Scenario
An application lets users upload a custom NLP corpus or dataset archive for training or search indexing, which the backend extracts into a directory later passed to NLTK's CorpusReader. The attacker crafts the archive so that, on extraction, it creates a symlink inside the corpus root pointing to an absolute path outside it (e.g., '/etc' or the application's config directory). The application later calls corpus.open('link/secret.txt') as part of normal processing; NLTK's lexical boundary check sees a path that still 'looks' inside the root and allows it, but the OS resolves the symlink and returns the contents of the attacker-chosen target file — exposing API keys, database credentials, or other tenants' data to the attacker via whatever channel echoes the corpus content back (search results, processed output, error messages, logs).
Weaknesses (CWE)
CWE-59 — Improper Link Resolution Before File Access ('Link Following'): The product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource.
- [Architecture and Design] Follow the principle of least privilege when assigning access rights to entities in a software system. Denying access to a file can prevent an attacker from replacing that file with a link to a sensitive file. Ensure good compartmentalization in the system to provide protected areas that can be trusted.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N References
- github.com/advisories/GHSA-r6gq-whwq-mvg9
- github.com/nltk/nltk/commit/1b0e519e2324bc1a273d56edee63e44d0ad85b48
- github.com/nltk/nltk/pull/3522
- github.com/nltk/nltk/releases/tag/3.9.4
- github.com/nltk/nltk/security/advisories/GHSA-r6gq-whwq-mvg9
- github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3732.yaml
- nvd.nist.gov/vuln/detail/CVE-2026-70626
- vulncheck.com/advisories/nltk-before-symlink-escape-via-corpusreader
Timeline
Related Vulnerabilities
CVE-2026-61667 9.9 DIRAC: SQLi chained into eval() gives RCE
Same package: datasets CVE-2026-50027 9.8 mcp-memory-service: auth bypass on document API
Same package: datasets CVE-2026-71851 9.0 crypto-js: weak PRNG enables wallet key recovery
Same package: datasets CVE-2026-55178 7.5 GeoLens: IDOR leaks private datasets via AI metadata API
Same package: datasets CVE-2026-65010 6.6 Datasets: symlink following enables arbitrary file write
Same package: datasets