T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/lib/clawdbot_api.js:75
- Finding
- Unrestricted Clawdbot Tool Invocation Through the Main Session<![CDATA[ ## Vulnerability Details **File Location**: `scripts/lib/clawdbot_api.js:75-83`; exposed by `scripts/clawdbot_client.js:78-85` **Vulnerability Type**: Missing authorization boundaries for delegated tool invocation **Risk Level**: Critical ### Vulnerable Code ```javascript // scripts/lib/clawdbot_api.js:75-83 async invokeTool(tool, args = {}, sessionKey = "main") { const payload = { tool, args, sessionKey }; const data = await this.request('/tools/invoke', 'POST', payload); return data.result || data; } ``` ```javascript // scripts/clawdbot_client.js:78-85 case 'tool': const toolName = parsed.args[0]; if (!toolName) { console.error("Error: Provide tool name"); process.exit(1); } const toolArgs = parsed.args[1] ? JSON.parse(parsed.args[1]) : {}; result = await client.invokeTool(toolName, toolArgs); result = JSON.stringify(result, null, 2); break; ``` ### Technical Analysis The bridge accepts an arbitrary tool name and arbitrary JSON arguments from the command line and forwards them directly to Clawdbot's `/tools/invoke` endpoint. No local allowlist, argument schema validation, per-tool authorization, user confirmation, or policy enforcement is applied. `invokeTool` also defaults to the privileged `main` session. Consequently, Agent Zero receives a generic capability proxy rather than only the narrowly defined progress-reporting and question-answering capabilities needed by the Skill. The ultimate operations available depend on the tools enabled by the Clawdbot gateway and the permissions associated with the bearer token. However, the bridge itself imposes no restriction on those operations. ### Attack Path 1. An attacker compromises Agent Zero, influences an autonomous task, or causes it to execute a crafted bridge command. 2. Agent Zero runs: ```bash node /a0/bridge/clawdbot_client.js tool <enabled-tool-name> '<attacker-controlled-json>' ``` 3. `clawdb ...[truncated 795 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove the generic `tool <name> <json>` forwarding interface. 2. Define a strict allowlist containing only the minimum required operations, such as a dedicated notification endpoint. 3. Validate every tool argument against a fixed schema and reject unknown properties. 4. Use a dedicated Agent Zero session rather than the `main` session. 5. Issue a separate, least-privilege gateway token that cannot invoke unrelated tools. 6. Require explicit user approval before invoking tools that access files, execute commands, alter state, or communicate externally. 7. Enforce authorization at the gateway endpoint; client-side restrictions must not be the only control. 8. Record auditable logs containing the requesting identity, selected tool, session, authorization decision, and result. ]]>
