CVE-2026-12259 is a medium-severity (CVSS 5.3) CWE-494 vulnerability in nltk. A fix is available for nltk — see the affected versions and patch details below.
Improper Input Validation in nltk/nltk
Exploitation Status
No confirmed exploitation observed yet
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for CVE-2026-12259.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
CVE-2026-12259 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 395,249 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
nltkReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
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.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | nltk | all versions | 3.9.3pip install --upgrade 'nltk==3.9.3' |
Affected Products
nltknltkDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for nltk, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update nltk to 3.9.3 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-12259 is resolved across your whole dependency graph.
Workarounds
Do not deserialise data from untrusted sources: where the format allows it, restrict deserialisation to an explicit allowlist of expected types, and prefer a data-only format (JSON, Protobuf) over one that can reconstruct arbitrary objects until you can upgrade.
Frequently Asked Questions
Is CVE-2026-12259 in your dependencies?
Find it across PyPI, including transitive dependencies.