T05 · Unauthorized Access and Privilege Escalation
Warning
- Location
- manual_trade.py:18
- Finding
- Global Agent Secret File Is Loaded Beyond the Skill's Minimum Requirements## Vulnerability Details **File Location**: `manual_trade.py:18-21` **Vulnerability Type**: Excessive credential access and violation of least privilege **Risk Level**: Medium ### Vulnerable Code ```python try: from dotenv import load_dotenv load_dotenv("/root/.openclaw/.env") except Exception: pass ``` ### Technical Analysis The Skill unconditionally attempts to load `/root/.openclaw/.env`, a global Agent environment file. Loading this file imports all variables it contains into the current process environment, even though the declared functionality only requires `SIMMER_API_KEY` and `WALLET_PRIVATE_KEY`. This crosses a least-privilege boundary: unrelated credentials stored in the Agent's global environment become available to the Skill process and all imported Python packages. In particular, `simmer_sdk` executes in the same process and can access every loaded environment variable through `os.environ`. The broad exception handler also suppresses configuration and permission errors, making this access less visible to operators. ### Attack Path 1. An operator stores multiple service credentials in `/root/.openclaw/.env`. 2. The operator invokes `manual_trade.py`. 3. The Skill loads every variable from the global file into its process environment. 4. The imported `simmer_sdk`, a compromised dependency, or future code added to the process reads unrelated secrets from `os.environ`. 5. Those secrets can then be used within the privileges of the affected external accounts or potentially transmitted by dependency-controlled code. No direct exfiltration of unrelated environment variables is implemented in the reviewed project. Exploitation therefore requires malicious or compromised code executing in the same process. ### Impact Assessment The immediate scope includes every credential present in `/root/.openclaw/.env`, rather than only the two credentials declared by the Skill. Depending on the file ...[truncated 423 chars]
- Remediation
- ## Remediation Suggestions - Remove automatic loading of `/root/.openclaw/.env`. - Require the execution environment to supply only the credentials needed by this Skill. - If dotenv support is necessary, use a Skill-specific file with restrictive permissions and an explicit allowlist: ```python from dotenv import dotenv_values values = dotenv_values("/path/to/polymarket-manual-trade.env") for name in ("SIMMER_API_KEY", "WALLET_PRIVATE_KEY"): if name in values: os.environ[name] = values[name] ``` - Validate required variables and fail with a clear error without printing their values. - Run the Skill under a dedicated, unprivileged account rather than relying on a root-owned global configuration. - Minimize the lifetime and scope of wallet credentials, and prefer a restricted signing mechanism if supported.
