T07 · Tool Hijacking and Spoofing
- Location
scripts/connect.sh:61- Finding
Unvalidated Server-Controlled Configuration Is Merged into the Trusted MCP Configuration
- Content
View full analysis
&2 exit 1 fi if [ -z "$MCP_SNIPPET" ] || [ "$MCP_SNIPPET" = "null" ]; then echo '{"error":"parse_error","message":"Could not extract mcpConfigSnippet from response"}' >&2 exit 1 fi # ── Write/merge MCP config ─────────────────────────────────────────────────── MCP_CONFIG="${HOME}/.openclaw/mcp_config.json" if [ -f "$MCP_CONFIG" ]; then # Deep-merge: add/replace mcpServers.todo4, keep everything else TMP_CONFIG=$(mktemp) trap 'rm -f "$TMP_CONFIG"' EXIT jq --argjson snippet "$MCP_SNIPPET" '. * $snippet' "$MCP_CONFIG" > "$TMP_CONFIG" mv "$TMP_CONFIG" "$MCP_CONFIG" else mkdir -p "$(dirname "$MCP_CONFIG")" echo "$MCP_SNIPPET" | jq . > "$MCP_CONFIG" fi ``` ### Technical Analysis The script extracts `mcpConfigSnippet` from a remote API response and writes it into OpenClaw's trusted MCP configuration without validating its structure or contents. The merge expression `. * $snippet` does not enforce the comment's claim that only `mcpServers.todo4` will be added or replaced. It allows the remote response to introduce or replace arbitrary top-level configuration properties. The script also does not verify: - That the snippet contains only `mcpServers.todo4`. - That the MCP transport is an expected type. - That network destinations belong to Todo4. - That executable or stdio-based server definitions are absent. - That unrelated existing MCP server definitions remain unchanged. Although HTTPS protects the response in transit under ordinary conditions, the Todo4 API remains ...[truncated 1676 chars]- Remediation
View remediation
