CVE-2024-39705
Python vulnerability analysis and mitigation

Overview

NLTK (Natural Language Toolkit) through version 3.8.1 contains a critical remote code execution vulnerability when using the integrated data package download functionality. The vulnerability affects situations where untrusted packages contain pickled Python code, specifically impacting packages such as 'averaged_perceptron_tagger' and 'punkt'. This security issue was initially discovered and reported on May 19, 2024, and was subsequently assigned CVE-2024-39705 (GitHub Issue).

Technical details

The vulnerability stems from NLTK's use of Python's pickle module for deserializing data packages. When downloading and using certain NLTK data packages that contain pickled Python code, the application automatically deserializes this content without proper validation. This process can lead to arbitrary code execution if the package source is compromised. The vulnerability has received a CVSS v3.1 base score of 9.8 (CRITICAL), with a vector string of CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H, indicating its severe nature (NVD).

Impact

The vulnerability allows a man-in-the-middle attacker or an attacker with control over the NLTK data index to force users to download malicious versions of data packages. When these packages are unpickled during normal NLTK operations, they can execute arbitrary code on the target system. This affects any code that downloads and uses vulnerable data packages such as 'averaged_perceptron_tagger' and 'punkt' (GitHub Issue).

Exploitability

The vulnerability is easily exploitable through common NLTK usage patterns. A simple code example that triggers the vulnerability involves downloading and using the affected packages: import nltk; nltk.download("averaged_perceptron_tagger"); nltk.pos_tag(["hello", "world"]). The issue was previously identified in 2020 as a security concern regarding pickle usage, but remained unaddressed (GitHub Issue).

Mitigation and workarounds

Users should upgrade to versions newer than 3.8.1 when available. Until then, users should exercise caution when downloading NLTK data packages, especially in environments where the download source could be compromised. Organizations should consider implementing network security controls to ensure the integrity of downloaded NLTK packages (NVD).

Additional resources

Linux Distribution fix status

Fix availability across major Linux distributions and their releases.

Debian

Fixed

bookworm

nltk

Affected

bullseye

nltk

Affected

sid

nltk: 3.9.1-1

Fixed

trixie

nltk: 3.9.1-1

Fixed

SourceThis report was generated using AI

Related Python vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2025-66455CRITICAL9.8
  • Python logoPython
  • lmdeploy
NoYesSep 18, 2026
CVE-2026-63374CRITICAL9.3
  • Python logoPython
  • airflow-3
NoYesSep 18, 2026
CVE-2026-59163CRITICAL9.1
  • Python logoPython
  • mnemosyne-memory
NoYesSep 18, 2026
CVE-2026-33625HIGH8.8
  • Python logoPython
  • lmdeploy
NoYesSep 18, 2026
CVE-2026-64847MEDIUM6.8
  • Python logoPython
  • py3-anyio
NoYesSep 18, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management