Skip to content
Heist/ feed
Back to feed
HighFix available

nltk — security advisory

Type: advisorySources: OSVAdvisory ID: DEBIAN-CVE-2025-71408

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.

Products
nltk
Affected versions
3.10.0-1, 3.10.1-1, 3.10.3-1, 3.8-1, 3.8.1-1, 3.9.1-1, 3.9.1-2, 3.9.2-1, 3.9.3-1
Fixed versions
3.9.3-1
CVEs
CVE-2025-71408
Confirmed fixed CVEs
Not specified
Updated in this feed
28 Oct 2026, 11:07 UTC · Revision 1

Source evidence

DEBIAN-CVE-2025-71408

core-osv · Original source

Published 24 Jul 2026, 22:16 UTC

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.

osv:DEBIAN-CVE-2025-71408

nltk

Fixed versions: Not specified

nltk

Fixed versions: Not specified

nltk

Fixed versions: 3.9.3-1

Complete source record
{
  "id": "600515d2051aa7962ff9e4b2c452653d1b5a05e0232cd94453dd1b9f4918176f",
  "url": "https://osv.dev/vulnerability/DEBIAN-CVE-2025-71408",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "DEBIAN-CVE-2025-71408",
    "summary": "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.",
    "evidence": "osv:DEBIAN-CVE-2025-71408",
    "products": [
      {
        "name": {
          "value": "nltk",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "3.10.0-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.10.1-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.10.3-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.8-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.8.1-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.9.1-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.9.1-2",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.9.2-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.9.3-1",
            "evidence": "/affected/0/versions"
          }
        ]
      },
      {
        "name": {
          "value": "nltk",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "3.10.0-1",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "3.10.1-1",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "3.10.3-1",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "3.9.1-2",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "3.9.2-1",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "3.9.3-1",
            "evidence": "/affected/1/versions"
          }
        ]
      },
      {
        "name": {
          "value": "nltk",
          "evidence": "/affected/2/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "3.9.3-1",
            "evidence": "/affected/2/ranges"
          }
        ],
        "affected_versions": [
          {
            "value": "3.9.1-2",
            "evidence": "/affected/2/versions"
          },
          {
            "value": "3.9.2-1",
            "evidence": "/affected/2/versions"
          }
        ]
      }
    ],
    "severity": "high",
    "structured": {
      "id": "DEBIAN-CVE-2025-71408",
      "aliases": [
        "DEBIAN-CVE-2025-71408"
      ],
      "metrics": [
        {
          "type": "CVSS_V4",
          "score": "CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "nltk",
            "purl": "pkg:deb/debian/nltk?arch=source&distro=bookworm",
            "ecosystem": "Debian:12"
          },
          "versions": [
            "3.10.0-1",
            "3.10.1-1",
            "3.10.3-1",
            "3.8-1",
            "3.8.1-1",
            "3.9.1-1",
            "3.9.1-2",
            "3.9.2-1",
            "3.9.3-1"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2025-71408.json"
          },
          "ecosystem_specific": {
            "urgency": "not yet assigned"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "nltk",
            "purl": "pkg:deb/debian/nltk?arch=source&distro=trixie",
            "ecosystem": "Debian:13"
          },
          "versions": [
            "3.10.0-1",
            "3.10.1-1",
            "3.10.3-1",
            "3.9.1-2",
            "3.9.2-1",
            "3.9.3-1"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2025-71408.json"
          },
          "ecosystem_specific": {
            "urgency": "not yet assigned"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "3.9.3-1"
                }
              ]
            }
          ],
          "package": {
            "name": "nltk",
            "purl": "pkg:deb/debian/nltk?arch=source&distro=forky",
            "ecosystem": "Debian:14"
          },
          "versions": [
            "3.9.1-2",
            "3.9.2-1"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2025-71408.json"
          },
          "ecosystem_specific": {
            "urgency": "not yet assigned"
          }
        }
      ],
      "modified": "2026-10-09T09:47:29.862523027Z",
      "provider": "osv",
      "upstream": [
        "CVE-2025-71408"
      ],
      "references": [
        "https://security-tracker.debian.org/tracker/CVE-2025-71408"
      ]
    },
    "related_cves": [
      {
        "value": "CVE-2025-71408",
        "evidence": "/upstream"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 111576,
  "published_at": "2026-07-24T22:16:50.063+00:00"
}