KEVWire

Security intelligence, with context.

Response snapshot Oct 27, 2026, 13:06 UTC

Back to the wire
Permalink
VulnerabilityCVE-2026-12259

NLTK: Missing Post-Download Integrity Verification Allows Malicious Package Injection

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: 1. File is downloaded to a temp path via HTTP 2. os.replace(tmp_filepath, filepath) moves it to the final location (line 799) 3.

At a glance

Exploited
Not known
Severity
5.3 Medium (CVSS 3.1)
Chance of exploitation
Not estimated
Sources
1 source

What to do

GitHub lists first patched versions: nltk: 3.9.3. Confirm the affected range and upgrade guidance in the exact advisory.

Read GitHub-reviewed advisory GHSA-5wp5-5229-5g6q (opens a new tab)

What happened

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: 1. File is downloaded to a temp path via HTTP 2. os.replace(tmp_filepath, filepath) moves it to the final location (line 799) 3. 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: 1. MITM during HTTP download (NLTK downloads from http:// by default on some mirrors) 2. Race condition on shared filesystems (attacker replaces file between os.replace and _unzip_iter) 3. DNS poisoning redirecting to attacker-controlled server

Continue reading

PoC: ```python 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 package ranges reported by GitHub: nltk: <= 3.9.2

Scores and how they were measured

CVSS base severity

5.3

Version 3.1As of

CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N

Measurement source (opens a new tab)

How bad it is if exploited. Not a prediction of exploitation or proof you are exposed.

EPSS probability

Not available

A model's estimate of exploitation in the next 30 days, not certainty or your own risk.

Related technology

Sources

  1. Primary source

    GitHub-reviewed advisory GHSA-5wp5-5229-5g6q (opens a new tab)

    The public advisory supplies the description, affected package/version ranges, and any listed CVSS metric. GitHub review is not local review.

    Published Checked

  2. Primary source

    GitHub public advisory API page (opens a new tab)

    The API page supplied GHSA-5wp5-5229-5g6q, its actual identifiers, source dates, and structured metrics.

    Published Date not suppliedChecked

Cite this record

For factual claims, cite the primary sources above; cite KEVWire for its compilation, dates, and classifications.

APA

KEVWire. (2026, October 27). NLTK: Missing Post-Download Integrity Verification Allows Malicious Package Injection (CVE-2026-12259). https://kevwire.com/record/CVE-2026-12259

MLA

"NLTK: Missing Post-Download Integrity Verification Allows Malicious Package Injection (CVE-2026-12259)." KEVWire, 27 Oct. 2026, kevwire.com/record/CVE-2026-12259.

Chicago

KEVWire. "NLTK: Missing Post-Download Integrity Verification Allows Malicious Package Injection (CVE-2026-12259)." Last modified October 27, 2026. https://kevwire.com/record/CVE-2026-12259.

Evidence summary (plain text)

NLTK: Missing Post-Download Integrity Verification Allows Malicious Package Injection (Sep 8, 2026).
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:
1. File is downloaded to a temp path via HTTP
2. os.replace(tmp_filepath, filepath) moves it to the final location (line 799)
3. Extraction begins via _unzip_iter() (line 825)
CVSS 5.3 (version 3.1; evidence as of Oct 27, 2026; https://github.com/advisories/GHSA-5wp5-5229-5g6q).
Sources:
GitHub-reviewed advisory GHSA-5wp5-5229-5g6q: https://github.com/advisories/GHSA-5wp5-5229-5g6q
GitHub public advisory API page: https://api.github.com/advisories?type=reviewed&per_page=100&sort=updated&direction=desc
Record ID: CVE-2026-12259.
Record origin: Ingested record.
AI evidence: Not assessed.
Known exploitation: Not assessed.
Zero-day status: Not assessed. KEV membership alone does not establish zero-day status.
About this data

This record was ingested from a data source. Retrieved: Oct 27, 2026, 11:45 UTC. Ingestion is not an independent editorial investigation.

A CISA KEV listing documents known exploitation, not necessarily a zero-day; absence from the catalog does not prove a vulnerability has never been exploited.

Technology tags indicate possible relevance, not verified exposure. Confirm the affected product, version, and configuration against your own inventory; KEVWire does not scan your systems.

A personal reading checklist on this device, not verified remediation.

Record JSON

Your account

Email alerts

Email alerts are not available yet. To follow your stack today, use its RSS feed, which honors your filters, or connect an AI agent through the API.

Suggest an improvement

Ideas, missing sources, corrections, and bugs are all welcome. No account needed. Suggestions are reviewed by a person before anything changes.

Record details

Record detail