GHSA-6hwm-xvph-95vm: High severity pip/nltk vulnerability

Published Sep 1, 2026
·
Updated

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 findbinary("dot") but discarded the returned validated path and then ran the bare name ["dot", ...], so the validation had no effect. - nltk.translate.api.AlignedSent.reprsvg — 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.findbinary 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.reprsvg : Exception "Cannot find the dot binary..." | planted-binary-executed=False safe

And findbinary 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. findbinary 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.

Affected Software

1 affected componentFixes available
pip/nltk<=3.10.2
3.10.3

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/nltk to a version that resolves this vulnerability.

    Fixed in 3.10.3
  2. Upgrade

    Upgrade nltk.parse.dependencygraph.dot2img to a version that resolves this vulnerability.

    Fixed in 3.10.2
  3. Upgrade

    Upgrade nltk.translate.api.AlignedSent._repr_svg_ to a version that resolves this vulnerability.

    Fixed in 3.10.2

Event History

Sep 1, 2026
Advisory Published
via GitHub·08:27 PM
Data Sourced
via GitHub·08:27 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Who is exposed to this issue?

NLTK installations at version 3.10.2 or earlier are affected when they invoke either nltk.parse.dependencygraph.dot2img or nltk.translate.api.AlignedSent._repr_svg_. The latter path is used during IPython SVG rendering.

2

What must an attacker control to execute code?

The attacker must be able to place a malicious executable named dot in a location searched during process resolution. This includes the current working directory on Windows, or a writable or relative PATH entry such as . on PATH.

3

Are all Graphviz dot invocations in NLTK affected?

The described affected call sites are dependencygraph.dot2img and AlignedSent._repr_svg_. Other wrapper issues of this class for senna, weka, boxer, malt, repp, and hunpos had already been fixed.

4

What can be done before updating?

Do not run the affected functionality from attacker-writable working directories, and remove relative or writable directories such as . from PATH. Ensure an untrusted user cannot plant a file named dot in locations that process creation will search.

5

How can I assess whether a deployment is at risk?

Check whether the installed NLTK version is 3.10.2 or earlier and whether the application uses dependencygraph.dot2img or IPython SVG rendering of AlignedSent. Also inspect the execution environment for a current directory or PATH entries where an attacker could create a dot executable.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203