NLTK: Uncontrolled search path when invoking the Graphviz 'dot' binary
High7.8CVE-2026-78680 · Published Sep 1, 2026 · updated Sep 10, 2026
Affected versions
| Package | Affected | Fixed in |
|---|---|---|
| nltk PyPI | < 3.10.3 | 3.10.3 |
Details and references
Two NLTK sites executed the Graphviz `dot` program by bare name, so process creation resolved it via the search path , and on Windows via the current working directory , rather than a validated absolute location. An attacker who can place a file named `dot` where resolution looks (the CWD on Windows, or a writable/relative entry such as `.` on `PATH`) has their binary executed in place of Graphviz (arbitrary code execution). Affected (<= 3.10.2): - `nltk.parse.dependencygraph.dot2img` , called `find_binary("dot")` but discarded the returned validated path and then ran the bare name `["dot", ...]`, so the validation had no effect. - `nltk.translate.api.AlignedSent._repr_svg_` , ran the bare name with no validation at all (IPython SVG rendering). This is the same class already fixed for the senna, weka, boxer, malt, repp and hunpos wrappers. `nltk.internals.find_binary` refuses a CWD-relative match for a bare tool name and returns only a trusted absolute path; the fix runs that path in both sites. --- ## Attack demonstration Captured output, not illustrative. A `./dot` that writes a `PWNED` marker, planted in the CWD with `.` prepended to `PATH`. **The vulnerable behaviour (old bare-name exec):** ``` Control (OLD behavior) , bare ['dot'] in this dir with '.' on PATH: bare ['dot'] executed planted binary = True ``` **The patched functions refuse it:** ``` FIXED code, with ./dot planted and '.' on PATH: dependencygraph.dot2img : Exception "Cannot find the dot binary..." | planted-binary-executed=False safe AlignedSent._repr_svg_ : Exception "Cannot find the dot binary..." | planted-binary-executed=False safe ``` **And `find_binary` itself was attacked directly** (the fix trusts nothing else): ``` Attack 1: ./dot in CWD, no dot on PATH -> LookupError (refused) safe Attack 2: ./dot/dot (dir 'dot' holding 'dot') -> LookupError (refused) safe Attack 3: '.' on PATH + ./dot -> LookupError (refused) safe Attack 4: attacker-writable ABSOLUTE dir on PATH -> returned /…/evilbin/dot (absolute) ``` Attack 4 is out of scope: trusting an absolute directory that is already on `PATH` is the operating system's own trust model , an attacker who can write to a `PATH` directory owns the account regardless of NLTK. `find_binary` defends specifically against the CWD/relative injection that bare-name exec is vulnerable to (attacks 1–3), which is exactly what this fix inherits. Environment: python 3.13.7. `dot` is not required to reproduce , the planted binary is the payload.
- CVSS 3.1
- CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Severity from
- GitHub (reviewed advisory)
- Weakness
- CWE-426, CWE-427
- Also known as
- CVE-2026-78680, PYSEC-2026-3868
- github.com/nltk/nltk/security/advisories/GHSA-6hwm-xvph-95vm
- nvd.nist.gov/vuln/detail/CVE-2026-78680
- github.com/nltk/nltk/commit/1a3cd1764ab3deb084fb66d0ffb4873717659538
- github.com/nltk/nltk
- github.com/nltk/nltk/releases/tag/v3.10.3
- www.vulncheck.com/advisories/nltk-before-arbitrary-code-execution-via-graphviz-dot-binary
More NLTK advisories
All NLTK| Date | Advisory | Severity | Fixed in |
|---|---|---|---|
| Sep 1 | NLTK: JVM argument injection bypass via per-call options in the NLTK Stanford wrappers (incomplete fix of CVE-2026-12841) CVE-2026-79675Critical9.8fixed in 3.10.3 | Critical9.8 | 3.10.3 |
| Sep 2 | NLTK: Uncontrolled recursion in nltk.featstruct.FeatStructReader causes unhandled RecursionError (DoS) via deeply nested feature-structure input CVE-2026-81724Medium5.3fixed in 3.10.3 | Medium5.3 | 3.10.3 |
| Sep 2 | NLTK: Uncontrolled resource consumption in RecursiveDescentParser via ambiguous or left-recursive grammars CVE-2026-12876Mediumfixed in 3.10.3 | Medium | 3.10.3 |
| Sep 2 | NLTK: Quadratic CPU Exhaustion in `XMLCorpusView._read_xml_fragment()` CVE-2026-81723Medium3.7fixed in 3.10.3 | Medium3.7 | 3.10.3 |
| Sep 2 | NLTK: Model-artifact APIs bypass pathsec and touch files outside allowed roots CVE-2026-81726High7.0no fix yet | High7.0 | No fix yet |
| Sep 2 | NLTK: Downloader.download follows hardlinks and overwrites outside-root files CVE-2026-81727Medium7.1fixed in 3.10.3 | Medium7.1 | 3.10.3 |