T08 · Insecure Dependencies
Error
- Location
- cli.py:13
- Finding
- Unverified External Code Executes with API Credentials in Its Environment## Vulnerability Details **File Location**: `cli.py:13-19` and `cli.py:137`; supporting execution paths at `quick_task.py:10-15` and `clawwork.sh:7-14` **Vulnerability Type**: Unsafe execution of mutable external dependencies **Risk Level**: High ### Vulnerable Code ```python # Adiciona o ClawWork ao path CLAWWORK_PATH = Path("/home/freedom/.openclaw/workspace/ClawWork") sys.path.insert(0, str(CLAWWORK_PATH)) sys.path.insert(0, str(CLAWWORK_PATH / "livebench")) # Carrega variáveis de ambiente from dotenv import load_dotenv load_dotenv(CLAWWORK_PATH / ".env") ``` ```python # Importa e executa o agente from agent.live_agent import LiveAgent ``` The quick-task wrapper establishes the same trust boundary: ```python # Adiciona paths sys.path.insert(0, "/home/freedom/.openclaw/workspace/ClawWork") sys.path.insert(0, "/home/freedom/.openclaw/workspace/ClawWork/livebench") # Carrega .env from dotenv import load_dotenv load_dotenv("/home/freedom/.openclaw/workspace/ClawWork/.env") ``` The shell wrapper also sources executable code from that external installation: ```bash CLAWWORK_DIR="/home/freedom/.openclaw/workspace/ClawWork" SKILL_DIR="/home/freedom/.openclaw/workspace/skills/clawwork" # Ativa o ambiente Python source "$CLAWWORK_DIR/venv/bin/activate" # Executa o CLI python "$SKILL_DIR/cli.py" "$@" ``` ### Technical Analysis The Skill prepends two fixed external directories to Python's module search path and imports executable modules from them. These external files are not included in the audited package, and the Skill does not verify their version, ownership, permissions, signature, or content integrity. Because these directories are inserted before normal dependency resolution, a malicious module placed there could also spoof an expected package such as `dotenv`. In the main execution flow, API credentials are loaded from `/home/freedom/.openclaw/workspace/ClawWork/.env` befor ...[truncated 2009 chars]
- Remediation
- ## Remediation Suggestions - Package the required runtime code with the Skill or install it as a version-pinned dependency from an authenticated source. - Pin the external ClawWork dependency to a reviewed commit or release and verify a cryptographic hash or signature before execution. - Do not prepend broad writable directories to `sys.path`. - Import dependencies from an isolated virtual environment whose ownership and permissions are validated. - Verify that the external workspace and every parent directory are not writable by untrusted users. - Avoid sourcing mutable activation scripts. Execute a verified Python interpreter directly, for example through a fixed virtual-environment interpreter path. - Load only the credentials required for the selected operation, and pass them directly to a verified component rather than exposing all `.env` entries to the complete process. - Run external task agents in a restricted subprocess or container with a minimal environment, limited filesystem access, and network egress controls. - Document the external code and credential trust boundary explicitly in the installation instructions.
