T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/lib/tor_client.py:19
- Finding
- Predictable Fallback Password for the Tor Control Interface## Vulnerability Details **File Location**: `scripts/lib/tor_client.py:19-47` **Vulnerability Type**: Hardcoded secret and insecure authentication fallback **Risk Level**: Medium ```python TOR_CONTROL_PORT = 9051 TOR_CONTROL_PASS = os.getenv("TOR_CONTROL_PASS", "openclaw_tor") def _rotate_circuit() -> None: try: from stem import Signal from stem.control import Controller with Controller.from_port(port=TOR_CONTROL_PORT) as c: c.authenticate(password=TOR_CONTROL_PASS) c.signal(Signal.NEWNYM) time.sleep(CIRCUIT_COOLDOWN) except Exception: time.sleep(CIRCUIT_COOLDOWN) ``` ### Technical Analysis When the `TOR_CONTROL_PASS` environment variable is absent, the code authenticates to the local Tor control interface using the predictable password `openclaw_tor`. Because this fallback is embedded in publicly inspectable source code, it does not provide meaningful secrecy. Circuit rotation is related to the declared network-fetching functionality, but control-port access is more privileged than ordinary SOCKS proxy access. Secure Tor deployments should use an explicitly provisioned secret or cookie authentication rather than a shared default password. Exploitation requires access to the Tor control endpoint, which is configured here as local port `9051`. The issue therefore primarily affects environments where an attacker already has local code execution, shares the host with untrusted processes, or where the control port is exposed beyond the expected boundary. ### Attack Path 1. The operator runs Tor with password authentication enabled and configures it to accept the fallback password. 2. `TOR_CONTROL_PASS` is not set, causing the Skill to use `openclaw_tor`. 3. An attacker with access to `127.0.0.1:9051`, or to an inadvertently exposed control port, obtains the fallback password from the Skill source. 4. The attacker authenticates directly ...[truncated 697 chars]
- Remediation
- ## Remediation Suggestions - Remove the hardcoded fallback and require `TOR_CONTROL_PASS` to be explicitly configured when password authentication is used. - Prefer Tor cookie authentication, with the authentication cookie readable only by the Skill's dedicated operating-system account. - Fail closed when secure control authentication is unavailable rather than silently attempting a public default. - Run the Skill and Tor under separate, least-privileged service accounts where practical. - Ensure the Tor control port binds only to localhost or a protected Unix socket and is blocked by host firewall rules. - Do not share one control-enabled Tor instance between mutually untrusted workloads. - Log circuit-rotation failures without disclosing authentication material.
