Mar 26, 2026·4 min read·32 visits
Inconsistent environment variable sanitization in OpenClaw's skill execution pipeline permits malicious overrides of variables like HOME and ZDOTDIR, enabling unauthenticated Remote Code Execution on the host.
OpenClaw versions prior to 2026.3.22 are vulnerable to Remote Code Execution (RCE) due to inconsistent sanitization of environment variable overrides between the Gateway and Node components. This architectural flaw allows attackers to inject shell-sensitive variables, resulting in arbitrary command execution on the host system.
OpenClaw is a personal AI assistant platform designed to automate tasks by executing commands on the host system. The platform employs "skills" that define specific workflows, which frequently require overriding standard environment variables during task execution.
A critical vulnerability, tracked as GHSA-39pp-xp36-q6mg, exists in the platform's environment variable sanitization routines. The flaw allows malicious inputs to bypass filtering mechanisms, enabling attackers to inject sensitive shell-control variables into the execution context.
When these manipulated environment variables are processed by the underlying shell, they alter the shell's configuration loading sequence. This architectural oversight leads directly to unauthenticated remote code execution on the system hosting the OpenClaw Node component.
The OpenClaw architecture utilizes a bifurcated execution model, dividing responsibilities between a Gateway and a Node. The Gateway processes incoming requests and API interactions, while the Node handles physical task execution on the host operating system. Each component independently implemented logic to sanitize environment variable keys supplied by skill configurations.
The vulnerability stems from an inconsistency between these two sanitization paths within the Skill Env Handler component, specifically inside the applySkillConfigEnvOverrides function. The Gateway component applied a permissive filter, allowing specific high-risk environment variables to pass through the initial validation boundary.
Upon receiving the payload, the Node component inherited the pre-processed keys without re-validating them against the global "Shared Host Environment Policy." This failure to enforce defense-in-depth permitted attackers to inject configuration-altering variables such as HOME, ZDOTDIR, or BASH_ENV directly into the execution environment.
Exploitation requires the attacker to supply a crafted skill configuration to the OpenClaw Gateway. The configuration must include environment variable overrides targeting specific shell initialization parameters. For example, setting ZDOTDIR=/tmp/payload_dir instructs the /bin/zsh executable to look for its .zshenv initialization file in the specified directory rather than the user's actual home directory.
Once the crafted environment variables bypass the Gateway and are accepted by the Node, the OpenClaw platform attempts to execute the requested skill task. The system spawns a new shell process, which immediately consumes the injected environment variables during its startup sequence.
The shell runtime processes the manipulated variables and executes the attacker-controlled configuration file. This sequence grants the attacker arbitrary code execution privileges matching the user context of the OpenClaw Node process, entirely bypassing intended application restrictions.
The remediation, implemented in Pull Request #51207 by developer joshavant, fundamentally restructures the environment variable handling logic. The patch deprecates the fragmented validation approach in favor of a unified, strict sanitization flow utilized concurrently by both the Gateway and the Node.
The patched applySkillConfigEnvOverrides function introduces explicit blocklists for shell-sensitive variables. Keys such as HOME, ZDOTDIR, PATH, and LD_PRELOAD are now categorically rejected regardless of where they enter the pipeline.
Additionally, the patch implements a fail-closed mechanism for task execution. If a blocked or malformed override key is detected during processing, the system explicitly aborts the task rather than silently dropping the invalid key. This design prevents partial execution states that might otherwise be leveraged for subsequent variant attacks.
The ability to execute arbitrary code on the host system represents a complete compromise of the OpenClaw Node. Because personal AI assistants require broad permissions to manage local development environments and system tasks, the OpenClaw process typically operates with elevated privileges or extensive filesystem access.
An attacker successfully exploiting this vulnerability gains persistent access to the host operating system. This access facilitates the exfiltration of sensitive personal data, source code, and persistent credentials stored within the local environment.
Furthermore, the compromised Node can serve as a pivot point for lateral movement within a broader network. The execution context granted by the vulnerability allows attackers to install persistent backdoors, deploy secondary payloads, or manipulate the AI assistant's ongoing operations without detection.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
OpenClaw OpenClaw | < 2026.3.22 | 2026.3.22 |
| Attribute | Detail |
|---|---|
| Vulnerability Class | Environment Variable Injection |
| CWE ID | CWE-78 |
| Attack Vector | Network |
| Impact | Remote Code Execution |
| Exploit Status | Unexploited / Undisclosed |
| Component | Skill Env Handler |
Improper Neutralization of Special Elements used in an OS Command
A symbolic link directory traversal vulnerability was identified in go-git, a pure Go implementation of the Git specification. This vulnerability allows an attacker to construct a repository that, when checked out or processed, bypasses directory boundaries to write or overwrite arbitrary files on the host filesystem.
CVE-2026-71557 is a path traversal vulnerability in go-git, a pure-Go implementation of Git. In vulnerable versions, the filesystem-backed storage engine fails to validate reference names before mapping them to on-disk paths. An attacker hosting a malicious Git server can advertise references containing directory traversal sequences, such as 'refs/heads/../../config', to write or overwrite files outside the intended reference storage directory.
An information disclosure vulnerability in the Nuxt development server allows adjacent network attackers to retrieve the absolute project root directory and a persistent workspace UUID by querying the unprotected Chrome DevTools workspace endpoint. This occurs when the development server is bound to a network-reachable interface, allowing requests that bypass the header-based security verification checks.
A Regular Expression Denial of Service (ReDoS) vulnerability exists in SvelteKit's content negotiation header parser prior to version 2.70.2. An unauthenticated remote attacker can exploit this vulnerability by sending a crafted Accept header with highly repetitive malformed values. This triggers catastrophic backtracking on the single-threaded Node.js/Bun event loop, leading to CPU exhaustion and full denial of service.
An OS command injection vulnerability exists in the npm package loading component of the jsii-diff CLI tool within the AWS jsii framework. Prior to version 1.131.0, when parsing package specifiers prefixed with `npm:`, the tool concatenated user-controlled inputs directly into a shell execution string via child_process.exec. This allows attackers to execute arbitrary shell commands under the context of the running Node.js process.
CodeIgniter4 versions prior to v4.7.4 contain a protocol-spoofing vulnerability due to improper verification of upstream reverse proxy forwarding headers. Remote, unauthenticated attackers can inject headers like X-Forwarded-Proto to deceive the framework into identifying an insecure HTTP request as a secure HTTPS connection.