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
Affects nltkSource GCVE Database
Not known to be exploited · CVSS 7.8 High.
Data as of 24 Nov 2026, 21:15 UTC
- EPSS
- 0.2% chance of exploitation in 30 days – higher than 18% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:HExploitation evidence
Disclosed: evidence found.
CVE published 24 Jul 2026
Detectable: no evidence on record.
No public nuclei template indexed
Weaponized: no evidence on record.
No public exploit code indexed in Metasploit or Exploit-DB
Exploited in the wildExploited: no evidence on record.
Not in CISA KEV and no source reports exploitation
Observed by OffSeq MirageSeen by Mirage: no evidence on record.
No attack traffic recorded by OffSeq Mirage sensors
A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 24 Nov 2026.
What to do
Affected software
| Product | Affected | Fixed in |
|---|---|---|
Ubuntu Pro 26.04 LTSnltkpkg:deb/ubuntu/nltk?arch=source&distro=esm-apps/resoluteOther threats | Affected
| Fixed in– |
Ubuntu Pro 24.04 LTSnltkpkg:deb/ubuntu/nltk?arch=source&distro=esm-apps/nobleOther threats | Affected
| Fixed in– |
Ubuntu Pro 22.04 LTSnltkpkg:deb/ubuntu/nltk?arch=source&distro=esm-apps/jammyOther threats | Affected
| Fixed in– |
Ubuntu Pro 20.04 LTSnltkpkg:deb/ubuntu/nltk?arch=source&distro=esm-apps/focalOther threats | Affected
| Fixed in– |
Ubuntu Pro 18.04 LTSnltkpkg:deb/ubuntu/nltk?arch=source&distro=esm-apps/bionicOther threats | Affected
| Fixed in– |
Ubuntu Pro 16.04 LTSnltkpkg:deb/ubuntu/nltk?arch=source&distro=esm-apps-legacy/xenialOther threats | Affected
| Fixed in– |
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
Description
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.
References
- ubuntu.com/security/CVE-2025-71408 (opens in a new tab)
- cve.org/CVERecord?id=CVE-2025-71408 (opens in a new tab)
- aydinnyunus.github.io/2026/06/07/command-injection-nltk-collocations-eval/ (opens in a new tab)
- github.com/nltk/nltk/pull/3465 (opens in a new tab)
- github.com/nltk/nltk/commit/66f14096d952ec8f04934f515e027534bd4eb0ac (opens in a new tab)
- github.com/nltk/nltk/releases/tag/3.9.3 (opens in a new tab)
- vulncheck.com/advisories/nltk-eval-injection-via-collocations-py-command-line-arguments (opens in a new tab)