AI and data stack advisories

Severe, 6 weeks2431Projects328

2431 severe, 6 weeks · 328 projects

NLTKGHSA-cc5r-64rf-75hg

NLTK: Untrusted search path in prover9/mace4 config allows local code execution via relative binary_location

NLTK

CVE-2026-129234 · Published Nov 19, 2026 · updated Nov 20, 2026

High7.3
Fix: upgrade to 3.10.4 or later
GitHub advisory

Summary

Prover9Parent.config_prover9(binary_location=...) (and Mace, which inherits it) accepts a relative binary_location and passes it as path_to_bin to find_binary, which disables the CWD-relative rejection guard. Unlike the boxer/senna/malt/repp siblings, prover9/mace apply no os.path.isabs() filter, so the resolved relative program path (e.g. ./prover9) is executed from the current working directory via subprocess.Popen. A local attacker who can plant ./prover9 (or ./mace4) in the resolved directory achieves local code execution.

Root Cause

nltk/inference/prover9.py:121-135 calls find_binary(name, path_to_bin=binary_location, env_vars=["PROVER9"], ...). A truthy path_to_bin sets searching_bare_name = not path_to_bin and ... → False (internals.py:935), so the guard if searching_bare_name and not os.path.isabs(path): continue (internals.py:940) never runs. The result is stored in self._prover9_bin; on the next prove(), _call → subprocess.Popen([binary]+args, ...) (prover9.py:207) execs it. Mace(Prover9Parent) inherits config_prover9 (mace.py:229). By contrast boxer's _find_binary (sem/boxer.py:251-266) iterates find_binary_iter and returns only the first os.path.isabs() result; repp/malt/senna similarly reject a relative explicit bin dir. prover9/mace have no such filter.

Impact

Local arbitrary code...

Affected versions

PackageAffectedFixed in
nltk
PyPI
< 3.10.43.10.4
Details and references

## Summary `Prover9Parent.config_prover9(binary_location=...)` (and `Mace`, which inherits it) accepts a relative `binary_location` and passes it as `path_to_bin` to `find_binary`, which disables the CWD-relative rejection guard. Unlike the boxer/senna/malt/repp siblings, prover9/mace apply no `os.path.isabs()` filter, so the resolved relative program path (e.g. `./prover9`) is executed from the current working directory via `subprocess.Popen`. A local attacker who can plant `./prover9` (or `./mace4`) in the resolved directory achieves local code execution. ## Root Cause `nltk/inference/prover9.py:121-135` calls `find_binary(name, path_to_bin=binary_location, env_vars=["PROVER9"], ...)`. A truthy `path_to_bin` sets `searching_bare_name = not path_to_bin and ...` → False (`internals.py:935`), so the guard `if searching_bare_name and not os.path.isabs(path): continue` (`internals.py:940`) never runs. The result is stored in `self._prover9_bin`; on the next `prove()`, `_call` → `subprocess.Popen([binary]+args, ...)` (`prover9.py:207`) execs it. `Mace(Prover9Parent)` inherits `config_prover9` (`mace.py:229`). By contrast boxer's `_find_binary` (`sem/boxer.py:251-266`) iterates `find_binary_iter` and returns only the first `os.path.isabs()` result; repp/malt/senna similarly reject a relative explicit bin dir. prover9/mace have no such filter. ## Impact Local arbitrary code execution: an attacker-planted `./prover9`/`./mace4` runs as the invoking user when the application is configured with a relative `binary_location` and the attacker can write to the resolved directory. ## Proof of Concept In a directory containing an executable `./prover9`: ```python from nltk.inference.prover9 import Prover9 p = Prover9(); p.config_prover9(binary_location='.') # p._prover9_bin == './prover9'; subsequent prove() Popens it from CWD ``` Runtime-confirmed: `find_binary('prover9', path_to_bin='.')` → `'./prover9'`; bare `find_binary('prover9')` and relative `PROVER9='.'` via default `_find_binary` both raise `LookupError` (the default path is protected). ## Attack Chain 1. Entry: app calls `config_prover9(binary_location=<relative>)` / `config_mace(...)`. Guard: CWD-rejection in `find_binary_iter`. Bypass proof: truthy `path_to_bin` sets `searching_bare_name=False` → filter never runs. 2. Resolution: `find_binary` returns `'./prover9'`. Guard: boxer's `if os.path.isabs(binary): return`. Bypass proof: prover9/mace have no such loop , relative first match stored verbatim. 3. Sink: `subprocess.Popen(['./prover9']+args)` (prover9.py:207) , separator-containing path ⇒ execvp runs it relative to CWD, bypassing `$PATH`. 4. Impact: planted `./prover9`/`./mace4` executes = local code execution. ## Bypass Evidence Runtime: `find_binary('prover9', path_to_bin='.') -> './prover9'`; `find_binary('prover9') -> LookupError`. `git log -- nltk/inference/prover9.py nltk/inference/mace.py` shows only copyright/formatting commits , no security fix. GHSA-6hwm-xvph-95vm (CWE-426/427) is scoped to the `dot` binary and names the swept class as senna/weka/boxer/malt/repp/hunpos , prover9/mace absent. ## Affected Versions `<= 3.10.3` , present on latest release and HEAD; no fix. ## Suggested Fix Mirror boxer: accept only the first `os.path.isabs()` result from `find_binary_iter`, or reject a relative `binary_location` in `config_prover9`/`config_mace`. --- Reported by **zx (Jace)** , GitHub: @manus-use ## Fix status (2026-09-28) Status: IN PROGRESS (fix on an open pull request, not yet on develop). 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: f0a75c665 (a relative binary_location is rejected in prover9/mace, megam and tadm), 4ca190b74 (find_binary_absolute refuses a match containing '..'; config_java, hunpos and the

CVSS 3.1
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H
Severity from
GitHub (reviewed advisory)
Weakness
CWE-426, CWE-427
Also known as
CVE-2026-129234

More NLTK advisories

All NLTK