T08 · Insecure Dependencies
- Location
cli.py:13- Finding
Unverified External Code Executes with API Credentials in Its Environment
- Content
View full analysis
Vulnerability Details
File Location:
cli.py:13-19andcli.py:137; supporting execution paths atquick_task.py:10-15andclawwork.sh:7-14
Vulnerability Type: Unsafe execution of mutable external dependencies
Risk Level: HighVulnerable 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 LiveAgentThe 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/.envbefor ...[truncated 2009 chars]- Remediation
View 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
.enventries 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.
