Skip to content
CVE-2026-128138 Google Chronicle · YARA-L

Detect NLTK java() Launcher Token Command Injection, JVM/JAR Sandbox Bypass (CVE-2026-128138) in Google Chronicle

Detects exploitation of CVE-2026-128138, an incomplete-fix command-injection and argument-injection flaw (CWE-77, CWE-88) in NLTK's internal java() helper (nltk.internals.java). NLTK 3.10.3 added validation that rejects Java launcher tokens such as -jar and @argfile in the options channel, but it did not validate the caller-supplied cmd sequence. An attacker who controls the first cmd token, directly via nltk.internals.java or via StanfordSegmenter's java_class argument, can supply a -jar switch or an @argfile reference. The Java launcher interprets these as launcher control arguments rather than a main class, so it executes an attacker-selected JAR and therefore attacker-controlled Java bytecode with the privileges of the NLTK process, bypassing the intended JAR sandbox. Affects nltk >= 3.10.3 and < 3.10.4; fixed in 3.10.4. Exploit status is theoretical with no public exploit. This detection focuses on telemetry: Python processes using NLTK that spawn a java child process with suspicious or injected launcher tokens, and on package-inventory signals identifying vulnerable NLTK installs.

MITRE ATT&CK

Tactic
Execution Stealth

YARA-L Detection Query

Google Chronicle (YARA-L)
yaral
// df00tech DF00-faff7b716a · https://df00tech.com/detections/CVE-2026-128138 · licence: https://df00tech.com/detections/licence
rule nltk_java_launcher_token_injection_cve_2026_128138 {
  meta:
    author = "Argus Detection Platform"
    description = "NLTK java() launcher-token command/argument injection (CVE-2026-128138): Python parent spawns JVM with sandbox-bypass tokens"
    cve = "CVE-2026-128138"
    severity = "HIGH"
  events:
    $e.metadata.event_type = "PROCESS_LAUNCH"
    re.regex($e.target.process.file.full_path, `(?i)javaw?(\.exe)?$`)
    re.regex($e.principal.process.file.full_path, `(?i)python3?w?(\.exe)?$`)
    (
      re.regex($e.target.process.command_line, `(?i)(-javaagent|-agentlib|-agentpath|-Xbootclasspath|-classpath|-cp |-Djava\.class\.path|--add-opens|--add-exports)`) or
      re.regex($e.target.process.command_line, `[;&|\x60$()]`)
    )
    re.regex($e.principal.process.command_line, `(?i)(nltk|stanford|malt)`)
  condition:
    $e
}
high severity medium confidence

Chronicle YARA-L 2.0: matches PROCESS_LAUNCH where a Python/NLTK parent launches a java process carrying JVM launcher tokens that enable sandbox bypass or shell metacharacters.

Data Sources

EDR process telemetry (UDM PROCESS_LAUNCH)

Required Tables

udm.events

False Positives & Tuning

  • Legitimate NLTK + Stanford/Malt parser usage passing -cp and -mx options.
  • NLP batch/CI jobs invoking java from python.
  • Development javaagent attachment via python wrappers.

Other platforms for CVE-2026-128138


Testing Methodology

Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are further down this page.

  1. Test 1 Vulnerable NLTK version present (package inventory)

    Expected signal: Package manager (pip) install event and a python process reading package metadata; EDR package inventory reflects nltk 3.10.3.

  2. Test 2 Simulated NLTK java() launch with injected -javaagent token

    Expected signal: Process-creation event: parent python3 spawns child java with command line containing -javaagent and a multi-entry -cp.

  3. Test 3 Simulated launcher-token argument injection via shell metacharacters

    Expected signal: Sysmon Event ID 1 showing python.exe spawning java.exe with a classpath argument containing injected metacharacters (;, calc.exe).


Response Playbook

Triage

  1. Confirm the parent Python process is actually using NLTK: inspect the full parent command line and loaded modules; NLTK's java() helper is invoked by nltk.parse.stanford, nltk.parse.malt, nltk.tag.stanford and nltk.classify.* integrations.
  2. Extract the exact java argument vector and identify which launcher tokens are present. Legitimate NLTK java() calls pass a controlled -mx memory flag and a single -cp to the expected JAR; flag any extra -javaagent, -agentpath, -Xbootclasspath, attacker-controlled -D system properties, or additional classpath entries pointing outside the expected NLP JAR directory.
  3. Determine the installed NLTK version on the host (pip show nltk / importlib.metadata). Versions >= 3.10.3 and < 3.10.4 are vulnerable; 3.10.4+ is patched.
  4. Trace the origin of the launcher tokens: identify whether any part of the java() arguments derives from untrusted input (uploaded documents, API parameters, model/config files, environment) reaching NLTK's parser/tagger wrappers.

Containment

  1. Isolate or restrict the affected host/container and kill the suspicious java child process if it is executing attacker-controlled classes or agents.
  2. Upgrade NLTK to 3.10.4 or later across all affected environments (pip install -U 'nltk>=3.10.4'); pin the fixed version in requirements/lockfiles to prevent regression.
  3. Where immediate patching is not possible, remove or sandbox the Java-dependent NLTK integrations (Stanford/Malt) and restrict outbound execution so spawned JVMs cannot load remote classpaths.

