NLTK (Natural Language Toolkit) before version 3.9.3 contains an eval injection vulnerability in the nltk.collocations module that allows an… (CVE-2025-71408)
NLTK (Natural Language Toolkit) versions before 3.9.3 contain an eval injection vulnerability in the nltk.collocations module. This vulnerability allows an attacker who can control command-line arguments to execute arbitrary Python code. The issue arises because the __main__ block in collocations.py passes command-line arguments directly to eval() without validation or sanitization, enabling execution of arbitrary code including OS commands via the os module.
AI Analysis
Technical Summary
The vulnerability in NLTK before version 3.9.3 is an eval injection in the nltk.collocations module. When collocations.py is run directly, the __main__ block uses eval() on command-line arguments as suffixes of BigramAssocMeasures without any allowlist or sanitization. This allows an attacker controlling the command-line arguments to inject and execute arbitrary Python code, including operating system commands through the os module. This is classified as CWE-95 (Improper Control of Generation of Code).
Potential Impact
An attacker with the ability to supply command-line arguments to the vulnerable module can execute arbitrary Python code on the system. This can lead to full code execution, including running OS commands, potentially compromising the host environment. The vulnerability requires local or limited access (local vector) and low complexity to exploit, with no user interaction needed. It has a high impact on confidentiality, integrity, and availability.
Mitigation Recommendations
A fixed version is available starting from NLTK version 3.9.3. Users should upgrade to version 3.9.3 or later to remediate this vulnerability. No other mitigations are indicated. Patch status is not explicitly confirmed in the provided data, but the vulnerability is described as fixed in version 3.9.3, so upgrading to this version or later is recommended.
NLTK (Natural Language Toolkit) before version 3.9.3 contains an eval injection vulnerability in the nltk.collocations module that allows an… (CVE-2025-71408)
Description
NLTK (Natural Language Toolkit) versions before 3.9.3 contain an eval injection vulnerability in the nltk.collocations module. This vulnerability allows an attacker who can control command-line arguments to execute arbitrary Python code. The issue arises because the __main__ block in collocations.py passes command-line arguments directly to eval() without validation or sanitization, enabling execution of arbitrary code including OS commands via the os module.
CVSS v4.0
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability in NLTK before version 3.9.3 is an eval injection in the nltk.collocations module. When collocations.py is run directly, the __main__ block uses eval() on command-line arguments as suffixes of BigramAssocMeasures without any allowlist or sanitization. This allows an attacker controlling the command-line arguments to inject and execute arbitrary Python code, including operating system commands through the os module. This is classified as CWE-95 (Improper Control of Generation of Code).
Potential Impact
An attacker with the ability to supply command-line arguments to the vulnerable module can execute arbitrary Python code on the system. This can lead to full code execution, including running OS commands, potentially compromising the host environment. The vulnerability requires local or limited access (local vector) and low complexity to exploit, with no user interaction needed. It has a high impact on confidentiality, integrity, and availability.
Mitigation Recommendations
A fixed version is available starting from NLTK version 3.9.3. Users should upgrade to version 3.9.3 or later to remediate this vulnerability. No other mitigations are indicated. Patch status is not explicitly confirmed in the provided data, but the vulnerability is described as fixed in version 3.9.3, so upgrading to this version or later is recommended.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-848c-c2cx-j7qx
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2025-71408"]
- Ecosystems
- []
- Database Specific Severity
- HIGH
- Cvss Version
- 4.0
Threat ID: 6a6542169c2644c7f8087919
Added to database: 07/25/2026, 23:09:10 UTC
Last enriched: 07/25/2026, 23:48:07 UTC
Last updated: 07/26/2026, 03:44:05 UTC
Views: 4
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.