NLTK can run untrusted graphing software from writable directories
What this means
A person with write access to any directory on your system's search path can place a fake graphing tool that runs with your privileges when you use NLTK to render a dependency graph. This could let them read your files, steal credentials, or run code as you.
SecurityElites Manager Brief: the decision in one minute
NLTK's graphing function does not check whether the graphing tool it finds is trustworthy. An attacker who can write to common directories can plant a fake tool that runs with your user's rights. This affects any code that renders dependency graphs, including Jupyter notebooks.
| SecurityElites Fix-First Score | 43 of 100 Our own ranking of what to fix first. Real attacks count most, then the chance of attack, then severity. |
|---|---|
| SecurityElites fix window | Within 30 days High severity. This is our suggestion from common practice; your own policy comes first. |
| Who should own the fix | Development and infrastructure teams. |
| Likely effort | About 15 minutes per service: a version bump and a test run. It could take longer if you have custom code that calls `dot2img` directly and needs verification. |
Questions to ask your team or supplier
- Do we use NLTK's dependency graphing or `dot2img` function anywhere, and if so, where?
- Are there any shared development machines, Jupyter servers, or containers where multiple people have write access to directories on the system PATH?
- Have we checked audit logs or process execution records for unexpected `dot` or graphing tool activity between now and when we learned about this issue?
Message you can forward to the owning team
Security notice: NLTK can run untrusted graphing software from writable directories (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-graphing-software-from-writable-directories/
Source: SecurityElites AI Vulnerabilities Database, record SE-AIV-01436What is at stake in your AI setup
- Tools and systems an agent is connected to: an attacker with control over `dot` execution could modify graphs before they are returned to the agent or intercept data being prepared for graphing.
- Prompts and chat history: if graphing is used in an AI chatbot or agent, an attacker could read or modify prompts and conversation state by hijacking the graphing process.
- Keys for AI providers: credentials in environment variables or configuration files could be stolen by a trojan `dot` binary running with the same user privileges.
Who is exposed
- Teams running NLTK in Jupyter notebooks or interactive environments where graphing is used.
- Services that accept user input and render dependency graphs.
- Development machines where multiple people or tools can write to shared directories.
- Containers or virtual machines with group-writable or world-writable directories on the system path.
Upgrades you need
| Software | Affected versions | Move to |
|---|---|---|
| nltk PyPI | Every version before 3.10.4 | 3.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 attacked | Working attack code is public, so expect attacks to follow |
|---|---|
| Where the attacker must be | Already on the machine, or able to get a user to open something on it |
| Account needed | An ordinary user account |
| Does a person have to do something | No. It works without anyone clicking or opening anything |
| How hard it is to do | Easy. It works reliably once the attacker can reach it |
| Risk of: data being read | High |
| Risk of: data or settings being changed | High |
| Risk of: the service being taken down | High |
| Can attackers automate it at scale | No, according to CISA. Each target needs manual work |
| How much control an attacker gains | Total 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, avoid rendering dependency graphs on shared machines or in notebooks with untrusted users.
- If you must use graphing on a shared machine, manually set restrictive permissions on all directories in your PATH: use `chmod 755` or stricter to remove group and world write access.
- Do not use NLTK graphing functions in services or Jupyter notebooks that accept input from untrusted sources.
Signs it may already have been used against you
- Process logs: Look for unexpected spawning of `dot` or graphing tools from unusual directories, especially from directories writable by multiple users.
- File integrity: Check for `dot` binaries in `/tmp`, user home directories, or other non-standard locations that were not installed by your team.
- Audit logs: Review `execve` or `exec` syscall traces around times when NLTK graphing was used, looking for execution from directories outside `/usr/bin` or `/usr/local/bin`.
- Package verification: Confirm that any `dot` binary in standard locations matches the Graphviz package and has not been replaced.
Log searches to start from
Processes spawning dot or graphing tools from unusual directoriesSplunk
index=main (process=dot OR process=graphviz) (parent_process=python OR parent_process=jupyter) | where NOT (process_path=/usr/bin/* OR process_path=/usr/local/bin/* OR process_path=/opt/*) | stats count by process_path, user, hostUnusual execution of graphing tools with NLTK processesElastic
process.name:(dot OR graphviz) AND process.parent.name:(python* OR jupyter*) AND NOT process.executable:(/usr/bin/* OR /usr/local/bin/* OR /opt/*)Written with AI as a starting point. Review them and change the index and field names to match your own logs before you rely on the result.
SecurityElites Fix Guide: step by step
- Find where NLTK is installedList all Python environments or containers that have NLTK. For each, run `pip show nltk` or check your requirements file to see the current version.
- Check the current versionRun `python -c 'import nltk; print(nltk.__version__)'` in each environment. If it is below 3.10.4, it needs to be upgraded.
- Review usage of dependency graphsSearch your codebase for calls to `dot2img`, `DependencyGraph`, or uses of NLTK parsing that might render graphs. Note whether these run on shared machines or in notebooks that other people access.
- Upgrade NLTK to version 3.10.4 or laterIn each Python environment, run `pip install --upgrade nltk>=3.10.4`. If you use a requirements file, update it and redeploy.
- Verify the fix is in placeRun `python -c 'import nltk; print(nltk.__version__)'` again and confirm it shows 3.10.4 or higher.
- Check for signs of past exploitationReview system logs and audit trails for any unusual process spawning or execution of graphing tools in directories where they should not be. Look especially at times when dependency graphs were rendered.
- Remove write access from search-path directoriesOn shared machines, review permissions on `/usr/local/bin`, `/opt`, and other directories on your PATH. Remove world-writable and group-writable bits where possible. Use `ls -ld /path/to/check` to see current permissions.
- Re-test graphing in your applicationIf you use `dot2img` or render dependency graphs in notebooks or services, run a test to confirm graphing still works after the upgrade.
How to confirm it is fixed: Confirm that NLTK is at version 3.10.4 or later by running `python -c 'import nltk; print(nltk.__version__)'` and checking the output.
SecurityElites Quick Fixes: copy and paste
Upgrade nltk with pipupgrade
pip install --upgrade "nltk>=3.10.4"
pip show nltk | grep VersionPin it in requirements.txtupgrade
nltk>=3.10.4Check installed NLTK versionfor this issue
import nltk
print(f'NLTK version: {nltk.__version__}')
if nltk.__version__ < '3.10.4':
print('WARNING: NLTK version is below 3.10.4 and needs upgrade')Find directories on PATH and check permissionsfor this issue
echo $PATH | tr ':' '\n' | while read dir; do
if [ -d "$dir" ]; then
perms=$(ls -ld "$dir" | awk '{print $1}')
echo "$dir: $perms"
fi
doneTest 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.
Ticket for your backlog
Paste into Jira, GitHub Issues or any tracker that reads Markdown.
Ready-made ticket
## NLTK can run untrusted graphing software from writable directories (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-graphing-software-from-writable-directories/
### Why this matters
A person with write access to any directory on your system's search path can place a fake graphing tool that runs with your privileges when you use NLTK to render a dependency graph. This could let them read your files, steal credentials, or run code as you.
### What to do
1. Find where NLTK is installed
2. Check the current version
3. Review usage of dependency graphs
4. Upgrade NLTK to version 3.10.4 or later
5. Verify the fix is in place
6. Check for signs of past exploitation
7. Remove write access from search-path directories
8. Re-test graphing in your application
Full steps: https://securityelites.com/ai-vulnerabilities/cve-2026-128134-nltk-can-run-untrusted-graphing-software-from-writable-directories/
### Done when
- [ ] nltk is at 3.10.4 or later everywhere it is installed
- [ ] Lock files, container images and CI configuration are updated
- [ ] Confirm that NLTK is at version 3.10.4 or later by running `python -c 'import nltk; print(nltk.__version__)'` and checking the output.
- [ ] 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.
Related vulnerabilities
In the same software
- NLTK can write files outside its data directory through hardlinks during package extraction High · CVE-2026-128135
- NLTK can run untrusted Java code through command arguments Critical · CVE-2026-128138
- NLTK XML corpus reader CPU exhaustion with large comments or CDATA High · CVE-2026-128139
- NLTK dependency parser crashes on long sentences High · CVE-2026-129222
- NLTK WordNet methods can be made to exhaust the call stack High · CVE-2026-129223
- NLTK regex patterns can be made to freeze the server High · CVE-2026-129229
The same kind of mistake in other AI tools
- gemini-mcp-tool can be tricked to run commands without approval High · CVE-2026-142216
- jncraton languagemodels can run attacker code via model templates High · CVE-2026-139989
- DeepSeek-AI DeepGEMM can write data outside memory bounds in attention code High · CVE-2026-139817
- rmcp OAuth resource parameter not validated, allowing token theft High · CVE-2026-63127
- n8n workflow expressions can run code with full server access High · CVE-2026-65591
Change history
- 16 Nov 2026: Made public
- 1 Dec 2026: Published
- 3 Dec 2026: Guide updated
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-128134For 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 4 Dec 2026. Read the vendor advisory before changing a production system.