CVE-2025-71408
Received Received - Intake

Eval Injection in NLTK Prior to 3.9.3

Vulnerability report for CVE-2025-71408, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-07-24

Last updated on: 2026-07-24

Assigner: VulnCheck

Description

NLTK (Natural Language Toolkit) before version 3.9.3 contains an eval injection vulnerability in the nltk.collocations module that allows an attacker who controls command-line arguments to execute arbitrary Python code. When collocations.py is invoked directly, the __main__ block passes command-line arguments directly to eval() as suffixes of BigramAssocMeasures without allowlist validation or sanitization, enabling an attacker to supply a Python expression that escapes the intended attribute lookup and executes arbitrary code including OS commands via the os module.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-07-24
Last Modified
2026-07-24
Generated
2026-07-25
AI Q&A
2026-07-25
EPSS Evaluated
N/A
NVD
EUVD

Affected Vendors & Products

Showing 1 associated CPE
Vendor Product Version / Range
nltk natural_language_toolkit to 3.9.3 (exc)

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-95 The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes code syntax before using the input in a dynamic evaluation call (e.g. "eval").

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

This vulnerability is an eval injection flaw in NLTK before version 3.9.3. When the collocations.py module is run directly, command-line arguments are passed unsafely to eval() in the BigramAssocMeasures class. This allows attackers who control these arguments to execute arbitrary Python code, including OS commands via the os module.

Detection Guidance

To detect this vulnerability, check if NLTK versions before 3.9.3 are installed. Run: pip show nltk. If the version is less than 3.9.3, the system is vulnerable. Additionally, inspect Python scripts using nltk.collocations module for direct invocations that pass user-controlled input to eval().

Impact Analysis

An attacker could exploit this to run malicious code on your system if they can control command-line arguments when collocations.py is executed. This could lead to unauthorized data access, system compromise, or further network attacks depending on the attacker's goals.

Compliance Impact

This vulnerability could lead to unauthorized data access or system compromise, violating GDPR's data protection requirements and HIPAA's security rules for protected health information. Organizations using affected NLTK versions may face compliance violations and potential penalties.

Mitigation Strategies

Immediately upgrade NLTK to version 3.9.3 or later to patch the eval injection vulnerability in the nltk.collocations module.

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2025-71408. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart