CVE-2026-128134
NLTK dot2img bypasses executable validation, allowing PATH‑write exec
- CVSS 7.8
- CWE-426
- Configuration Issues
- Local
NLTK (Natural Language Toolkit) is a suite of open source Python modules, data sets, and tutorials supporting research and development in Natural Language Processing. Prior to 3.10.4, nltk.parse.dependencygraph.dot2img resolves the Graphviz dot executable through PATH but invokes the resulting absolute executable without routing through spawn_trusted, so resolve_trusted_executable ownership and writability validation and safe_env loader environment scrubbing do not run. A local low-privileged attacker who can write to a directory on a POSIX victim's PATH can plant or replace dot, and code executes as the victim when dot2img is called directly or DependencyGraph.repr_svg renders a graph. The current-working-directory-only bare-name vector is blocked and is not this vulnerability; this issue is the residual writable absolute PATH element bypass after CVE-2026-78680. This issue is fixed in version 3.10.4.
- CWE
- CWE-426
- CVSS base score
- 7.8
- Published
- 2026-11-13
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Configuration Issues
- Subcategory
- Dynamic Link Library (DLL) Loading Issues
- Accessibility scope
- Local
- Impact
- Arbitrary Code Execution
- Affected component
- NLTK 3.10.4
- Fixed by upgrading
- Yes
Solution
Upgrade NLTK to version 3.10.4 or newer.
Vulnerable code sample
import os
from nltk.parse.dependencygraph import DependencyGraph
def render_svg(dep_str: str) -> bytes:
"""
Render a DependencyGraph as SVG using nltk's dot2img.
Vulnerable: dot executable resolved from PATH is invoked without
spawn_trusted validation.
"""
dg = DependencyGraph(dep_str)
# VULNERABLE: absolute PATH executable invoked without safety checks
return dg.repr_svg() # internally calls dot2img which uses PATH execPatched code sample
import os
from nltk.parse.dependencygraph import DependencyGraph, spawn_trusted_executable, dot2img
def render_svg(dep_str: str) -> bytes:
"""
Render a DependencyGraph as SVG using a trusted dot executable.
"""
dg = DependencyGraph(dep_str)
# FIX: resolve dot via spawn_trusted_executable to enforce ownership checks
trusted_dot = spawn_trusted_executable('dot')
return dot2img(dg.to_dot(), executable=trusted_dot)Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Spawn dot through the trusted path in dependencygraph (nltk/nltk)
nltk/parse/dependencygraph.py,nltk/parse/dependencygraph.py · dot2img
Cite this entry
@misc{vaitp:cve2026128134,
title = {{NLTK dot2img bypasses executable validation, allowing PATH‑write exec}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-128134},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-128134/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
