OpenClaw Shell Environment Variable Injection Vulnerability Bypasses Command Allowlist

Vulnerability

A remote code execution vulnerability exists in OpenClaw versions prior to 2026.2.22. The issue arises because the application fails to properly sanitize shell startup environment variables HOME and ZDOTDIR within the system.run function. This oversight allows remote attackers to inject malicious startup files, such as .bash_profile or .zshenv, which can execute arbitrary code before the allowlist-evaluated commands are run.

Impact

Exploitation of this vulnerability allows for arbitrary code execution on the affected system, executed in the context of the user running OpenClaw.

Reproduction

To reproduce this vulnerability, set the HOME or ZDOTDIR environment variable to a path containing a malicious startup file, such as .bash_profile or .zshenv. Then, use the system.run function to execute a command. The injected startup file will be processed before the command is executed, bypassing any command allowlist protections.

Remediation

Users can update to OpenClaw version 2026.2.22 or later, where this vulnerability has been patched.

Added: Mar 21, 2026, 1:28 AM
Updated: Mar 21, 2026, 1:28 AM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
10.0
exploitability
5.8
remediation
0.0
relevance
4.2
threat
4.8
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.