PyPI: nltk
CVE-2026-12252
Safety vulnerability ID: SFTY-20260704-39717
Affected versions of the `nltk` package are vulnerable to Code Injection due to executing user-controllable JAR files without integrity verification. The Stanford interface classes `StanfordPOSTagger`, `StanfordNERTagger`, `StanfordParser`, `StanfordDependencyParser` and `StanfordNeuralDependencyParser` accept a JAR path and run it through the `java()` function, which calls `subprocess.Popen()` without the SHA256 verification already added to `StanfordSegmenter` for CVE-2026-0848. An attacker who can influence the JAR path an application loads, or substitute the JAR file, can execute arbitrary code with the privileges of the process using these classes.
Overview
NLTK Stanford wrapper classes execute untrusted JAR files without verification
Advisory
nltk – Code Injection
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20260704-39717/CVE-2026-12252
- https://nvd.nist.gov/vuln/detail/CVE-2026-12252
- https://huntr.com/bounties/f5c93982-0cc9-4e2e-bb85-1b6ab29a2efb
- https://github.com/nltk/nltk/pull/3743
- https://github.com/nltk/nltk/commit/006f4b83d430147b067b81e2cddd226d6fa405c8
- https://github.com/nltk/nltk/commit/24777f0cb8c33ed2839d16e0f8169a3c312a6806
- https://github.com/nltk/nltk/releases/tag/v3.10.3
- https://github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-2085.yaml
- https://github.com/advisories/GHSA-9r6g-266r-89x4
Verified by Safety
Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.
Learn more
