The vulnerability allows for a privilege escalation bypass within the OpenClaw platform. The root cause is that heartbeat executions, particularly those triggered by exec-event completions, were inheriting the owner context of the session they were associated with. This allowed for unauthorized access to owner-only tools and commands.
The analysis of the patch commit a30214a624946fc5c85c9558a27c1580172374fd reveals two key functions involved in this vulnerability:
-
runHeartbeatOnce in src/infra/heartbeat-runner.ts: This function initiates the heartbeat process. The patch modifies it to add a ForceSenderIsOwnerFalse: true flag to the message context (MsgContext) when the heartbeat is triggered by an exec-event (hasExecCompletion is true). This indicates that this function was the source of the vulnerable context that lacked the necessary restrictions.
-
resolveCommandAuthorization in src/auto-reply/command-auth.ts: This function is responsible for checking if a command is authorized. The patch modifies this function to check for the newly added ForceSenderIsOwnerFalse flag. If this flag is true, it forces the senderIsOwner check to be false, thereby preventing the privilege escalation. Before the patch, this function would incorrectly determine the sender as an owner based on the inherited context from the heartbeat.
Therefore, during exploitation, runHeartbeatOnce would be called to trigger a heartbeat, and resolveCommandAuthorization would subsequently be called with a crafted context that bypasses the intended authorization checks.