CVE-2026-12259 — Vulnerability in nltk — CVE Details
NLTK: Missing Post-Download Integrity Verification Allows Malicious Package Injection
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.15%). Schedule for your next planned update.
Does your project use an affected nltk version?
Paste your requirements.txt to check it for CVE-2026-12259 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
NLTK's package downloader in nltk/downloader.py does not verify file integrity after download and before extraction.
The download flow at lines 789-825:
- File is downloaded to a temp path via HTTP
- os.replace(tmp_filepath, filepath) moves it to the final location (line 799)
- Extraction begins via _unzip_iter() (line 825)
Between steps 2 and 3, there is no SHA-256 verification. The checksum logic exists in _pkg_status() (lines 982-1015) but it is only used BEFORE download as a status check ("is this package already installed and up-to-date?"). It is never called after download to verify the file that was actually received.
Attack vectors:
- MITM during HTTP download (NLTK downloads from http:// by default on some mirrors)
- Race condition on shared filesystems (attacker replaces file between os.replace and _unzip_iter)
- DNS poisoning redirecting to attacker-controlled server
PoC:
import nltk
import unittest.mock
import zipfile
import io
import os
# Create a malicious zip that will be "downloaded"
malicious_zip = io.BytesIO()
with zipfile.ZipFile(malicious_zip, 'w') as zf:
zf.writestr('punkt_tab/tokenizers/punkt_tab/english.pickle',
b'MALICIOUS PAYLOAD - attacker controlled content')
# Patch urllib to return our malicious zip
with unittest.mock.patch('urllib.request.urlopen') as mock_urlopen:
mock_response = unittest.mock.MagicMock()
mock_response.read.return_value = malicious_zip.getvalue()
mock_response.headers = {'Content-Length': str(len(malicious_zip.getvalue()))}
mock_urlopen.return_value = mock_response
# Download proceeds, no integrity check catches the swap
# nltk.download('punkt_tab') # Would install attacker payload
This is distinct from CVE-2024-39705 (pickle deserialization via download) and CVE-2025-14009 (zip-slip path traversal). Those address what happens AFTER extraction. This finding addresses the gap BEFORE extraction where integrity is never verified.
Suggested fix: After os.replace() and before _unzip_iter(), compute SHA-256 of the final file and compare against the expected checksum from the package index. Reject and delete the file if the hash does not match.
Advisory Timeline
- First published September 8, 2026 (79 days ago).
- Last revised October 16, 2026 — 38 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
pip install "nltk>=3.9.3"
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: PyPI (1).
| Package | Fixed In |
|---|---|
| nltk PyPI · Affected: 0.8, 0.9, 0.9.3, 0.9.4 (+59 more) | 3.9.3 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-494
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 5.3 score means for each attack dimension.
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N
References
- https://github.com/nltk/nltk/security/advisories/GHSA-5wp5-5229-5g6qWEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-12259ADVISORY
- https://github.com/nltk/nltk/pull/3449WEB
- https://github.com/nltk/nltk/commit/0e26734a61094b628d93e26dc18dd7302567ac46WEB
- https://github.com/nltk/nltkPACKAGE
- https://github.com/nltk/nltk/releases/tag/3.9.3WEB
- https://github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3729.yamlWEB
- https://huntr.com/bounties/659ccf6d-12d4-4d4a-84c0-078633c35a5dWEB
- https://www.vulncheck.com/advisories/nltk-before-missing-post-download-integrity-verificationWEB
Frequently Asked Questions
- What is CVE-2026-12259?
- NLTK: Missing Post-Download Integrity Verification Allows Malicious Package Injection. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 5.3/10).
- How do I check if my project is affected by CVE-2026-12259?
- CVE-2026-12259 affects nltk. It has a 0.1% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-12259 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Exploitation requires specific conditions, or the impact is limited.
This is a below-median EPSS score — only 2% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2025-14009CRITICAL
NLTK has a Zip Slip Vulnerability
- CVE-2026-62388HIGH
- CVE-2026-63311HIGH
- CVE-2026-66393HIGH
- CVE-2026-128134HIGH
NLTK dot2img runs Graphviz 'dot' without the trusted-exec chokepoint, enabling local code execution via a writable PATH element
- CVE-2026-79676HIGH
NLTK: Corpus readers follow symlinks outside trusted roots despite pathsec enforcement
- CVE-2026-65915MEDIUM
NLTK: FileSystemPathPointer.open() sandbox check is dead code — arbitrary file read via file:// protocol
- CVE-2026-128140MEDIUM
NLTK: Downloader cyclic collection indices cause an infinite closure walk