Skip to content
NLTKGHSA-848c-c2cx-j7qx

NLTK vulnerable to Eval Injection via collocations CLI arguments

High7.8CVE-2025-71408 · Published Jul 25, 2026 · updated Aug 12, 2026

GitHub advisory

Affected versions

PackageAffectedFixed in
nltk
PyPI
< 3.9.33.9.3
Details and references

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.

CVSS 3.1
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Severity from
GitHub (reviewed advisory)
Weakness
CWE-95
Also known as
CVE-2025-71408, PYSEC-2026-3657

More NLTK advisories

All NLTK

Critical advisories by email

Wednesdays: the week’s critical and high advisories in the AI and data stack, with the fixed versions. Only in weeks that have some.

Double opt-in. Unsubscribe any time.