T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/fetch_transcript.py:45
- Finding
- Automatic Privileged Host Network Modification## Vulnerability Details **File Location**: `scripts/fetch_transcript.py`, lines 45-56 **Vulnerability Type**: Automatic execution of privileged network-management commands **Risk Level**: High ### Vulnerable Code ```python def bring_up_vpn(): """Attempt to bring up VPN.""" try: subprocess.run(["wg-quick", "up", VPN_INTERFACE], capture_output=True, timeout=10) subprocess.run( ["ip", "rule", "add", "from", VPN_SOURCE_IP, "table", "51820"], capture_output=True, timeout=5 ) return check_vpn() except Exception as e: return False, str(e) ``` ### Technical Analysis When the expected VPN is unavailable, the script automatically invokes `wg-quick` and modifies the host policy-routing table. These operations affect system-wide networking and ordinarily require root privileges or the `CAP_NET_ADMIN` capability. Fixed argument arrays are used rather than a shell command, so no command-injection path was identified. However, invoking `wg-quick up wg0` causes the host to process the existing WireGuard configuration for `wg0`, which may include routing changes or configuration hooks. The operation therefore exceeds the minimum privileges required merely to retrieve a transcript. The script also ignores the return codes from both commands. Consequently, it cannot reliably distinguish successful configuration from partial failure. Repeated executions can attempt to add the same policy-routing rule multiple times. ### Attack Path 1. The script is run by an agent or service account with root privileges or network-administration capabilities. 2. `check_vpn()` reports that `wg0` is unavailable or lacks a handshake. 3. The script automatically executes `wg-quick up wg0`. 4. The host processes `/etc/wireguard/wg0.conf` and applies its network configuration. 5. The script executes `ip rule add from 10.100.0.2 table 51820`, changing the host policy-r ...[truncated 986 chars]
- Remediation
- ## Remediation Suggestions - Remove automatic VPN and routing configuration from the transcript-fetching workflow. - Require administrators to provision and verify the VPN before invoking the skill. - If automatic setup is essential, require an explicit opt-in option such as `--configure-vpn`. - Run transcript retrieval as an unprivileged account without root access or `CAP_NET_ADMIN`. - Check and handle the return code and standard error of every subprocess. - Verify whether the interface and routing rule already exist before attempting changes. - Validate the active WireGuard configuration and restrict configuration-file ownership and permissions. - Perform network changes in an isolated network namespace or container rather than the host namespace. - Provide a cleanup procedure that removes only rules created by the current process.
