Skip to content
OpenAdvisories
High · 7.8 CVE-2025-71408 EUVD-2025-210509GHSA-848c-c2cx-j7qxPYSEC-2026-3657

NLTK < 3.9.3 Eval Injection via collocations.py Command-Line Arguments

Published Jul 24, 2026 · Updated Oct 8, 2026 · Assigned by VulnCheck

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.

Affected products

VendorProductAffectedFixed
ntlk ntlk < 3.9.3 3.9.3

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 nltk 3.9.3-1 —
Debian 13 nltk No fix yet —
Debian 12 nltk No fix yet —
ReleasePackageFixed inAdvisory
Ubuntu Pro 26.04 LTS nltk No fix yet —
Ubuntu Pro 24.04 LTS nltk No fix yet —
Ubuntu Pro 22.04 LTS nltk No fix yet —
Show 4 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 20.04 LTS nltk No fix yet —
Ubuntu Pro 18.04 LTS nltk No fix yet —
Ubuntu Pro 16.04 LTS nltk No fix yet —
Ubuntu Pro 14.04 LTS nltk No fix yet —

Affected packages

EcosystemPackageAffectedFixedRecord
PyPI nltk < 3.9.3 3.9.3 GHSA-848c-c2cx-j7qx

References