Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. nltk
  4. ›
  5. CVE-2026-12259

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

September 8, 2026 (updated October 27, 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)

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

PoC:

import nltk
import unittest.mock
import zipfile
import io
import os

References

  • github.com/advisories/GHSA-5wp5-5229-5g6q
  • github.com/nltk/nltk/commit/0e26734a61094b628d93e26dc18dd7302567ac46
  • github.com/nltk/nltk/pull/3449
  • github.com/nltk/nltk/releases/tag/3.9.3
  • github.com/nltk/nltk/security/advisories/GHSA-5wp5-5229-5g6q
  • github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3729.yaml
  • huntr.com/bounties/659ccf6d-12d4-4d4a-84c0-078633c35a5d
  • nvd.nist.gov/vuln/detail/CVE-2026-12259
  • www.vulncheck.com/advisories/nltk-before-missing-post-download-integrity-verification

Code Behaviors & Features

Detect and mitigate CVE-2026-12259 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions before 3.9.3

Fixed versions

  • 3.9.3

Solution

Upgrade to version 3.9.3 or above.

Impact 5.3 MEDIUM

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

Learn more about CVSS

Weakness

  • CWE-494: Download of Code Without Integrity Check

Source file

pypi/nltk/CVE-2026-12259.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:17:25 +0000.