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

NLTK's prover9/mace4 config accepted a relative binary_location, so a planted ./prover9 in the CWD executed as the invoking user.

- Payout: Research
- Severity: high
- Program: NLTK
- Found by: manus-use
- Disclosed: 2026-11-19
- CVE: CVE-2026-129234
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-cc5r-64rf-75hg
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-cc5r-64rf-75hg
- Tags: area:oss domain:oss impact:privesc impact:rce kind:research platform:ghsa sev:high tech:python technique:incomplete-fix technique:source-review vuln:command-injection vuln:misconfiguration

**Target:** Python library tool-binary resolution (nltk.internals.find_binary) and subprocess.Popen sink
**Root cause:** config_prover9 passes a truthy path_to_bin to find_binary, which sets searching_bare_name=False and skips the CWD-relative rejection guard; unlike boxer/senna/malt/repp, prover9/mace never filter for os.path.isabs(), so './prover9' is stored and later Popened.
**Steps:**
1. Plant an executable `./prover9` (or `./mace4`) in the working directory.
2. Run `from nltk.inference.prover9 import Prover9; p = Prover9(); p.config_prover9(binary_location='.')`.
3. Observe `p._prover9_bin == './prover9'`; a subsequent `prove()` Popens it from CWD, executing the planted binary.
**How found:** Compared prover9/mace against sibling wrappers (boxer, senna, malt, repp) that filter for absolute paths, and traced find_binary's searching_bare_name logic to show the CWD guard is disabled by a truthy path_to_bin; runtime-confirmed find_binary('prover9', path_to_bin='.') returns './prover9' while the bare call raises LookupError.
**Exploitation:** Requires the application to be configured with a relative binary_location and attacker write access to the resolved directory; the planted binary then runs as the invoking user on the next prove()/build_model() call.
**Insight:** When auditing tool-wrapper libraries, diff each wrapper's binary-resolution path against its siblings: a shared helper's safety guard (here the CWD rejection gated on searching_bare_name) can be silently disabled by an explicit parameter one caller passes and others don't.

## Proof of concept (copied exactly from the original report)

**Prover9 config with relative binary_location PoC**

```
from nltk.inference.prover9 import Prover9
p = Prover9(); p.config_prover9(binary_location='.')
# p._prover9_bin == './prover9'; subsequent prove() Popens it from CWD
```

