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 ar…
Summary
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 l…
In-depth triage · Auto channel
No in-depth report has been generated yet (DR-003 v2 AI pipeline is under construction).
Affected products
- :
Lint boundary warnings (1)
The following non-blocking warnings were raised during the lint phase of this triage (e.g. reference URLs not yet on the allowlist). They do not affect entry usability and are disclosed for transparency (see DR-002).
-
REF_URL_NOT_ALLOWLISTEDurl not in allowlist: https://aydinnyunus.github.io/2026/06/07/command-injection-nltk-collocations-eval/
Sources
- NVD DATABASE
Original Links
- https://aydinnyunus.github.io/2026/06/07/command-injection-nltk-collocations-eval/ Exploit
- https://github.com/nltk/nltk/commit/66f14096d952ec8f04934f515e027534bd4eb0ac Patch
- https://github.com/nltk/nltk/pull/3465 Issue Tracking
- https://github.com/nltk/nltk/releases/tag/3.9.3 Release Notes
- https://www.vulncheck.com/advisories/nltk-eval-injection-via-collocations-py-command-line-arguments Patch
Timeline
- nvd_ingest NVD