# NLTK JVM argument injection in Stanford wrappers via per-call options

Source: https://junglewise.ai/threats/nltk-jvm-argument-injection-in-stanford-wrappers-via-per-call-options-628f3938  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-08-25. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

Severity: critical · CVSS 9.8 · Published 2026-08-25

NLTK is a popular Python library used for natural language processing tasks that includes wrappers for Stanford NLP tools. A validation bypass allows attackers to inject malicious Java arguments through wrapper class options, leading to arbitrary code execution on systems running NLTK-based services. This bypasses a prior security fix and could compromise applications that accept user-supplied configuration for NLP processing.

Technologies: [nltk (PyPI)](https://junglewise.ai/threats/technologies/nltk). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** Critical severity, with a CVSS score of 9.8, published 25 August 2026.

**Which products and versions are affected?** nltk (PyPI) <= 3.10.2.

**Is there a fix for This vulnerability?** A patch was published on 2026-08-11: Version 3.10.3 patched Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is This vulnerability attacked?** It is attacked over the network, in a software library.

**Am I affected?** 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.

## Technical details

The vulnerability is an argument injection flaw (CWE-88) in NLTK's java() function. While a previous CVE-2026-12841 fix added _validate_java_options() to block dangerous JVM flags (like -agentpath, -javaagent, @argfile) when using config_java(), the validation was not applied to per-call options passed directly to java(). The four Stanford wrapper classes (GenericStanfordParser, StanfordTagger, StanfordTokenizer, StanfordSegmenter) accept user-supplied java_options and route them through the unvalidated per-call path, bypassing the fix entirely. An attacker can inject flags like -agentpath:/path/to/malicious.so or -javaagent:/path/to/malicious.jar to load arbitrary code within the JVM. The fix is to add _validate_java_options() call in the java() function's per-call options handling. Patched in NLTK 3.10.3.

## Affected products

- NLTK Project NLTK < 3.10.3

## Timeline

- 2026-08-25: disclosed
- 2026-08-11: patched: Version 3.10.3 patched

## References

- [https://github.com/nltk/nltk/security/advisories/GHSA-m4rf-3fr8-xwx3](https://github.com/nltk/nltk/security/advisories/GHSA-m4rf-3fr8-xwx3)
- [https://www.vulncheck.com/advisories/nltk-before-jvm-argument-injection-via-per-call-options](https://www.vulncheck.com/advisories/nltk-before-jvm-argument-injection-via-per-call-options)

## 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)