Evidence Collection

  1. Capture the full process tree (python -> java), including complete command lines, working directory, environment variables and effective user, from EDR/Sysmon/auditd.
  2. Collect any JVM artifacts referenced by the injected tokens: the attacker-specified classpath JARs, -javaagent/-agentpath binaries, and system property values, and preserve them for malware analysis.
  3. Preserve the NLTK-calling application logs and any untrusted input (documents/requests/config) that flowed into the parser/tagger call, plus pip/package inventory showing the vulnerable version.

Escalation Criteria

  • !Escalate to IR if the java child process loaded an attacker-controlled -javaagent/-agentpath/-Xbootclasspath or a classpath pointing to a non-standard or remote location, indicating successful sandbox escape and likely code execution.
  • !Escalate if the launcher tokens are shown to derive from untrusted/remote input, or if there is evidence of subsequent child processes, outbound C2, or persistence following the JVM launch.

Investigation Guide

Forensic Artifacts

  • >Process-creation records showing python parent -> java child with anomalous JVM launcher tokens.
  • >Attacker-referenced JAR/classpath files, -javaagent/-agentpath binaries and -D system property values on disk.
  • >pip/importlib package inventory recording nltk version in the >= 3.10.3, < 3.10.4 range.
  • >Application logs and untrusted input artifacts that reached the NLTK parser/tagger wrappers.

Tuning Guidance

Baseline the expected NLTK Java integrations in your environment (Stanford CoreNLP, MaltParser) and allowlist their normal java() argument shape, typically a single -mx memory flag plus one -cp to a known JAR directory. Alert on deviations: additional classpath entries, any -javaagent/-agentpath/-Xbootclasspath, attacker-influenced -D system properties, or shell metacharacters. In environments with no legitimate Python-to-Java NLP usage, any python->java spawn is high-fidelity. Combine with package-inventory data to prioritize hosts still running nltk >= 3.10.3, < 3.10.4, and suppress once all hosts are patched to 3.10.4+.


Hunting Queries

Baseline all java processes spawned by Python interpreters per host to surface NLTK-driven JVM launches and spot anomalous argument vectors for investigation.

Hunting — KQL
kql
// df00tech DF00-faff7b716a · https://df00tech.com/detections/CVE-2026-128138 · licence: https://df00tech.com/detections/licence
DeviceProcessEvents | where InitiatingProcessFileName in~ ("python","python3","python.exe","python3.exe") | where FileName in~ ("java","java.exe","javaw.exe") | summarize count(), make_set(ProcessCommandLine, 20) by DeviceName, InitiatingProcessCommandLine | order by count_ desc
Hunting — SPL
spl
``` df00tech DF00-faff7b716a · https://df00tech.com/detections/CVE-2026-128138 · licence: https://df00tech.com/detections/licence ```
index=endpoint (process_name=java* OR process_name=javaw*) parent_process_name=python* | stats count values(process) as java_cmds by host, parent_process | sort - count

Atomic Red Team Tests

Test 1 Vulnerable NLTK version present (package inventory)
linux

Confirms a vulnerable NLTK version is installed, establishing exposure to CVE-2026-128138.

Command

bash
python3 -m pip install 'nltk==3.10.3' >/dev/null 2>&1; python3 -c "import importlib.metadata as m; v=m.version('nltk'); print('nltk', v, 'VULNERABLE' if (v>='3.10.3' and v<'3.10.4') else 'not-vulnerable')"

Cleanup

bash
python3 -m pip install -U 'nltk>=3.10.4' >/dev/null 2>&1 || python3 -m pip uninstall -y nltk >/dev/null 2>&1

Expected Telemetry

Package manager (pip) install event and a python process reading package metadata; EDR package inventory reflects nltk 3.10.3.

Expected Detection

Not detected by the behavioral queries (no java spawn); flagged by vulnerability/package-inventory management as nltk in the affected range.

Test 2 Simulated NLTK java() launch with injected -javaagent token
linux

Emulates the sandbox-bypass behavior by having a Python process (NLTK context) spawn java with an injected -javaagent launcher token, reproducing the suspicious process telemetry without real exploitation.

Command

bash
python3 -c "import subprocess,sys; print('nltk java() simulation'); subprocess.run(['java','-javaagent:/tmp/fake-agent.jar','-cp','/tmp/evil:/tmp/stanford.jar','-version'])" 2>&1 || true

Cleanup

bash
rm -f /tmp/fake-agent.jar /tmp/stanford.jar 2>/dev/null; true

Expected Telemetry

Process-creation event: parent python3 spawns child java with command line containing -javaagent and a multi-entry -cp.

Expected Detection

Detected: python parent spawning java with -javaagent/-classpath launcher tokens matches the behavioral rule (tune the NLTK parent-command heuristic for lab runs).

Test 3 Simulated launcher-token argument injection via shell metacharacters
windows

Simulates argument-injection where unvalidated launcher tokens carry shell metacharacters into the java invocation argument vector.

Command

powershell
python -c "import subprocess; subprocess.run(['java','-cp','C:\\nlp\\stanford.jar; calc.exe','-version'], shell=False)"

Cleanup

powershell
echo no cleanup required

Expected Telemetry

Sysmon Event ID 1 showing python.exe spawning java.exe with a classpath argument containing injected metacharacters (;, calc.exe).

Expected Detection

Detected: java child of python parent with classpath/metacharacter launcher tokens matches the behavioral detection.

Related Detections