The vulnerability is a sandbox escape in OpenClaw's sessions_spawn functionality. The root cause lies in the spawnAcpDirect function, which, when called with runtime="acp", would create a new session on the host system without checking if the original request came from an already sandboxed session. This allowed a process within a sandbox to break out and execute with host-level privileges.
The analysis of the provided patches identified three key functions involved:
-
spawnAcpDirect in src/agents/acp-spawn.ts: This is the core of the vulnerability. The patch adds explicit checks to determine if the calling session is sandboxed. If it is, the function now returns a 'forbidden' error, preventing the sandbox escape.
-
createSessionsSpawnTool in src/agents/tools/sessions-spawn-tool.ts: This function acts as an entry point for using the sessions_spawn tool. It was vulnerable because it failed to propagate the necessary sandbox context to spawnAcpDirect. The patch rectifies this by passing the sandbox status, allowing spawnAcpDirect to enforce the new security policy.
-
buildAgentSystemPrompt in src/agents/system-prompt.ts: This function contributed to the exploitability of the vulnerability by generating prompts that guided users and agents to use the vulnerable runtime="acp" option, even within a sandbox. The patch modifies this function to remove this misleading guidance in sandboxed environments, thus reducing the likelihood of accidental or intentional exploitation.
During an exploit, a profiler would likely show calls to createSessionsSpawnTool followed by spawnAcpDirect, where the sandbox bypass occurs. Therefore, these functions are critical indicators of this vulnerability being triggered.