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-G8XP-QX39-9JQ9

GHSA-G8XP-QX39-9JQ9: Arbitrary Code Execution via Environment Variable Injection in OpenClaw Host Execution

Alon Barad
Alon Barad
Software Engineer

Apr 3, 2026·7 min read·60 visits

Executive Summary (TL;DR)

Incomplete sanitization of compiler environment variables (such as CC and CXX) in OpenClaw allows an AI agent to hijack build tools and execute arbitrary code on the underlying host system.

OpenClaw versions prior to v2026.3.31 contain an environment variable injection vulnerability in the Host Environment Security Policy. An untrusted AI model can achieve arbitrary code execution on the host by supplying specific un-sanitized compiler environment variables during host-exec operations.

Vulnerability Overview

OpenClaw operates as a personal AI assistant capable of executing actions on the underlying operating system via its host-exec functionality. This feature relies on a defined trust boundary between the untrusted Large Language Model (LLM) agent and the host system. The application enforces a Host Environment Security Policy to sanitize environment variables before any shell commands requested by the model are executed.

The vulnerability exists in the implementation of this sanitization mechanism. OpenClaw utilizes a negative security model (a denylist) defined in src/infra/host-env-security-policy.json to filter out dangerous environment variables. Prior to version v2026.3.31, this list failed to account for several critical variables used by standard build tools to locate compiler binaries.

This flaw allows a malicious or compromised LLM to perform environment variable injection (CWE-454). By supplying unverified compiler environment variables during a host-exec task, the model can override the path to the executable invoked by tools like Make or CMake.

The successful exploitation of this vulnerability results in arbitrary code execution on the host OS. The malicious code runs with the same privileges as the OpenClaw process, entirely bypassing the intended sandbox restrictions placed on the AI model.

Root Cause Analysis

The fundamental root cause is the reliance on an incomplete negative security model for environment variable validation. When OpenClaw receives a command execution request from the LLM, it processes an accompanying set of environment variable overrides. The system checks these overrides against its denylist, discarding any key that matches a known dangerous variable (such as LD_PRELOAD or PATH).

Build automation tools, including Make, CMake, and Cargo, dynamically determine which compiler to invoke by inspecting specific environment variables. For example, Make uses the CC variable to locate the C compiler, while Cargo relies on CARGO_BUILD_RUSTC. The OpenClaw denylist did not include these specific variables.

This omission introduces an Uncontrolled Search Path Element (CWE-427) condition. When the build tool executes a compilation step, it spawns a child process using the binary specified by the injected environment variable. Because the input from the LLM passes through the sanitization check unmodified, the build tool implicitly trusts the malicious path.

Exploitation requires the model to have authorization to utilize the host-exec capability and necessitates the execution of a command that consumes the targeted toolchain variables. The vulnerability manifests at the exact moment the host system attempts to execute the expected toolchain binary.

Code Analysis

The vulnerable implementation resided primarily within src/infra/host-env-security-policy.json. This configuration file defined the array of string keys that the runtime application would strip from any execution request originating from the LLM. The absence of CC and similar variables meant the input validation logic explicitly permitted them to pass to the OS layer.

The patch implemented in commit e277a37f896b5011a1df06e6490c6630074d0afa expanded this denylist. The update added several variables specific to C, C++, and Rust build toolchains.

// Added to src/infra/host-env-security-policy.json
[
  "CC",
  "CXX",
  "CARGO_BUILD_RUSTC",
  "CMAKE_C_COMPILER",
  "CMAKE_CXX_COMPILER"
]

Additionally, the patch synchronized these changes with the macOS native bridge located at apps/macos/Sources/OpenClaw/HostEnvSecurityPolicy.generated.swift. This ensures that the native Swift validation logic, which executes commands on the macOS host, shares the exact same policy definitions as the TypeScript application layer.

While this fix successfully remediates the immediate attack vectors involving standard compiler overrides, the underlying architecture remains dependent on a denylist. This approach carries residual risk, as obscure build tools or specific language environments may utilize undocumented environment variables that are not present in the updated configuration file.

Exploitation Methodology

Exploitation begins with an attacker injecting a prompt that compels the OpenClaw agent to write a malicious payload to the host filesystem. This payload is typically a shell script containing the attacker's desired arbitrary commands. The script must be marked as executable by the host OS.

Once the payload is present on the disk, the agent initiates a legitimate build command via the host-exec interface. The command request includes an environment variable override that maps a compiler variable to the absolute path of the previously created malicious script.

