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

Source: https://junglewise.ai/threats/cve-2026-12252-nltk-arbitrary-code-execution-in-stanford-interface-classes  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-07-04. Updated: 2026-07-04  
License: CC BY 4.0 with a link back

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)](https://junglewise.ai/threats/technologies/nltk). Vendors: [PyPI](https://junglewise.ai/threats/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

  ```sh
  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

- [https://huntr.com/bounties/f5c93982-0cc9-4e2e-bb85-1b6ab29a2efb](https://huntr.com/bounties/f5c93982-0cc9-4e2e-bb85-1b6ab29a2efb)

## Related threats

- [NLTK WekaClassifier path traversal in model validation](https://junglewise.ai/threats/cve-2026-109956-nltk-through-3-10-3-contains-a-path-traversal-vulnerability-in)
- [NLTK RecursiveDescentParser uncontrolled recursion denial of service](https://junglewise.ai/threats/cve-2026-12876-nltk-recursivedescentparser-uncontrolled-recursion-denial-of)
- [NLTK tgrep regular expression denial of service](https://junglewise.ai/threats/nltk-tgrep-regular-expression-denial-of-service-02fca1b2)
- [NLTK Downloader hardlink filesystem containment bypass](https://junglewise.ai/threats/nltk-downloader-hardlink-filesystem-containment-bypass-522cb97d)
- [NLTK Pl196xCorpusReader quadratic ReDoS on malformed TEI blocks](https://junglewise.ai/threats/nltk-pl196xcorpusreader-quadratic-redos-on-malformed-tei-blocks-8473e6ef)
