OpenClaw Arbitrary Code Execution Vulnerability via Trusted Prefix Fallback in $SHELL Variable
Vulnerability
A vulnerability allowing arbitrary code execution has been identified in OpenClaw versions 2026.2.22 prior to 2026.2.23. This issue arises in the 'shell-env' component, where the fallback logic for the $SHELL variable can be exploited. Attackers can execute controlled binaries by manipulating the $SHELL environment variable on systems with writable trusted-prefix directories, such as /opt/homebrew/bin, thereby executing arbitrary binaries within the OpenClaw process context.
Impact
Exploitation of this vulnerability allows for arbitrary code execution in the context of the OpenClaw process.
Reproduction
The vulnerability can be reproduced by setting the $SHELL environment variable to a binary located in a trusted-prefix directory that is writable, such as /opt/homebrew/bin. When OpenClaw processes this variable, it will execute the specified binary as a login shell, allowing the attacker to run arbitrary code in the OpenClaw process context.
Remediation
Users can upgrade to OpenClaw version 2026.2.23 or later to address this vulnerability.
Vulnerability Rating
Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.