The host system executes the build tool (e.g., make). When the tool reaches the compilation phase, it reads the injected CC variable. Instead of executing the system's standard C compiler, the tool executes the attacker's shell script. The script runs with the full system privileges of the parent OpenClaw process.

The regression test included in the fix commit demonstrates this precise proof-of-concept:

// Exploit scenario: Setting CC to a malicious script
const exploitPath = path.join(tempDir, "evil-cc");
fs.writeFileSync(exploitPath, `#!/bin/sh\ntouch /tmp/pwned\nexit 1\n`, "utf8");
fs.chmodSync(exploitPath, 0o755);
 
// The model triggers a command like 'make' with an environment override
await runMakeCommand(makePath, tempDir, {
  ...baseEnv,
  CC: exploitPath,
});

Impact Assessment

Successful exploitation of this vulnerability results in arbitrary code execution on the underlying host operating system. The attacker achieves complete control over the OpenClaw process, inheriting its user permissions, filesystem access, and network capabilities.

The estimated CVSS v3.1 vector for this vulnerability is CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H, yielding a score of 10.0. The Scope is marked as Changed (S:C) because the exploit allows an untrusted entity (the AI model operating within a restricted context) to compromise the underlying host environment.

This level of access severely compromises both confidentiality and integrity. An attacker can exfiltrate sensitive files, harvest local API keys, or establish persistent access mechanisms on the compromised machine. The availability of the system can also be degraded if the attacker chooses to terminate processes or consume system resources.

For agentic AI frameworks, vulnerabilities of this nature highlight the inherent risks of granting LLMs direct execution capabilities. Flaws in the sanitization boundary amplify the impact of standard prompt injection attacks, elevating them from isolated logical errors to full system compromise.

Remediation and Hardening

The primary remediation step is to update the OpenClaw installation to version v2026.3.31 or later. This release contains the updated HostEnvSecurityPolicy which blocks the known set of toolchain environment variables. Administrators must ensure that the update is applied across all active instances, particularly those running the macOS native bridge.

Organizations utilizing OpenClaw should implement robust logging to monitor host-exec requests. Security teams must configure alerts for any execution request originating from the LLM that attempts to supply overrides for variables like CC, CXX, CARGO_BUILD_RUSTC, or PATH. These logs provide essential telemetry for detecting ongoing prompt injection attempts.

To mitigate the risk of zero-day bypasses in the denylist, OpenClaw instances should be deployed within tightly restricted environments. Administrators should containerize the application or utilize robust OS-level sandboxing (such as AppArmor or macOS Sandbox). The host environment should grant the OpenClaw process only the minimum filesystem and network permissions necessary for its intended tasks.

From a development perspective, future iterations of OpenClaw should transition the Host Environment Security Policy from a denylist to a strict allowlist. By exclusively permitting a minimal set of known-safe environment variables, the system can systematically prevent injection attacks regardless of the specific build tools invoked by the model.

Official Patches

OpenClawOfficial patch commit updating the Host Environment Security Policy.

Fix Analysis (1)

Technical Appendix

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

Affected Systems

OpenClaw host-exec subsystemOpenClaw macOS Native Bridge

Affected Versions Detail

Product
Affected Versions
Fixed Version
OpenClaw
OpenClaw
< v2026.3.31v2026.3.31
AttributeDetail
CWECWE-454, CWE-427, CWE-78
Attack VectorNetwork (via AI Prompt/Agent execution)
CVSS Score10.0
ImpactArbitrary Code Execution on Host OS
Exploit Statuspoc
Affected ComponentHostEnvSecurityPolicy

MITRE ATT&CK Mapping

T1574.007Hijack Execution Flow: Path Interception by PATH Environment Variable
Persistence, Privilege Escalation, Defense Evasion
T1059Command and Scripting Interpreter
Execution
T1203Exploitation for Client Execution
Execution
CWE-454
External Initialization of Trusted Variables or Data Stores

The product initializes critical internal variables or data stores using inputs that can be modified by untrusted actors.

Known Exploits & Detection

GitHub Commit Regression TestA regression test in the patch demonstrates setting CC to a malicious shell script during a make execution.

Vulnerability Timeline

Fix commit e277a37 pushed to openclaw/openclaw main branch.
2026-03-30
Release v2026.3.31-beta.1 published containing the security fix.
2026-03-31
Public disclosure via GitHub Advisory Database (GHSA-G8XP-QX39-9JQ9).
2026-04-01

References & Sources

  • [1]OpenClaw Patch e277a37
  • [2]OpenClaw GitHub Repository

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.

More Reports

