NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · PyPI

CVE-2025-71408: NLTK vulnerable to Eval Injection via collocations CLI arguments

highCVSS 4.0 8.5 · 3.1 7.8GHSA-848c-c2cx-j7qx

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.

Published Jul 25, 2026 · Updated Aug 12, 2026

Affected packages

nltk

Ecosystem
PyPI
Affected
< 3.9.3
Fixed in
3.9.3
Check
pip show nltk

Advisory details

From the GitHub Advisory Database (CC BY 4.0).

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.

Credited to PercevalFox.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology

More PyPI vulnerabilities

All PyPI entries