The vulnerability is a path traversal issue in the openclaw agent's screen_record tool, allowing an authorized user to write files outside the intended workspace by providing a malicious outPath. The root cause was a failure to properly apply security guards to the tool's input parameters.
The analysis of the patch commit 635bb35b68d8faa5bfa2fda35feadd315122748a reveals two key areas of failure:
-
Configuration Failure in createOpenClawTools: The createOpenClawTools function in src/agents/openclaw-tools.ts was responsible for creating the agent's tools. Critically, it instantiated the nodes tool (which provides the screen_record action) but failed to wrap it with a security guard that would validate the outPath parameter against the workspace boundary. The patch corrects this by conditionally wrapping the nodesTool with wrapToolWorkspaceRootGuardWithOptions and explicitly telling it to guard the outPath parameter.
-
Insufficient Guard Logic in wrapToolWorkspaceRootGuardWithOptions: The utility function wrapToolWorkspaceRootGuardWithOptions in src/agents/pi-tools.read.ts was insufficiently generic. Its previous implementation did not support checking arbitrary parameter names and likely defaulted to only checking for a parameter named path. This made it ineffective for tools like screen_record that used a different parameter name (outPath) for file paths. The patch refactors this function to accept a pathParamKeys option, allowing it to be configured to validate any given path parameter, thus making the security control more robust and reusable.
Exploitation would involve a call to the execute method of the nodes tool. The vulnerability lies in the fact that this call was not intercepted by a security guard to validate the outPath. The identified functions are the points in the code where this necessary security control was either missing or inadequately implemented.