CVE-2025-71408 Details
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.
A command injection vulnerability has been identified in the NLTK (Natural Language Toolkit) library, specifically in versions prior to 3.9.3. The issue arises from the use of 'eval()' in the 'nltk.collocations' module, where command-line arguments are passed directly to 'eval()' without proper validation or sanitization. This flaw allows an attacker to execute arbitrary Python code, including operating system commands, by supplying a crafted Python expression that escapes the intended attribute lookup.
Users can upgrade to NLTK version 3.10.0 or later, where this vulnerability has been patched.
Metrics
CVSS 4.0 Severity and Vector Strings:
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
CISA-ADP
Assessed Jul 27, 2026References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://aydinnyunus.github.io/2026/06/07/command-injection-nltk-collocations-eval/ | [email protected] | ExploitPress/Media CoverageThird Party Advisory |
| https://github.com/nltk/nltk/commit/66f14096d952ec8f04934f515e027534bd4eb0ac | [email protected] | Patch |
| https://github.com/nltk/nltk/pull/3465 | [email protected] | Issue TrackingPatch |
| https://github.com/nltk/nltk/releases/tag/3.9.3 | [email protected] | Release Notes |
| https://www.vulncheck.com/advisories/nltk-eval-injection-via-collocations-py-command-line-arguments | [email protected] | PatchThird Party Advisory |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-95 | Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection') | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| nltk nltk | < 3.9.3 |
CPE
Remediation
| |
Change History
3 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Aug 10, 2026 | Initial Analysis | [email protected] |
| Jul 27, 2026 | CVE Modified | CISA-ADP |
| Jul 24, 2026 | New CVE Received | [email protected] |