The vulnerability, identified as GHSA-796m-2973-wc5q, is a policy-runtime interpretation mismatch in OpenClaw's tools.exec functionality. The root cause is a discrepancy between how a command is analyzed for security policy compliance (allowlist/safe-bins) and how it is actually executed by the system. This is particularly abusable with command wrappers like GNU env when used with the -S (--split-string) option, which alters how the command line is parsed.
The analysis phase, in functions like unwrapDispatchWrappersForResolution and resolveCommandResolutionFromArgv, would attempt to 'unwrap' the command to identify the core executable for checking against the allowlist. This unwrapping was flawed, as it would present a seemingly benign command for approval (e.g., tr) while ignoring the env -S wrapper that would cause the shell to execute a completely different command provided within the arguments.
Functions responsible for execution, such as handleSystemRunInvoke (for the node host) and processGatewayAllowlist (for the gateway), would then execute the original, user-supplied command. Because the security check was performed on a different interpretation of the command, a malicious command could bypass the allowlist and achieve arbitrary code execution.
The patch rectifies this by introducing a unified 'execution plan'. The analysis phase is hardened to recognize and 'fail closed' on such semantic-modifying wrapper usage by flagging them as policyBlocked. The execution functions are modified to strictly adhere to this plan, using an enforcedCommand or plannedAllowlistArgv derived directly from the analysis. This ensures that the command that gets executed is the exact same one that was analyzed and approved, closing the interpretation gap.