CVE-2025-71408: NLTK < 3.9.3 Eval Injection via collocations.py Command-Line Arguments
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.
Security readout for executives and security teams
Plain-English summary
NLTK versions before 3.9.3 can execute unintended Python code when collocations.py is run directly with attacker-controlled command-line arguments. Exploitation requires local command invocation or an application that passes untrusted input into that command. Successful abuse could compromise data and the host process.
Executive priority
Prioritize near-term remediation on systems where untrusted users, jobs, or services can influence command arguments. Other installations should enter the normal high-severity patch cycle after confirming usage. The local prerequisite reduces broad remote exposure, but successful exploitation could fully compromise the executing process and its accessible data.
Technical view
The collocations.py __main__ block passes command-line values to eval() as suffixes of BigramAssocMeasures. Without an allowlist or sanitization, a crafted expression can escape the intended attribute lookup and execute arbitrary Python code. The supplied CVSS 4.0 score is 8.5, with local access and low privileges required.
Likely exposure
Exposure is limited to systems running NLTK before 3.9.3 where collocations.py is invoked directly and an attacker can influence its command-line arguments. Merely importing or using unrelated NLTK functionality is not shown to be vulnerable by the supplied evidence. Automation and wrappers should be reviewed for argument provenance.
Exploitation context
A public researcher disclosure and advisory exist, but the bundle does not establish active exploitation and the CVE is not listed as KEV. The attack vector is local, requires low privileges, needs no user interaction, and may cause high confidentiality, integrity, and availability impact.
Researcher notes
The supplied affected-product entry says “ntlk” version “0,” which conflicts with the narrative and patch references identifying NLTK before 3.9.3. Treat that structured entry as unreliable and validate the actual Python package. The patch commit and pull request support a code-level fix; the bundle provides no evidence of exploitation in the wild.
Mitigation direction
Upgrade NLTK to version 3.9.3 or later, following the official release guidance.
Prevent untrusted input from reaching collocations.py command-line arguments.
Avoid invoking collocations.py directly until affected environments are upgraded.
Apply least privilege to processes and automation that execute NLTK utilities.
Validation and detection
Inventory installed NLTK versions and identify every instance below 3.9.3.
Search application code and automation for direct execution of collocations.py.
Trace whether external or lower-trust input can influence its command-line arguments.
Confirm upgraded environments report NLTK 3.9.3 or later.
Review process and audit logs for unexpected direct collocations.py invocations.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · medium confidence lookup
CWE-95: Code execution behavior lookup
Code execution and unsafe deserialization weaknesses often justify reviewing execution behavior and process telemetry. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
The CVE wording references code or command execution, so execution technique review may help defensive triage. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
2CVSS vectors
3Timeline events
1ADP providers
6Source links
SSVC decision data
CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: pocAutomatable: noTechnical Impact: total
CVSS vector scores
2 official scores
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-95 · source CWE mapping
Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')
Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection') represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.