NLTK can run untrusted dot command from writable directory

HighSE Fix-First Score 43/100CVE-2026-128134SE-AIV-01436Other weaknessAI data and pipelinesMade public 17 Nov 2026

Download as PDF

What this means

A person with access to shared directories on your computer can place a fake Graphviz tool and run code as you when you use NLTK to draw dependency graphs. This could steal your files, keys, or take over your account.

SecurityElites Manager Brief: the decision in one minute

NLTK versions before 3.10.4 can be tricked into running malicious code when you draw dependency graphs. Someone with write access to a shared directory can plant a fake Graphviz tool and run code as you. Upgrade NLTK to 3.10.4 immediately.

SecurityElites Fix-First Score43 of 100
Our own ranking of what to fix first. Real attacks count most, then the chance of attack, then severity.
SecurityElites fix windowWithin 30 days
High severity. This is our suggestion from common practice; your own policy comes first.
Who should own the fixPlatform or ML engineering team that manages Python dependencies.
Likely effortAbout 10 minutes: upgrade NLTK to version 3.10.4 and restart any running code. Longer if you need to test in multiple environments or have pinned dependencies to work around.

Questions to ask your team or supplier

  • Do we use NLTK's dot2img function or render DependencyGraph objects in Jupyter notebooks or web services? If yes, is this in a shared environment where other users can write files?
  • Have we checked the ownership and permissions of all directories in the system PATH on our shared computing hosts? Are any of them writable by unprivileged users or groups?
  • If we cannot upgrade immediately, what is our fallback plan to avoid rendering graphs in shared environments?

Message you can forward to the owning team

Security notice: NLTK can run untrusted dot command from writable directory (CVE-2026-128134)

Severity: High
SecurityElites Fix-First Score: 43 of 100
SecurityElites fix window: Within 30 days
Action: upgrade to nltk 3.10.4 or later.
What we need from you: confirm whether we run this software, who owns it, and the date it will be fixed.
Full guide: https://securityelites.com/ai-vulnerabilities/cve-2026-128134-nltk-can-run-untrusted-dot-command-from-writable-directory/
Source: SecurityElites AI Vulnerabilities Database, record SE-AIV-01436

What is at stake in your AI setup

  • Tools and systems the agent is connected to: If an NLTK-based agent can invoke the dot tool, an attacker gains a foothold to reach other systems the agent can call.
  • Compute bill: A trojan dot could mine cryptocurrency or run expensive jobs under your account, inflating cloud costs.

Map where your company uses AI

Who is exposed

  • Teams running NLTK in shared computing environments (Jupyter hubs, university clusters, shared servers).
  • Data scientists who use NLTK to visualize dependency graphs in notebooks.
  • Services that process user input and render dependency graphs via NLTK.
  • Not affected: NLTK used only for text tokenizing or parsing without graph visualization.

Upgrades you need

SoftwareAffected versionsMove to
nltk
PyPI
Every version before 3.10.43.10.4 or later

Am I affected?

Enter the version you run. Nothing you type is stored.

SecurityElites Developer Brief: the technical picture

Is it being attackedWorking attack code is public, so expect attacks to follow
Where the attacker must beAlready on the machine, or able to get a user to open something on it
Account neededAn ordinary user account
Does a person have to do somethingNo. It works without anyone clicking or opening anything
How hard it is to doEasy. It works reliably once the attacker can reach it
Risk of: data being readHigh
Risk of: data or settings being changedHigh
Risk of: the service being taken downHigh
Can attackers automate it at scaleNo, according to CISA. Each target needs manual work
How much control an attacker gainsTotal control of the affected software, according to CISA

Read from the official severity rating: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Kind of coding mistake

  • CWE-426
  • CWE-427

If you cannot upgrade today

  • Until you can upgrade, do not use `dot2img` or `_repr_svg_` rendering of `DependencyGraph` objects in shared environments.
  • If you must render graphs, use a private, non-shared computing environment with no group/world-writable directories in the PATH.
  • Alternatively, ask a system admin to place the real Graphviz `dot` tool in a directory with strict ownership and no write access to unprivileged users (e.g., /usr/bin), and remove any other writable directories from the PATH.

Signs it may already have been used against you

  • Check process logs for unexpected executions of `dot` from writable directories (e.g., /tmp, /var/tmp, user home directories, or any directory with chmod 777 or 775 permissions).
  • Review shared directory access logs for creation or modification of a file named `dot` by another user in the same group or with world write.
  • Look for unusual child processes spawned by Python when running NLTK code, especially if the parent process is a Jupyter kernel or a service using NLTK.
  • Audit shell history or audit logs for `dot` commands run from unexpected locations or with unusual arguments.

SecurityElites Fix Guide: step by step

  1. Find where NLTK is installedList all Python environments or containers that use NLTK. Check requirements files, pipfiles, or poetry files for the string 'nltk'. Run `pip list | grep nltk` to see the current version in each environment.
  2. Check the NLTK versionOpen a Python shell in each environment and run `import nltk; print(nltk.__version__)`. If the version is earlier than 3.10.4, it needs an upgrade.
  3. Review usage of dot2img and DependencyGraphSearch your code for `dot2img` and `DependencyGraph` with the `_repr_svg_` method call. This matters most if you render graphs in Jupyter notebooks or web services. Even indirect use through libraries counts.
  4. Upgrade NLTK to version 3.10.4In each environment, run `pip install --upgrade nltk==3.10.4`. For conda environments, use `conda install nltk=3.10.4`. For projects with locked dependencies, update the lock file and redeploy.
  5. Restart services and kernelsRestart all running Python processes, Jupyter kernels, and services that import NLTK. Code running in memory will still use the old version until restarted.
  6. Verify the upgradeRun `import nltk; print(nltk.__version__)` again and confirm it shows 3.10.4 or later. Run any existing code that uses `dot2img` or renders `DependencyGraph` objects to confirm it still works.
  7. Check for signs of prior exploitationLook at your shell history, process logs, and any shared directory write events from before the upgrade. See the 'detect' section below for what to search for.
  8. Review shared directory permissionsIf you use shared computing environments, ask a system admin to audit which directories in the system PATH are world-writable or group-writable. Remove write permissions where possible, or move shared tools to protected locations.

