CVE-2026-128138: NLTK 3.10.4 patches critical JAR execution bypass in 3.10.3 and ARFF injection flaw

NLTK 3.10.4 closes a critical sandbox bypass that allowed attackers to execute arbitrary JAR files despite protections added in 3.10.3, plus an ARFF injection vulnerability in Weka classifier training.

Christopher Ort
By i10X News Desk · Reviewed by Christopher Ort · 3 min read
Share
A security researcher examining Python code on a laptop screen in a dimly lit office, with Java and ARFF file icons visible on a second monitor.
Image: AI-generated, i10X
On this page
  1. Quick Take
  2. In plain English
  3. What happened
  4. What you should do
  5. What it means
  6. Sources
i10X Quick Take

Quick Take

  1. 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.
  2. Who is affected: Python applications using NLTK 3.10.3 that call nltk.internals.java() or StanfordSegmenter with untrusted input, or train Weka classifiers via WekaClassifier.train() on attacker-influenced datasets.
  3. Severity: Critical (CVSS 9.8) for the JAR bypass (CVE-2026-128138); moderate (CVSS 5.4) for the ARFF injection (CVE-2026-129221).
  4. Fixed version: 3.10.4, released November 2026.
  5. What to do: Upgrade the nltk package 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:

3.10.4 · Bash
pip install --upgrade nltk==3.10.4

If 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)
Christopher Ort

Christopher Ort

Christopher Ort is the editor of i10X News at i10x.ai. He has worked hands-on with AI tools, models and agent workflows for years and leads i10X’s coverage of AI launches, funding and research. He is the author of “The Style Penalty”, an SSRN study on how frontier AI models judge AI-written CVs, covered by heise online and t3n.

Editor's picks

  1. Georgia Tech’s Academic AI Playbook: 20 Lessons From 67 Real Courses, Free to Reuse
  2. Arcfront’s $1B Run Rate: What the AI Data Startup Confirms and What It Doesn’t
  3. GPT-6.2 Astra Tops Blueprint-Bench 2, 70% Above May Leader GPT-5.5
  4. Deutsche Telekom Puts 100 Million Euros Into Mistral for Sovereign AI in Germany
  5. Inkling 2 Mini: Thinking Machines’ Looped Open Model Tops Qwen on Coding Tests