high · 7.8 Patched

NLTK dot2img runs Graphviz 'dot' without the trusted-exec chokepoint, enabling local code execution via a writable PATH element

CVE-2026-128134 · GHSA-7mxv-7h3q-9324 · EUVD-2026-125821 · published 13 Nov 2026

How serious is it

  • Severity: high, CVSS score 7.8 out of 10.
  • Exploit prediction (EPSS): 0.2% chance of exploitation in the next 30 days, higher than 8% of all vulnerabilities.
  • Not on the CISA list of exploited vulnerabilities.
  • No public exploit in Exploit-DB.

Is your app affected by CVE-2026-128134?

Paste this prompt into Claude Code, Cursor or any AI coding tool: it runs a free Shippable scan of your project and fixes what it finds. Built with Lovable, Bolt or v0? Scan your live app. Or upload your package file.

Who is affected

  • nltk (PyPI) <= 3.10.3

How to check

  1. Run pip show nltk in your project to see the installed version, including copies pulled in by other packages.
  2. Or paste your lockfile into the checker: it lists every package with a known vulnerability, this one included.
  3. Or run npx shippable-dev scan localhost:3000 in your project folder. It reads your lockfile and flags this vulnerability along with every other known one.

How to fix

Copies a prompt for Claude Code, Cursor or Codex: it checks your lockfiles for this and upgrades it.
  1. Upgrade nltk to 3.10.4 or later, commit the lockfile and redeploy.
  2. If a vulnerable version was live, check your logs and rotate the secrets that server could read.

The advisory

