The vulnerability, identified as GHSA-h3f9-mjwj-w476, is an access control bypass in OpenClaw's node host 'system.run' functionality. The root cause is a discrepancy in how the system handles two parameters for command execution: 'rawCommand' and 'command' (which becomes the argv array). The system would perform security policy checks (e.g., allowlist validation) against the 'rawCommand' string, but the actual command passed to the system for execution was the 'command' array. An attacker could exploit this by providing a benign, allowlisted command in 'rawCommand' to satisfy the security check, while simultaneously providing a different, malicious command in the 'command' parameter, which would then be executed, bypassing the intended security policy.
The analysis of the patch commit 'cb3290fca32593956638f161d9776266b90ab891' reveals two key functions that were modified to address this flaw:
-
handleInvoke in src/node-host/invoke.ts: This is the core function on the node host that executes the command. The patch introduces a call to a new validateSystemRunCommandConsistency function, which ensures that the command derived from the command array matches the rawCommand string. If they are inconsistent, the request is rejected. This directly remediates the execution vulnerability.
-
sanitizeSystemRunParamsForForwarding in src/gateway/node-invoke-system-run-approval.ts: This function acts as a gateway-level pre-check. The patch adds the same consistency validation here. This provides a defense-in-depth, fail-fast mechanism that rejects a malicious request before it even reaches the node host for execution.
Both functions were vulnerable because they lacked this critical consistency check. During an exploit, both sanitizeSystemRunParamsForForwarding and handleInvoke would appear in a runtime profile as they process the malicious node.invoke call.