T05 · Unauthorized Access and Privilege Escalation
- Location
- scripts/generate_video.py:28
- Finding
- Video Script Loads Unrelated Secrets from a Fixed Workspace Environment File<![CDATA[ ## Vulnerability Details **File Location**: `scripts/generate_video.py:28-39,97` **Vulnerability Type**: Excessive access to sensitive configuration **Risk Level**: Medium ### Vulnerable Code ```python def load_env_file(path: str) -> None: env_path = Path(path) if not env_path.exists(): return for line in env_path.read_text(encoding="utf-8", errors="ignore").splitlines(): line = line.strip() if not line or line.startswith("#") or "=" not in line: continue key, value = line.split("=", 1) os.environ.setdefault(key.strip(), value.strip()) ``` The function is automatically invoked against a fixed, privileged workspace path: ```python def main() -> None: load_env_file("/root/.openclaw/workspace/.env") ``` ### Technical Analysis The video-generation script automatically reads `/root/.openclaw/workspace/.env` and imports every key-value pair into its process environment. The declared functionality requires only `ARK_API_KEY`, with optional model configuration through `DOUBAO_VIDEO_MODEL`. Loading all variables from a shared workspace environment file violates least-privilege principles. Unrelated credentials, service tokens, database passwords, or other secrets stored in that file become available to the script and all imported Python components, including the third-party Volcengine SDK. The behavior is not documented in `SKILL.md`, which instructs users to provide `ARK_API_KEY` through the environment. No direct transmission of unrelated environment variables was identified in the reviewed source code, but unnecessarily placing them in the process environment increases their exposure to dependencies, diagnostics, exception handlers, and future code changes. ### Attack Path 1. A user invokes `scripts/generate_video.py`. 2. Before parsing arguments or validating the required credential, the script opens `/root/.openclaw/workspace/.env`. 3. Every syntactically valid entry is inserte ...[truncated 780 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove the automatic loading of `/root/.openclaw/workspace/.env`. 2. Require callers to supply `ARK_API_KEY` through the existing process environment, as documented in `SKILL.md`. 3. If environment-file support is necessary, require an explicit command-line path rather than using a fixed shared path. 4. Parse only an allowlist of required variables, such as `ARK_API_KEY` and `DOUBAO_VIDEO_MODEL`. 5. Do not copy unrelated entries into `os.environ`; retain required configuration in local variables with the shortest practical lifetime. 6. Restrict environment-file permissions and avoid storing credentials for unrelated services in a shared file. ]]>