•about 3 hours ago•GHSA-C9XM-49CP-XCR9
6.3

GHSA-C9XM-49CP-XCR9: Server-Side Request Forgery in rmcp OAuth Client

A Server-Side Request Forgery (SSRF) vulnerability exists in the rmcp OAuth client, which is part of the Model Context Protocol (MCP) Rust SDK. The vulnerability arises from insecure processing of the resource_metadata parameter in WWW-Authenticate headers returned by a malicious or compromised MCP server. The client parses and fetches absolute URLs from this header without validation of scheme, origin, or network routing, allowing remote attackers to initiate HTTP GET requests to local network interfaces, RFC 1918 private subnets, or cloud metadata endpoints.

Alon Barad
Alon Barad
4 views•6 min read
•about 8 hours ago•CVE-2026-92945
4.2

CVE-2026-92945: Sandbox Escape and Module Allowlist Bypass via Path Prefix Matching in vm2

A module allowlist bypass vulnerability (CVE-2026-92945 / GHSA-7q3f-wx44-378m) was identified in the vm2 sandboxing library prior to version 3.11.7. This flaw permits unauthenticated or untrusted code running within the sandbox environment to bypass explicit module restrictions. When the transitive resolution option is disabled, the system fails to validate file system path boundaries, allowing prefix-sharing sibling directories to be resolved and loaded, thereby escaping intended sandbox restrictions.

Amit Schendel
Amit Schendel
6 views•6 min read
•about 9 hours ago•CVE-2026-92941
10.0

CVE-2026-92941: Sandbox Escape and Process-Wide TLS Trust Store Manipulation in vm2

CVE-2026-92941 is a critical sandbox-escape and trust-manipulation vulnerability in the vm2 library (versions 3.11.3 to 3.11.6). This security flaw allows untrusted code executing within a NodeVM sandbox environment to compromise the global TLS trust store of the host Node.js process. By leveraging a design flaw where the host's native 'tls.setDefaultCACertificates' can be executed via a proxy wrapper, combined with a bridge unwrapping bypass in the 'url' module, an attacker can modify the process-wide default root Certificate Authorities. Consequently, all subsequent outbound TLS/HTTPS clients running on the host thread are forced to trust attacker-signed certificates, facilitating transparent Man-in-the-Middle (MitM) attacks. The vulnerability was resolved in version 3.11.7 of vm2 by introducing built-in member-level sanitization before applying read-only proxy wrappers.

Amit Schendel
Amit Schendel
5 views•10 min read
•about 10 hours ago•CVE-2026-92944
9.8

CVE-2026-92944: Sandbox Escape in vm2 via Stale V8 PromiseThenLookupChain Protector

A critical engine-level reachability failure in Node.js 26 running V8 14.6 allows attackers to escape the vm2 sandbox environment. When consecutive prototype properties are modified using sequential assignments, a V8 optimization bug fails to invalidate the PromiseThenLookupChain protector. By calling Promise.prototype.finally, the attacker bypasses the vm2 wrappers, hijacks the promise reaction using a custom constructor, triggers a calibrated stack overflow to capture a host-realm RangeError, and executes arbitrary shell commands on the host.

Alon Barad
Alon Barad
7 views•8 min read
•about 11 hours ago•CVE-2026-92939
9.9

CVE-2026-92939: Critical Sandbox Escape via Host Crypto setEngine Native Code Execution in vm2

A critical sandbox escape vulnerability in the vm2 library allows sandboxed JavaScript code to bypass containment and execute arbitrary native code on the host process. This occurs when the host's builtin crypto module is exposed to the NodeVM environment. Although vm2 implements a read-only proxy layer to restrict direct modifications to host properties, it does not prevent invocation of host-level functions. By calling the crypto.setEngine API with a path to a malicious native library on disk, an attacker can trigger OpenSSL's dynamic module loader. The host's operating system loader immediately runs the dynamic library's initializers/constructors before verifying engine compatibility, leading to remote code execution in the context of the host process.

Amit Schendel
Amit Schendel
6 views•5 min read
•about 12 hours ago•CVE-2026-92938
9.9

CVE-2026-92938: Remote Code Execution in vm2 via node:sqlite DatabaseSync Sandbox Escape

CVE-2026-92938 is a critical sandbox escape vulnerability in the vm2 library (versions 3.11.3 through 3.11.6) that allows arbitrary native code execution on the host when the node:sqlite built-in module is loaded inside a sandboxed NodeVM environment.

Amit Schendel
Amit Schendel
8 views•8 min read