Detect NLTK dot2img Graphviz PATH Hijack Local Code Execution (CVE-2026-128134) in Elastic Security
Detects local code execution attempts exploiting CVE-2026-128134, where NLTK's dot2img() helper invokes the Graphviz 'dot' binary without routing through NLTK's trusted-execution chokepoint (find_binary / trusted path validation). Because the subprocess resolves 'dot' via the inherited PATH, an attacker who can write to a directory on the victim's PATH (for example a user-writable directory such as ~/.local/bin) can plant a malicious executable named 'dot' that runs with the privileges of the Python process importing NLTK. The current-working-directory bare-name vector is blocked by the prior fix and is not this issue. CWE-426 (Untrusted Search Path) / CWE-427 (Uncontrolled Search Element). Affects nltk <= 3.10.3; fixed in 3.10.4. Detection focuses on Python/NLTK processes spawning a 'dot' binary from non-standard or writable filesystem locations, and on the creation of rogue 'dot' executables in writable PATH directories.
MITRE ATT&CK
- Tactic
- Execution Privilege Escalation
Elastic Detection Query
// df00tech DF00-a026e88391 · https://df00tech.com/detections/CVE-2026-128134 · licence: https://df00tech.com/detections/licence
process where event.type == "start" and
process.name in ("dot", "dot.exe") and
(
process.parent.name : ("python", "python2", "python3", "python3.*", "python.exe") or
process.parent.command_line : ("*nltk*", "*dot2img*")
) and
not process.executable : ("/usr/bin/dot", "/usr/local/bin/dot", "/bin/dot", "C:\\Program Files\\Graphviz\\*\\dot.exe") EQL rule matching a 'dot' process start whose parent is a Python interpreter or NLTK command, where the executable path is not a known-good Graphviz location, consistent with a hijacked PATH element.
Data Sources
Required Tables
False Positives & Tuning
- Non-standard but legitimate Graphviz installs (conda, homebrew, user prefix)
- Automated NLTK tree rendering in test or notebook environments
- Containerised analytics placing dot in a non-default path
Other platforms for CVE-2026-128134
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.
- Test 1 Plant rogue 'dot' in a writable PATH directory
Expected signal: File-creation event for an executable named 'dot' under ~/.local/bin and a subsequent PATH modification.
- Test 2 Trigger dot2img PATH hijack via vulnerable NLTK
Expected signal: Process-creation event: python3 spawning a 'dot' process whose image path is ~/.local/bin/dot.
- Test 3 Windows writable-PATH dot hijack
Expected signal: Process-creation event: python.exe spawning a 'dot'/'dot.bat' from %APPDATA%\bin.
References (6)
- https://github.com/nltk/nltk/security/advisories/GHSA-7mxv-7h3q-9324
- https://nvd.nist.gov/vuln/detail/CVE-2026-128134
- https://github.com/nltk/nltk/pull/3887
- https://github.com/nltk/nltk/commit/b002a7288c22db86fd6ca2d9526e3f91d6fda797
- https://github.com/nltk/nltk/releases/tag/v3.10.4
- https://github.com/advisories/GHSA-7mxv-7h3q-9324
Response Playbook
Triage
- Confirm the resolved path of the executed 'dot' binary; if it is under a user-writable directory (~/.local/bin, /tmp, /dev/shm, %APPDATA%) rather than a system Graphviz install, treat as probable exploitation.
- Identify the NLTK/Python version on the host: nltk <= 3.10.3 is vulnerable. Run `python3 -c "import nltk; print(nltk.__version__)"` on the affected host.
- Inspect the effective PATH of the user/process that launched Python (env, /proc/<pid>/environ) and determine whether a writable directory precedes the system bin directories.
- Review the planted 'dot' file's hash, owner, and creation time; compare against the legitimate Graphviz binary and submit the hash to reputation services.
Containment
- Quarantine or delete the rogue 'dot' executable from the writable PATH directory and preserve a forensic copy first.
- Isolate the host from the network if the rogue binary executed with elevated privileges or spawned secondary payloads.
- Remove the attacker-writable directory from the affected users' PATH or correct its precedence ahead of system directories.
Evidence Collection
- Capture the full process tree (python -> dot -> children), including command lines, parent command line and working directory.
- Collect the rogue 'dot' binary, its filesystem metadata (owner/mtime/ctime), and any files it created or modified.
- Preserve the user's shell profile / environment configuration that set the hijackable PATH entry.
Escalation Criteria
- !Escalate to IR if the rogue 'dot' binary executed and spawned child processes, established network connections, or achieved privilege escalation.
- !Escalate if the same rogue-binary pattern appears across multiple hosts or users, indicating a broader PATH-poisoning campaign.
- !Escalate if the host runs server-side NLTK workloads (e.g. a web service), where exploitation could mean remote-triggered local code execution.
Investigation Guide
Forensic Artifacts
- >
The rogue 'dot' executable in a writable PATH directory, with anomalous owner and recent creation timestamp. - >
Shell history or scheduled-task entries placing the malicious binary and/or modifying PATH. - >
Process-creation telemetry (Sysmon EID 1 / auditd execve) showing python -> dot with a non-standard image path.
Tuning Guidance
Enumerate the legitimate Graphviz install paths used in your environment (system packages, conda/virtualenv prefixes, homebrew) and add them to an allowlist to suppress benign dot2img usage. If NLTK visualisation is never used in production, alert on ANY python->dot process regardless of path. Prioritise alerts where the 'dot' image path is user-writable and its owner differs from root/Administrators, which most strongly indicates PATH poisoning rather than a non-standard install.
Hunting Queries
Baselines where 'dot' binaries resolve from when launched under Python across the estate, making anomalous writable-path invocations stand out.
// df00tech DF00-a026e88391 · https://df00tech.com/detections/CVE-2026-128134 · licence: https://df00tech.com/detections/licence
DeviceProcessEvents | where FileName in~ ("dot","dot.exe") | summarize count(), make_set(FolderPath) by DeviceName, InitiatingProcessFileName | where InitiatingProcessFileName matches regex @"(?i)python" ``` df00tech DF00-a026e88391 · https://df00tech.com/detections/CVE-2026-128134 · licence: https://df00tech.com/detections/licence ```
index=* (EventCode=1 OR sourcetype=linux:auditd) (Image="*dot" OR process="*dot") | stats values(Image) values(process) count by host ParentImage parent_process | search (ParentImage="*python*" OR parent_process="*python*") Atomic Red Team Tests
Simulates the attacker-controlled binary that NLTK's dot2img would resolve via PATH before the real Graphviz 'dot'.
Command
mkdir -p "$HOME/.local/bin" && printf '#!/bin/sh\nid > /tmp/nltk_dot_hijack.txt\n' > "$HOME/.local/bin/dot" && chmod +x "$HOME/.local/bin/dot" && export PATH="$HOME/.local/bin:$PATH" Cleanup
rm -f "$HOME/.local/bin/dot" /tmp/nltk_dot_hijack.txt Expected Telemetry
File-creation event for an executable named 'dot' under ~/.local/bin and a subsequent PATH modification.
Expected Detection
File-integrity / process rules flag creation of a 'dot' executable in a user-writable PATH directory.
Imports NLTK (<= 3.10.3) and calls dot2img so the planted 'dot' executes in place of Graphviz.
Command
export PATH="$HOME/.local/bin:$PATH"; python3 -c "from nltk.parse.dependencygraph import DependencyGraph; from nltk.draw.dot2img import dot2img" 2>/dev/null; python3 -c "import subprocess; subprocess.run(['dot','-V'])" Cleanup
rm -f /tmp/nltk_dot_hijack.txt Expected Telemetry
Process-creation event: python3 spawning a 'dot' process whose image path is ~/.local/bin/dot.
Expected Detection
Detection fires on a python-parented 'dot' process resolved from a writable/non-standard path.
Places a rogue dot.exe surrogate in a user-writable directory on PATH and invokes it from Python to emulate dot2img resolution on Windows.
Command
$d="$env:APPDATA\\bin"; New-Item -ItemType Directory -Force $d | Out-Null; Set-Content "$d\\dot.bat" "@echo off`r`nwhoami > %TEMP%\\nltk_dot_hijack.txt"; $env:PATH="$d;$env:PATH"; python -c "import subprocess; subprocess.run(['dot'])" Cleanup
Remove-Item "$env:APPDATA\\bin\\dot.bat","$env:TEMP\\nltk_dot_hijack.txt" -ErrorAction SilentlyContinue Expected Telemetry
Process-creation event: python.exe spawning a 'dot'/'dot.bat' from %APPDATA%\bin.
Expected Detection
Detection fires on a python-parented dot process launched from a user-writable path outside the Graphviz install directory.