T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/deploy_helper.py:115
- Finding
- Broad Credential Replication Violates Agent Isolation and Least Privilege<![CDATA[ ## Vulnerability Details **File Location**: `scripts/deploy_helper.py:115-151` **Vulnerability Type**: Credential over-provisioning and privilege boundary violation **Risk Level**: High ### Vulnerable Code ```python elif action == "merge-auth": agent_id = sys.argv[2] agent_auth_path = os.path.expanduser( f"~/.openclaw/agents/{agent_id}/agent/auth-profiles.json" ) main_auth_path = os.path.expanduser( "~/.openclaw/agents/main/agent/auth-profiles.json" ) # Start with empty auth merged = {"version": 1, "profiles": {}, "lastGood": {}, "usageStats": {}} # Source 1: Global auth from openclaw.json global_profiles = config.get("auth", {}).get("profiles", {}) for pid, pdata in global_profiles.items(): merged["profiles"][pid] = pdata provider = pdata.get("provider", pid.split(":")[0]) merged["lastGood"][provider] = pid merged["usageStats"][pid] = {"lastUsed": 0, "errorCount": 0} print(f" [global] {pid}") # Source 2: Main agent per-agent auth if os.path.isfile(main_auth_path): with open(main_auth_path) as f2: main_auth = json.load(f2) for pid, pdata in main_auth.get("profiles", {}).items(): if pid not in merged["profiles"]: merged["profiles"][pid] = pdata provider = pdata.get("provider", pid.split(":")[0]) merged["lastGood"][provider] = pid merged["usageStats"][pid] = {"lastUsed": 0, "errorCount": 0} print(f" [main] {pid}") # Write to agent auth dir os.makedirs(os.path.dirname(agent_auth_path), exist_ok=True) with open(agent_auth_path, "w") as f2: json.dump(merged, f2, indent=2) print(f" Total: {len(merged['profiles'])} profiles -> {agent_auth_path}") ``` The behavior is also explicitly described in `SKILL.md:95-96`: ```markdown - Merges API keys from BOTH global config (`openclaw.json` auth.profiles) AND m ...[truncated 1781 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Do not copy any authentication profile into a new agent by default. 2. Require the operator to supply an explicit allowlist of profiles required by that agent. 3. Create agent-specific, least-privileged credentials rather than duplicating main-agent credentials. 4. Prefer short-lived or dynamically issued credentials with narrowly scoped provider permissions. 5. Prevent child agents from reading the main agent's authentication directory. 6. Record and audit which profile was granted to which agent. 7. Fail deployment if an requested profile is unavailable instead of silently granting all available profiles. 8. Revoke and rotate credentials that may already have been broadly replicated. ]]>
