Quick Take
- What: NLTK 3.10.3’s security patch for JAR execution was incomplete; attackers could still execute arbitrary Java code via unvalidated command arguments and inject malicious ARFF directives through class labels.
- Who is affected: Python applications using NLTK 3.10.3 that call
nltk.internals.java()orStanfordSegmenterwith untrusted input, or train Weka classifiers viaWekaClassifier.train()on attacker-influenced datasets. - Severity: Critical (CVSS 9.8) for the JAR bypass (CVE-2026-128138); moderate (CVSS 5.4) for the ARFF injection (CVE-2026-129221).
- Fixed version: 3.10.4, released November 2026.
- What to do: Upgrade the
nltkpackage to version 3.10.4 immediately.
In plain English
NLTK is a popular Python library for working with human language data. Version 3.10.3 tried to fix a security hole that let attackers run dangerous Java code, but the fix was incomplete. Researchers found two new ways around the protection: one that still lets attackers run their own Java programs, and another that lets them corrupt training data files for machine learning classifiers.
What you should do: If you use NLTK in your Python projects, especially if you process data from untrusted sources or train classifiers, you should upgrade to version 3.10.4 right away. If you don’t use NLTK or don’t work with Java integrations or Weka classifiers, you can ignore this.
What happened
NLTK 3.10.3 included security hardening to prevent attackers from injecting Java Virtual Machine arguments or executing untrusted JAR files through the nltk.internals.java() function. The patch correctly blocked dangerous tokens like @/path/to/args and -jar when passed through the options parameter.
However, a security researcher discovered that the same blocked tokens could be supplied through a different channel: the cmd argument sequence. The 3.10.3 code validated the options list but did not check whether the first item in cmd was an ordinary Java main-class name. As a result, launcher control tokens such as -jar or @argfile were accepted and executed.
The researcher confirmed two exploitation paths in NLTK 3.10.3:
1. Direct helper call: Calling nltk.internals.java(cmd=["-jar", /path/to/controlled.jar], classpath=None) executed the external JAR in all test runs, bypassing the NLTK_ALLOW_UNSAFE_JARS and NLTK_ALLOW_UNSAFE_CLASSPATH protections.
2. StanfordSegmenter wrapper: The StanfordSegmenter class exposes a public java_class constructor argument that becomes the first cmd item. Supplying java_class="@/path/to/controlled-launcher.args" executed an external JAR referenced in the argument file, again bypassing all protections.
In parallel, a separate vulnerability (CVE-2026-129221) was reported in NLTK’s Weka classifier integration. The ARFF_Formatter class writes class labels directly into Weka ARFF files without escaping ARFF metacharacters such as }, newlines, @ATTRIBUTE, and @DATA. An attacker who can contribute class labels to a training dataset can inject arbitrary ARFF schema and data directives.
A proof-of-concept demonstrated that a label containing safe}\n@ATTRIBUTE injected NUMERIC\n@DATA\n0,owned\n% closes the nominal label set prematurely, injects a new attribute, starts a premature data section, and comments out the remaining header. The vulnerability is reachable in any application that calls WekaClassifier.train() or ARFF_Formatter.from_train() with attacker-influenced training data.
Both issues were fixed in NLTK 3.10.4. The JAR bypass fix validates the first cmd token to ensure it is not a launcher control argument. The ARFF injection fix sanitizes labels, values, and attribute names before writing them to ARFF files. The fixes were merged to the develop branch (commit 56031eabc for ARFF, with additional defense-in-depth in commit 0e1d6bf87) and released in November 2026.
What you should do
Upgrade the nltk package to version 3.10.4:
pip install --upgrade nltk==3.10.4If you cannot upgrade immediately, do not pass untrusted input into nltk.internals.java() cmd arguments, the StanfordSegmenter java_class argument, or WekaClassifier.train() class labels.
What it means
The JAR execution bypass (CVE-2026-128138) is classified as critical because successful exploitation allows execution of attacker-selected Java bytecode with the privileges of the NLTK process. Practical exploitability depends on an embedding application exposing attacker influence over the cmd or java_class arguments, and the attacker being able to reference a JAR or argument file readable by the NLTK process.
The ARFF injection (CVE-2026-129221) is classified as moderate because it requires the victim application to train a Weka classifier on attacker-influenced data. The injected directives can corrupt the training file schema and data, potentially leading to incorrect model behavior or downstream processing errors.
No exploitation in the wild is reported in the public sources. The vulnerabilities were responsibly disclosed and patched before public release.
Incomplete sandbox fixes are a recurring theme in Python tooling around AI: see our report on the Prefab UI sandbox escape. More developer tool issues are collected in our Coding section, and new cases in our AI Security hub.
Sources
- GitHub Advisory GHSA-x8q7-6c7m-52gw (CVE-2026-128138)
- GitHub Advisory GHSA-9ffx-rrgx-mhgx (CVE-2026-129221)



