Junglewise Threat Intelligence

CVE-2025-71408: NLTK eval injection in collocations module

CVE-2025-71408 · Severity: high · CVSS 7.8 · Published 2026-07-24

Executive brief

The Natural Language Toolkit (NLTK), a popular Python library for processing human language data, contains a security flaw in its collocations module. If an attacker can control the command-line arguments passed to this module, they can execute unauthorized commands on the underlying system. This could lead to a full system compromise, data theft, or disruption of services using the library.

Technical details

An eval injection vulnerability exists in the `nltk.collocations` module of NLTK before version 3.9.3. When the `collocations.py` script is executed directly, the `__main__` block takes command-line arguments and passes them as suffixes to `BigramAssocMeasures` inside a Python `eval()` call without prior sanitization or allowlist validation. A local attacker with the ability to provide CLI arguments can escape the intended attribute lookup to execute arbitrary Python code, including operating system commands via the `os` module. The issue is fixed in version 3.9.3.

Affected products

  • NLTK Project NLTK < 3.9.3

Timeline

  • 2025-07-24: advisory: NVD publication date
  • 2026-07-25: disclosed: GHSA publication date
  • 2026-08-12: patched: GHSA reviewed and updated with patch information

References

Related threats