How to confirm it is fixed: Run `import nltk; print(nltk.__version__)` and confirm the output is 3.10.4 or later, then run code that uses dot2img or renders a DependencyGraph and confirm it succeeds without spawning unexpected child processes from writable directories.

SecurityElites Quick Fixes: copy and paste

Upgrade nltk with pipupgrade

pip install --upgrade "nltk>=3.10.4"
pip show nltk | grep Version

Pin it in requirements.txtupgrade

nltk>=3.10.4

Check NLTK version in Pythonfor this issue

import nltk
print(nltk.__version__)
if tuple(map(int, nltk.__version__.split('.'))) < (3, 10, 4):
    print('NLTK version is older than 3.10.4 and needs upgrade')

List dependencies with NLTKfor this issue

pip list | grep -i nltk
# or for conda:
conda list nltk

Test in a non-production environment first. General hardening examples use placeholder names and ports; change them to match your setup.

Let your AI coding assistant do the upgrade

Paste this into the coding assistant you already use, inside the project. It checks first and asks before it changes anything.

Instruction for your coding assistant

You are helping me fix a security vulnerability (CVE-2026-128134) in this project.\n\n1. Search the whole repository, including lock files, container files and CI configuration, for these packages and list every place they are pinned or installed:\n   - nltk (PyPI): must be 3.10.4 or later
2. Tell me which version we use now and whether it is affected. Stop and ask me before changing anything.
3. After I agree, raise each one to the safe version, update the lock files, and keep every other dependency as it is.
4. Run the tests and tell me what failed.
5. Give me a short summary of the files you changed that I can put in the pull request.

SecurityElites Incident Drill: could your team handle this?

Four questions to ask in your next team meeting. If any has no clear answer, that is the gap to close.

What is the NLTK version in our production environment, and is it 3.10.4 or later?A good answer: Run `import nltk; print(nltk.__version__)` in a Python shell on the production system; the output should be 3.10.4 or higher.
What would an attacker need to do to exploit this vulnerability?A good answer: An attacker would need write access to a directory in the system PATH and must wait for someone to run NLTK code that calls dot2img or renders a DependencyGraph.
Which directories in our system PATH are writable by multiple users or groups?A good answer: Run `echo $PATH | tr ':' ' ' | while read d; do ls -ld "$d"; done` and look for 'w' permissions for group or others on any directory.
If we see an unexpected dot process in our logs, what should we do?A good answer: Isolate the affected system, check for unauthorized file modifications in shared directories and in the user's home directory, review the user's shell history, and check for signs of data theft or lateral movement.

Run a full timed drill with your team

Ticket for your backlog

Paste into Jira, GitHub Issues or any tracker that reads Markdown.

Ready-made ticket

## NLTK can run untrusted dot command from writable directory (CVE-2026-128134)

**Severity:** High  |  **SE Fix-First Score:** 43/100  |  **Fix window:** Within 30 days
**Record:** SE-AIV-01436 https://securityelites.com/ai-vulnerabilities/cve-2026-128134-nltk-can-run-untrusted-dot-command-from-writable-directory/

### Why this matters
A person with access to shared directories on your computer can place a fake Graphviz tool and run code as you when you use NLTK to draw dependency graphs. This could steal your files, keys, or take over your account.

### What to do
1. Find where NLTK is installed
2. Check the NLTK version
3. Review usage of dot2img and DependencyGraph
4. Upgrade NLTK to version 3.10.4
5. Restart services and kernels
6. Verify the upgrade
7. Check for signs of prior exploitation
8. Review shared directory permissions

Full steps: https://securityelites.com/ai-vulnerabilities/cve-2026-128134-nltk-can-run-untrusted-dot-command-from-writable-directory/

### Done when
- [ ] nltk is at 3.10.4 or later everywhere it is installed
- [ ] Lock files, container images and CI configuration are updated
- [ ] Run `import nltk; print(nltk.__version__)` and confirm the output is 3.10.4 or later, then run code that uses dot2img or renders a DependencyGraph and confirm it succeeds without spawning unexpected child processes from writable directories.
- [ ] Logs were checked for signs of earlier use

SecurityElites Fix Tracker

Record who owns this fix, the date it is due and when it is done, and see everything still open in one list. Free with a SecurityElites account.

Sign in to track this fix

Change history

  • 16 Nov 2026: Made public
  • 1 Dec 2026: Published

Official record

## 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 CauseNLTK'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 ```## ImpactPrerequisites: 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, tem

Weakness type: CWE-426, CWE-427

Use this record in your own tools

Get this record as JSON

curl https://securityelites.com/wp-json/se-aivd/v1/vulns/CVE-2026-128134

For scanners and pipelines: OSV format · CycloneDX format · API guide · Email alerts · Fix tracker

The plain-language sections were written with AI from the official record, and the upgrade versions come directly from the official data. Last updated 2 Dec 2026. Read the vendor advisory before changing a production system.