T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- resolution_tracker.py:28
- Finding
- Overbroad Loading of Secrets from the User Home Directory<![CDATA[ ## Vulnerability Details **File Location**: `resolution_tracker.py`, lines 28-40 **Vulnerability Type**: Excessive access to environment secrets **Risk Level**: High ### Vulnerable Code ```python # ── Load .env if present (development convenience) ──────────────────────────── def _load_env(): for candidate in [".env", os.path.expanduser("~/.env")]: if os.path.exists(candidate): with open(candidate) as f: for line in f: line = line.strip() if line and not line.startswith("#") and "=" in line: k, v = line.split("=", 1) os.environ.setdefault(k.strip(), v.strip()) break _load_env() ``` ### Technical Analysis The tracker reads either a working-directory `.env` file or the global `~/.env` file and imports every key-value pair into the process environment. The Skill only declares a need for a limited set of variables, principally `SIMMER_API_KEY`, `WALLET_PRIVATE_KEY`, `DISCORD_WEBHOOK`, `POLY_MODE`, and `DATA_DIR`. Reading all entries from a user-wide secrets file exceeds the minimum privileges required for resolution tracking. Once loaded, unrelated credentials are exposed to the tracker process, the imported `simmer-sdk` package, and its transitive dependencies. No allowlist restricts which variables may be imported, and no validation ensures that the file belongs specifically to this project. The current code does not itself transmit every loaded variable, and no direct exfiltration of `WALLET_PRIVATE_KEY` was identified. The vulnerability is the unnecessary expansion of the process's credential access boundary. ### Attack Path 1. The user stores credentials for unrelated services in `~/.env`. 2. The tracker is started from a directory without its own `.env`, causing it to fall back to `~/.env`. 3. `_load_env()` imports every entry into `os.environ`. 4. The tracker subsequently imports and executes `simmer-sd ...[truncated 790 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove the `~/.env` fallback entirely. 2. If local dotenv support is necessary, resolve a project-specific file relative to `resolution_tracker.py`. 3. Import only explicitly approved variables: ```python ALLOWED_ENV_KEYS = { "SIMMER_API_KEY", "WALLET_PRIVATE_KEY", "DISCORD_WEBHOOK", "POLY_MODE", "DATA_DIR", } ``` 4. Do not copy unrelated values into `os.environ`. 5. Prefer a dedicated secret manager or pass only the required variables to the scheduled process. 6. Run the tracker in a restricted service environment with an explicit environment-variable allowlist. 7. Isolate wallet signing from the tracker process so that monitoring and journal-processing dependencies never receive private signing material. ]]>
