Description
OpenClaw versions prior to 2026.2.22 contain an environment variable injection vulnerability in the system.run function that allows attackers to bypass command allowlist restrictions via SHELLOPTS and PS4 environment variables. An attacker who can invoke system.run with request-scoped environment variables can execute arbitrary shell commands outside the intended allowlisted command body through bash xtrace expansion.
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-2fgq-7j6h-9rm4 (GitHub Security Advisory (GHSA-2fgq-7j6h-9rm4))
github.com/...ommit/e80c803fa887f9699ad87a9e906ab5c1ff85bd9a (Patch Commit)
www.vulncheck.com/...ps4-environment-injection-in-system-run (VulnCheck Advisory: OpenClaw < 2026.2.22 - Remote Code Execution via SHELLOPTS/PS4 Environment Injection in system.run)