CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-39PP-XP36-Q6MG
9.8

GHSA-39pp-xp36-q6mg: Remote Code Execution via Environment Variable Injection in OpenClaw

Alon Barad
Alon Barad
Software Engineer

Mar 26, 2026·4 min read·1 visit

No Known Exploit

Executive Summary (TL;DR)

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.

Vulnerability Overview

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.

Architecture and Root Cause Analysis

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.

Exploit Mechanics

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.

Patch Analysis

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.

Impact Assessment

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.

Official Patches

OpenClawFix PR #51207

Technical Appendix

CVSS Score
9.8/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Affected Systems

OpenClaw GatewayOpenClaw Node

Affected Versions Detail

Product
Affected Versions
Fixed Version
OpenClaw
OpenClaw
< 2026.3.222026.3.22
AttributeDetail
Vulnerability ClassEnvironment Variable Injection
CWE IDCWE-78
Attack VectorNetwork
ImpactRemote Code Execution
Exploit StatusUnexploited / Undisclosed
ComponentSkill Env Handler

MITRE ATT&CK Mapping

T1059.004Command and Scripting Interpreter: Unix Shell
Execution
T1574.007Hijack Execution Flow: Path Interception by PATH Environment Variable
Persistence
CWE-78
OS Command Injection

Improper Neutralization of Special Elements used in an OS Command

Vulnerability Timeline

Vulnerability discovered and reported
2026-03-01
PR #51207 merged to harden environment handling
2026-03-15
OpenClaw version 2026.3.22 released containing the fix
2026-03-22
Advisory GHSA-39pp-xp36-q6mg published
2026-03-26

References & Sources

  • [1]GitHub Advisory: GHSA-39pp-xp36-q6mg
  • [2]OpenClaw Repository
  • [3]Fix PR #51207
  • [4]OpenClaw 2026.3.22 Release Notes

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.