Description
OpenClaw versions prior to 2026.2.22 fail to sanitize shell startup environment variables HOME and ZDOTDIR in the system.run function, allowing attackers to bypass command allowlist protections. Remote attackers can inject malicious startup files such as .bash_profile or .zshenv to achieve arbitrary code execution before allowlist-evaluated commands are executed.
Problem types
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (CWE-78)
Product status
Any version before 2026.2.22
2026.2.22 (semver)
Credits
tdjackey
References
github.com/...enclaw/security/advisories/GHSA-xgf2-vxv2-rrmg (GitHub Security Advisory (GHSA-xgf2-vxv2-rrmg))
github.com/...ommit/c2c7114ed39a547ab6276e1e933029b9530ee906 (Patch Commit)
www.vulncheck.com/...onment-variable-injection-in-system-run (VulnCheck Advisory: OpenClaw < 2026.2.22 - Remote Code Execution via Shell Startup Environment Variable Injection in system.run)