CVE-2025-71408: Nltk NLTK Vulnerable To Eval Injection Vulnerability
HIGHCVE-2025-71408 is a HIGH (CVSS 7.8) nltk vulnerable to eval injection vulnerability (CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')) affecting Nltk libraries in the PyPI ecosystem. The issue involves nltk vulnerable to eval injection via collocations cli arguments. Remediation is available by upgrading affected packages to version 3.9.3.
CVE-2025-71408 at a Glance
Security Impact
CVSS: 7.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2025-71408
To remediate this vulnerability, upgrade all affected Nltk dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install nltk>=3.9.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show nltk
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2025-71408, inspect your installed packages using pip:
pip show nltk
Analyze the terminal output to locate any version of Nltk in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.9.3), your application is affected.
Note: The pip show nltk command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection'), where the product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes code syntax before using the input in a dynamic evaluation call (e.g. "eval"). In Nltk, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-71408 Affected Nltk Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
nltk
|
PyPI |
< 3.9.3
|
3.9.3
|
References
Frequently Asked Questions
What is CVE-2025-71408?
Which Nltk versions are affected?
What version fixes CVE-2025-71408?
Is nltk affected?
What is the CVSS score of CVE-2025-71408?
What CWE is associated with CVE-2025-71408?
How can I check PyPI dependencies for CVE-2025-71408?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-848c-c2cx-j7qx",
"modified" : "2026-08-12T19:30:21Z",
"published" : "2026-07-25T00:31:47Z",
"aliases" : [ "CVE-2025-71408" ],
"summary" : "NLTK vulnerable to Eval Injection via collocations CLI arguments",
"details" : "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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "nltk"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.9.3"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-71408"
}, {
"type" : "WEB",
"url" : "https://github.com/nltk/nltk/pull/3465"
}, {
"type" : "WEB",
"url" : "https://github.com/nltk/nltk/commit/66f14096d952ec8f04934f515e027534bd4eb0ac"
}, {
"type" : "WEB",
"url" : "https://aydinnyunus.github.io/2026/06/07/command-injection-nltk-collocations-eval"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/nltk/nltk"
}, {
"type" : "WEB",
"url" : "https://github.com/nltk/nltk/releases/tag/3.9.3"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3657.yaml"
}, {
"type" : "WEB",
"url" : "https://www.vulncheck.com/advisories/nltk-eval-injection-via-collocations-py-command-line-arguments"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-95" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-08-12T19:30:21Z",
"nvd_published_at" : "2026-07-24T22:16:50Z"
}
}