OpenClaw Improper Environment Variable Validation Vulnerability in MCP Stdio Server Allowing Arbitrary Code Execution

Vulnerability

A vulnerability exists in OpenClaw versions prior to 2026.4.20, related to improper validation of environment variables in the MCP stdio server configuration. This flaw enables attackers to execute arbitrary code by injecting malicious startup variables such as NODE_OPTIONS, LD_PRELOAD, or BASH_ENV into processes spawned by the MCP server. The issue arises when operators initiate sessions using these compromised servers, potentially leading to code execution in the context of the user running OpenClaw.

Impact

Exploitation of this vulnerability could allow for arbitrary code execution on the server where OpenClaw is running, by injecting and executing malicious code through the manipulated environment variables.

Reproduction

To reproduce this vulnerability, create a malicious workspace configuration that includes dangerous environment variables such as NODE_OPTIONS, LD_PRELOAD, or BASH_ENV. When a session is started using an MCP stdio server that has been configured to accept these variables, the injected code will be executed, demonstrating the vulnerability.

Remediation

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

Added: May 11, 2026, 7:09 PM
Updated: May 11, 2026, 7:09 PM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
7.5
exploitability
7.2
remediation
0.0
relevance
8.0
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.