CVE-2025-71408
nltk: NLTK: Arbitrary Code Execution via Eval Injection in Collocations Module
Overview
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.
Source: OX vulnerability database
Severity
7.8 · HIGH
CVSS 3.1 base score, scored by NVD.
- Attack vector
- Local
- Attack complexity
- Low
- Privileges required
- Low
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Weakness: CWE-95
Affected packages · 1
| Ecosystem | Package | Vulnerable | Fixed in |
|---|---|---|---|
| PyPI | nltk | <3.9.3 | 3.9.3 |
Open a package to see all its vulnerabilities.
Operating systems · 5 fixes
debian 4 releases · 1 package
| Release | Package | Fixed in |
|---|---|---|
| 11 | nltk | affected |
| 12 | nltk | affected |
| 13 | nltk | affected |
| 14 | nltk | 3.9.3-1 |
echo 1 release · 1 package
| Release | Package | Fixed in |
|---|---|---|
| nltk | affected |
References
- access.redhat.com https://access.redhat.com/security/cve/CVE-2025-71408
- aydinnyunus.github.io https://aydinnyunus.github.io/2026/06/07/command-injection-nltk-collocations-eval
- aydinnyunus.github.io https://aydinnyunus.github.io/2026/06/07/command-injection-nltk-collocations-eval/
- github.com https://github.com/nltk/nltk
- github.com https://github.com/nltk/nltk/commit/66f14096d952ec8f04934f515e027534bd4eb0ac
- github.com https://github.com/nltk/nltk/pull/3465
- github.com https://github.com/nltk/nltk/releases/tag/3.9.3
- github.com https://github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3657.yaml
- nvd.nist.gov https://nvd.nist.gov/vuln/detail/CVE-2025-71408
- www.cve.org https://www.cve.org/CVERecord?id=CVE-2025-71408
OX Radar and Response Center
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.