Advisory

GHSA-7mxv-7h3q-9324

Details, part 2 of 2. The advisory

Details

Affected Versions

  • Ecosystem: pip (PyPI)
  • Package: nltk
  • Confirmed affected range: <= 3.10.3
  • Latest release checked: 3.10.3 (PyPI, latest published release as of the review date; source tree VERSION == 3.10.3)
  • Fix status: 3.10.4

The dot2img function has invoked dot via a raw subprocess since well before the prior advisory. The prior advisory's spawn_trusted standardization routed only the sibling translate/api.py invoker through the trusted-execution chokepoint, so this residual gap in dot2img exists from at least that remediation release onward and remains present in the latest published release (3.10.3). Precise introduction and remediation boundaries below 3.10.3 could not be independently established in this environment (no git tags or release history in the checkout); the confirmed statement is that the latest published release is affected and no fix for dot2img exists.

Suggested Fix

Route dot2img's execution through nltk.pathsec.spawn_trusted(dot_binary, ["-T%s" % t], input=...), mirroring the sibling nltk/translate/api.py, so that the ownership/writability check (layer 2) and the loader-environment scrub (layer 4) apply, and handle TrustError/OSError with the same refusal pattern used at nltk/translate/api.py:152-157. Apply the change to both the text-format and binary-format branches. Add Graphviz dot under nltk/parse/dependencygraph.py to the per-wrapper inventory in nltk/EXTERNAL_TOOL_SECURITY.md so the second invoker is tracked. Interim mitigation without a code change: ensure no group/world-writable directory appears on the PATH of any account that renders NLTK dependency graphs, and install Graphviz in a directory writable only by the user or root.

---

Reported by zx (GitHub: @manus-pi).

Fix status (2026-09-28)

Status: IN PROGRESS (fix on an open pull request, not yet on develop).

Two open pull requests carry a fix.

PR: #3753 "[Do not merge yet] Fix GHSA-8mgp-746c-j5xp: URL-scheme bypass of pathsec.validate_path", open; head da55cab0e at the time of this note (a develop merge on top of 238f81500, the head on which the verdicts below were measured). Fix commit: cf12a5e6a (internals.java() refuses a binary that resolve_trusted_executable rejects, _java_child_env drops the loader environment and pins PATH, dependencygraph.dot2img runs through pathsec.spawn_trusted). Probe: nltk/test/unit/security_probes/ghsa_7mxv_7h3q_9324.py (on that PR); verdict on its head: FIXED (planted absolute java refused with TrustError; loader and JVM environment scrubbed).

PR: #3887 "Resolve every executed tool binary absolute-only: prover9/mace4, megam, tadm, java, hunpos (untrusted search path, CWE-426/427)", open; head 3ac1c5641 at the time of this note (a develop merge on top of 16b1de8ee, the head on which the verdicts below were measured). Fix commits: 992884a02 (the JVM is resolved before spawning and spawned through spawn_trusted) and b002a7288 (dot is spawned through the trusted path in dependencygraph). The #3753 probe run against this head reports STATIC (the planted java is refused with LookupError before the trust guard is reached).

The probe run against develop 2fa3f48fe: VULNERABLE (java() executed a planted untrusted binary from a writable directory).

Release: none.

Sources & licences