---
id: CVE-2025-71408
title: >-
  nltk: NLTK: Arbitrary Code Execution via Eval Injection in Collocations Module
  (CVE-2025-71408)
summary: >-
  A flaw was found in NLTK (Natural Language Toolkit). This eval injection
  vulnerability in the `nltk.collocations` module allows a local attacker to
  execute arbitrary Python code. By manipulating command-line arguments when
  `collocations.py…
severity: high
cvss: 7
cvssVector: 'CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H'
cvssSource: vendor
cwe: CWE-94
vendor: Red Hat
product: Red Hat OpenShift AI (RHOAI)
affected:
  - exploit_intelligence
  - ansible_automation_platform 2
  - openshift_ai_rhoai
patched:
  - nltk 3.9.3
published: '2026-07-24'
updated: '2026-09-15'
sourceUpdated: '2026-09-15T14:12:00+00:00'
source: CSAF
sourceUrl: 'https://security.access.redhat.com/data/csaf/v2/vex/2025/cve-2025-71408.json'
references:
  - url: >-
      https://security.access.redhat.com/data/csaf/v2/vex/2025/cve-2025-71408.json
  - url: 'https://access.redhat.com/security/cve/CVE-2025-71408'
  - url: 'https://bugzilla.redhat.com/show_bug.cgi?id=2506944'
  - url: 'https://www.cve.org/CVERecord?id=CVE-2025-71408'
  - url: 'https://nvd.nist.gov/vuln/detail/CVE-2025-71408'
  - url: >-
      https://aydinnyunus.github.io/2026/06/07/command-injection-nltk-collocations-eval/
  - url: >-
      https://github.com/nltk/nltk/commit/66f14096d952ec8f04934f515e027534bd4eb0ac
  - url: 'https://github.com/nltk/nltk/pull/3465'
  - url: 'https://github.com/nltk/nltk/releases/tag/3.9.3'
  - url: >-
      https://www.vulncheck.com/advisories/nltk-eval-injection-via-collocations-py-command-line-arguments
tags:
  - csaf
  - vex
  - red-hat
  - osv
  - pip
epss: 0.00198
epssPercentile: 0.09928
aliases:
  - PYSEC-2026-3657
ecosystem: pip
ingestedAt: '2026-08-11T19:17:09.710Z'
---

## Overview

A flaw was found in NLTK (Natural Language Toolkit). This eval injection vulnerability in the `nltk.collocations` module allows a local attacker to execute arbitrary Python code. By manipulating command-line arguments when `collocations.py` is invoked directly, an attacker can bypass validation and execute operating system commands. This can lead to significant impact on the system's confidentiality, integrity, and availability.

## Vendor advisories

- **Red Hat VEX** · Important · affected: Exploit Intelligence, Red Hat Ansible Automation Platform 2, Red Hat OpenShift AI (RHOAI) · no fix planned: Exploit Intelligence, Red Hat Ansible Automation Platform 2, Red Hat OpenShift AI (RHOAI) · updated 2026-09-15 · [vex](https://security.access.redhat.com/data/csaf/v2/vex/2025/cve-2025-71408.json)

**nltk: NLTK: Arbitrary Code Execution via Eval Injection in Collocations Module** — rated Important by Red Hat. Released 2025-01-01, updated 2026-09-15.

Affected:

- Exploit Intelligence
- Red Hat Ansible Automation Platform 2
- Red Hat OpenShift AI (RHOAI)

No fix planned:

- Exploit Intelligence
- Red Hat Ansible Automation Platform 2
- Red Hat OpenShift AI (RHOAI)

Not affected:

- Lightspeed Core
- OpenShift Lightspeed
- Red Hat OpenShift AI (RHOAI)

## Remediation

Will not fix

Workarounds / mitigations:

- To mitigate this vulnerability, avoid directly invoking the `nltk.collocations` module's internal script (`collocations.py`) with untrusted command-line arguments. In standard Red Hat deployments, NLTK is typically used as an imported library, which does not expose this vulnerability. If direct invocation is necessary, ensure that all command-line arguments are from trusted sources and are properly validated.

## Package advisory (CVE-2025-71408)

Affected packages:

- `nltk < 3.9.3`

Patched in:

- `nltk 3.9.3`

Source: https://osv.dev/vulnerability/PYSEC-2026-3657
