CVE-2026-78680: NLTK before 3.10.3 Arbitrary Code Execution via Graphviz dot Binary
NLTK versions before 3.10.3 fail to use validated absolute paths when invoking the Graphviz dot binary in dependencygraph.dot2img and AlignedSent.reprsvg, allowing attackers to execute arbitrary code by placing a malicious dot binary in the search path or current working directory. Attackers can exploit bare-name binary resolution on Windows via the current working directory or on Unix-like systems via relative PATH entries to execute their binary instead of the legitimate Graphviz tool.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
nltkto a version that resolves this vulnerability.Fixed in 3.10.3 - Compensating control
Mitigate by ensuring a malicious Graphviz dot binary cannot be found via relative PATH entries or the current working directory (e.g., remove/avoid relative PATH entries and prevent execution from the working directory / constrain PATH) so the legitimate Graphviz dot binary is used.
Event History
Frequently Asked Questions
Which environments are exposed to this issue?
NLTK installations before 3.10.3 are exposed when code invokes dependencygraph.dot2img or AlignedSent._repr_svg_ and resolves the Graphviz dot executable by bare name. On Windows, a malicious dot binary in the current working directory can be selected; on Unix-like systems, relative entries in PATH can cause the same outcome.
What does an attacker need to exploit it?
An attacker needs the ability to place a malicious executable named dot in a location searched before the legitimate Graphviz binary, such as the current working directory on Windows or a relative PATH location on Unix-like systems. Exploitation also requires the affected NLTK functionality to invoke dot.
What is the immediate mitigation if upgrading is not possible?
Avoid invoking the affected NLTK methods in untrusted or attacker-controlled working directories, and ensure PATH does not contain relative entries. Ensure the dot executable resolved by the process is the legitimate Graphviz binary rather than an attacker-controlled file.