OpenClaw Command Injection Vulnerability in Systemd Unit File Generation Allowing Arbitrary Command Execution

Vulnerability

A command injection vulnerability has been identified in OpenClaw versions 2026.2.19-2 prior to 2026.2.21. The issue arises in the generation of systemd unit files, where environment values controlled by an attacker are not properly validated for carriage return or line feed characters. This oversight allows for newline injection, enabling the injection of arbitrary systemd directives by breaking out of the 'Environment=' lines. An attacker who can manipulate 'config.env.vars' and initiate a service installation or restart can execute commands with the privileges of the OpenClaw gateway service user.

Impact

Exploitation of this vulnerability allows for local arbitrary command execution under the OpenClaw gateway service user.

Reproduction

To reproduce this vulnerability, first, configure a malicious environment value in the OpenClaw configuration file, 'config.env.vars', including a newline and an injected directive, such as 'ExecStartPre=' followed by a command to be executed. Next, install or reinstall the OpenClaw gateway service, which will trigger the injection of the newline and directive into the systemd unit file. After the unit file is updated, reload the systemd user services and restart the OpenClaw gateway service. Finally, verify the execution of the injected command by checking for its side effects, such as the creation of a file in the '/tmp' directory.

Remediation

Users should update to OpenClaw version 2026.2.21 or later, where this vulnerability has been patched.

Added: Mar 11, 2026, 2:19 PM
Updated: Mar 11, 2026, 2:19 PM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
7.5
exploitability
6.2
remediation
0.0
relevance
3.8
threat
6.4
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.