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.
CVE-2025-71408
Primary source · Revision 1
Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.
Security context
Source reference: cve:CVE-2025-71408
ntlk
Source reference: /containers/cna/affected/0/product
- Affected versions
- Not stated in this record
- Fixed versions
- Not stated in this record
- Prerequisites
- Not stated in this record
Structured affected-version data
Original package identities and version rules from this source.
[
{
"repo": "https://github.com/nltk/nltk",
"vendor": "ntlk",
"product": "ntlk",
"versions": [
{
"status": "affected",
"version": "0",
"lessThan": "3.9.3",
"versionType": "semver"
}
],
"packageURL": "pkg:pypi/nltk",
"defaultStatus": "affected"
}
]- Related CVEs
- CVE-2025-71408
Source reference:
/cveMetadata/cveId
Publisher severity
high
Source reference: /containers/cna/metrics
- Event
- #12645 · Revision 1
- Added to Heist Feed
- Publisher date