## Summary `nltk.parse.dependencygraph.dot2img` invokes the Graphviz `dot` executable without the trusted-execution guarantees that NLTK applies to its other native-tool wrappers. The function resolves `dot` by bare name and then runs the resolved absolute path with a raw `subprocess.run`, omitting the ownership/writability check and the loader-environment scrub that `nltk.pathsec.spawn_trusted` provides. On a POSIX host, a local, unprivileged actor who can write to any group/world-writable directory that appears on the victim's `PATH` can plant a trojan `dot`; when the victim later renders a `DependencyGraph` (for example in a Jupyter notebook, which auto-invokes `_repr_svg_`) or calls `dot2img` directly, the planted binary executes as the victim. The advisory GHSA-6hwm-xvph-95vm (CVE-2026-78680) addressed the same untrusted-search-path class for the Graphviz `dot` invoker in `nltk/translate/api.py`, but `dot2img` received only part of that remediation and remains exploitable. ## Root Cause NLTK's native-tool security model layers four defenses (documented in `nltk/EXTERNAL_TOOL_SECURITY.md`): (1) `find_binary` refuses a current-working-directory-relative match; (2) `resolve_trusted_executable` verifies the resolved file is a regular file that no other unprivileged user can replace (private parent directories, owner is the user or root, no group/world write bit); (3) shell execution is refused; (4) `safe_env` scrubs loader and interpreter environment variables before exec. Layers 2, 3, and 4 are reached only through `nltk.pathsec.spawn_trusted`. `dot2img` calls `find_binary("dot")` (layer 1 only), then executes the result with `subprocess.run([dot_binary, ...])` and no `env=` argument. Layer 1 rejects only non-absolute matches, so an absolute path returned by the `which` search stage survives even when the file lives in a writable directory. Because `dot2img` never calls `spawn_trusted`, the ownership check and environment scrub never run. ```text nltk/parse/dependencygraph.py:626 dot_binary = find_binary("dot") # layer 1 only nltk/parse/dependencygraph.py:631 subprocess.run([dot_binary, "-T%s" % t], ...) # no trust check, no env= nltk/parse/dependencygraph.py:638 subprocess.run([dot_binary, "-T%s" % t], ...) # binary-format branch, same gap nltk/internals.py:1034 if searching_bare_name and not os.path.isabs(path): continue # skips only relative matches nltk/translate/api.py:145 process = spawn_trusted(dot_binary, [f"-T{output_format}"], ...) # hardened sibling ``` ## Impact Prerequisites: a POSIX host on which the attacker is a local, unprivileged user (or code) able to write to a group/world-writable directory that appears on the victim's `PATH`. This includes the commonly cited case of a Homebrew `/usr/local/bin` with `drwxrwxr-x` permissions, or a writable directory placed early on `PATH`. The attacker plants a trojan `dot` there. When the victim renders a `DependencyGraph` (notebook `_repr_svg_` auto-invocation) or calls `dot2img` directly, the trojan executes as the victim, yielding arbitrary local code execution in the victim's account: a local privilege-escalation and lateral-movement primitive. Because the child environment is not scrubbed, loader-injection variables (for example `LD_PRELOAD`, `DYLD_*`, `GCONV_PATH`) also reach the child, providing an additional execution surface. No control over NLTK inputs is required. ## Proof of Concept `Requires: POSIX host, an importable NLTK build from the affected tree, and Python 3. No third-party dependencies.` 1. Create a world-writable directory and write an executable `dot` script into it that drops a marker and emits fake SVG. 2. Prepend that directory to `PATH` and run from a neutral working directory (so this is not the current-working-directory vector). 3. Show that `resolve_trusted_executable` refuses the planted binary (so the hardened path would raise) while `dot2img` executes it. ```python import os, stat, tempfile, subprocess, sys d = tempfile.mkdtemp() dot = os.path.join(d, "dot") with open(dot, "w") as f: f.write("#!/bin/sh\ntouch " + os.path.join(d, "MARKER") + "\necho '<svg><!-- planted dot ran --></svg>'\n") os.chmod(dot, 0o777) os.chmod(d, 0o777) os.environ["PATH"] = d + os.pathsep + os.environ["PATH"] os.chdir("/") from nltk.pathsec import resolve_trusted_executable from nltk.parse.dependencygraph import dot2img print("resolve_trusted_executable(planted dot):", resolve_trusted_executable(os.path.join(d, "dot"))) out = dot2img("digraph G { a -> b }") print("dot2img stdout:", repr(out)) print("planted dot executed (marker created):", os.path.exists(os.path.join(d, "MARKER"))) ``` ```text resolve_trusted_executable(planted dot): None dot2img stdout: '<svg><!-- planted dot ran --></svg>\n' planted dot executed (marker created): True ``` ## Attack Chain 1. **Exposure:** On a shared POSIX host, a group/world-writable directory is present on the victim's `PATH` (for example a writable directory early on `PATH`, or a Homebrew `/usr/local/bin` with group-write). The attacker writes a trojan `dot` into it. 2. **Control:** The attacker fully controls the contents of the planted `dot` file; no control over NLTK inputs is needed. 3. **Path:** The victim renders a `DependencyGraph` (notebook display triggers `_repr_svg_` at `nltk/parse/dependencygraph.py:209`, which calls `dot2img`) or calls `dot2img` directly. 4. **Guard:** `find_binary("dot")` applies layer 1 only (`nltk/internals.py:1034`), which discards a relative current-working-directory match but returns the attacker's absolute path from the `which` stage; `dot2img` never invokes `resolve_trusted_executable` (layer 2) or `safe_env` (layer 4), unlike the hardened sibling `nltk/translate/api.py:145`. 5. **Primitive:** `subprocess.run([dot_binary, "-T%s" % t], ...)` (`nltk/parse/dependencygraph.py:631` and `:638`) executes the untrusted absolute path with the full inherited environment. 6. **Result:** Arbitrary loc…

Check your whole app

Dependencies are only half of it. Free and read-only: before you push, run npx shippable-dev scan localhost:3000 in your project folder, no account needed. For your live app, you prove it's yours with a one-line tag first.

References

Merged from ENISA EUVD, FIRST EPSS, GitHub Advisory Database, OSV. Last updated 17 Nov 2026. All vulnerabilities · RSS · JSON