CVE-2026-12252: NLTK arbitrary code execution in Stanford interface classes

CVE-2026-12252 · Severity: high · CVSS 7.8 · Published 2026-07-04

The NLTK library, a popular tool for processing human language data, contains a security flaw in its interface for Stanford NLP tools. If a user is tricked into loading a malicious file, an attacker could execute unauthorized code on the user's system. This could lead to a full system compromise, data theft, or the installation of malware.

Technologies: nltk (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2026-12252 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-12252 being exploited in the wild.
How severe is CVE-2026-12252?
High severity, with a CVSS score of 7.8, published 4 July 2026.
Which products and versions are affected?
nltk (PyPI) < 3.9.4, ECOSYSTEM:introduced=0,fixed=3.9.4.
Is there a fix for CVE-2026-12252?
Yes. nltk (PyPI): upgrade to 3.9.4 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-12252 attacked?
It is attacked with local access, in a software library.
Am I affected by CVE-2026-12252?
Check whether you run nltk (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • nltk (PyPI): upgrade to 3.9.4 or later
    pip install "nltk>=3.9.4"

Technical details

A code injection vulnerability exists in NLTK's Stanford interface classes, including StanfordPOSTagger, StanfordNERTagger, StanfordParser, StanfordDependencyParser, and StanfordNeuralDependencyParser. These classes accept user-controllable JAR paths and execute them using the `java()` function, which internally calls `subprocess.Popen()` without verifying the JAR's integrity or origin. While a similar issue was previously patched in the StanfordSegmenter class using SHA256 verification, these specific classes remained unpatched. An attacker can achieve arbitrary code execution if they can convince a user to point the library at a malicious JAR file.

Affected products

  • nltk nltk <= 3.9.3

Identifiers

  • CVE-2026-12252
  • GHSA-9r6g-266r-89x4
  • PYSEC-2026-2085

Timeline

  • 2026-07-04: advisory: NVD publication date

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.