CVE-2025-71408: NLTK < 3.9.3 Eval Injection via collocations.py Command-Line Arguments

Published Jul 24, 2026
·
Updated

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 Software

2 affected components
nltk Natural Language Toolkit<3.9.3
nltk nltk<3.9.3

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade nltk to a version that resolves this vulnerability.

    Fixed in 3.9.3
  2. Compensating control

    Do not invoke collocations.py directly with user-controlled command-line arguments (suffixes); ensure any CLI arguments passed to nltk.collocations are not attacker-controlled or are blocked at the input/usage boundary.

Event History

Jul 24, 2026
CVE Published
via MITRE·09:07 PM
Data Sourced
via MITRE·09:07 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·10:16 PM
RemedyDescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2025-71408?

CVE-2025-71408 has a severity rating of 8.5, classified as high.

2

How do I fix CVE-2025-71408?

To mitigate CVE-2025-71408, upgrade NLTK to version 3.9.3 or later.

3

What is CVE-2025-71408?

CVE-2025-71408 is an eval injection vulnerability in the NLTK collocations module allowing execution of arbitrary Python code through command-line arguments.

4

Who is affected by CVE-2025-71408?

Users of NLTK versions prior to 3.9.3 are affected by CVE-2025-71408.

5

What can an attacker do with CVE-2025-71408?

An attacker can exploit CVE-2025-71408 to execute arbitrary Python code by manipulating command-line arguments.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203