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-2FGQ-7J6H-9RM4

GHSA-2FGQ-7J6H-9RM4: Remote Code Execution via Environment Injection in OpenClaw

Amit Schendel
Amit Schendel
Senior Security Researcher

Mar 3, 2026·5 min read·23 visits

Executive Summary (TL;DR)

A critical RCE vulnerability exists in OpenClaw's `system.run` tool. Attackers can inject malicious environment variables (`SHELLOPTS` and `PS4`) to force the underlying shell to execute arbitrary commands before the intended application logic runs. This affects all versions prior to the patch released on February 22, 2026. Users must update immediately to ensure the environment sanitizer is active.

OpenClaw, an open-source personal AI assistant, contains a critical Remote Code Execution (RCE) vulnerability in its `system.run` tool functionality. The vulnerability arises from insufficient sanitization of environment variables passed to child processes. By injecting specific Bash configuration variables (`SHELLOPTS` and `PS4`), an attacker can trigger arbitrary command execution during the shell initialization phase. This exploitation method effectively bypasses application-level command allowlists, granting the attacker full control over the host system with the privileges of the OpenClaw process.

Vulnerability Overview

OpenClaw is a personal AI agent designed to execute tasks on a local machine, relying on a system.run capability to invoke shell commands. While the application implements an allowlist to restrict which commands the agent can execute, it historically allowed the agent (and by extension, the Large Language Model or a prompt injector) to specify environment variables for these subprocesses.

The vulnerability lies in the lack of filtering for dangerous environment variables that influence the behavior of the Unix shell itself. Specifically, the Bash shell respects environment variables that configure debugging and prompt expansion. By manipulating these variables, an attacker can turn a harmless command execution into a vehicle for arbitrary code execution. This flaw is a variant of environment injection, leveraging specific "Bash-isms" to achieve execution flow hijacking.

Root Cause Analysis

The root cause is the unchecked propagation of environment variables to the bash process combined with Bash's handling of the SHELLOPTS and PS4 variables. This is a known attack vector against scripts or applications that pass user-controlled environments to bash.

  1. SHELLOPTS: This variable allows the caller to enable shell options via the environment. Setting SHELLOPTS=xtrace is equivalent to running set -x or bash -x. It forces Bash to print each command to stderr before executing it.
  2. PS4: This variable defines the prompt printed before each line when xtrace is active. Crucially, Bash performs variable and command substitution on the value of PS4 every time it prints a trace line.

When system.run spawns a shell with these variables injected, Bash initializes, sees xtrace is on, and immediately attempts to print the trace for the command being run. To do so, it evaluates PS4. If PS4 contains a command substitution like $(malicious_cmd), Bash executes malicious_cmd immediately. This execution happens implicitly during the shell's startup logic, completely bypassing the OpenClaw command allowlist.

Code Analysis & Fix

The vulnerability existed in both the Node.js host (src/node-host/invoke-system-run.ts) and the macOS companion app (HostEnvSanitizer.swift). Prior to the fix, the application passed the env object from the request directly to the child process with insufficient filtering.

The fix, applied in commit e80c803fa887f9699ad87a9e906ab5c1ff85bd9a, implements a multi-layered defense strategy. It introduces a HostEnvSanitizer that explicitly blocks dangerous keys and enforces a strict allowlist for shell wrappers.

Key Changes in the Patch:

  1. Blocklist Implementation: The sanitizer now explicitly rejects SHELLOPTS and PS4 (along with other potentially dangerous variables like BASH_ENV) if they appear in the request environment.
  2. Shell Wrapper Detection: The system detects if the command being executed is a shell wrapper (e.g., bash, sh, zsh).
  3. Strict Allowlist: If a shell wrapper is detected, the environment is stripped of all variables except for a safe allowlist (TERM, LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, COLORTERM, NO_COLOR, FORCE_COLOR).
// Conceptual representation of the fix logic
const DANGEROUS_KEYS = ['SHELLOPTS', 'PS4', 'BASH_ENV', 'PERL5OPT'];
 
function sanitizeEnv(inputEnv) {
  // 1. Block dangerous keys globally
  for (const key of DANGEROUS_KEYS) {
    if (inputEnv[key]) throw new Error(`Blocked dangerous env key: ${key}`);
  }
 
  // 2. If running a shell, enforce strict allowlist
  if (isShellWrapper(command)) {
    return pick(inputEnv, SAFE_ALLOWLIST);
  }
  
  return inputEnv;
}

Exploitation Methodology

To exploit this vulnerability, an attacker must be able to influence the arguments passed to the system.run tool. This could be achieved through a malicious prompt (Prompt Injection) that tricks the AI agent into executing a specific tool call, or by directly interacting with the API if the attacker has network access.

Attack Scenario:

  1. Injection: The attacker crafts a system.run request that includes specific environment variable overrides.
  2. Payload Construction:
    • SHELLOPTS is set to xtrace.
    • PS4 is set to a command substitution string, such as $(cat /etc/passwd > /tmp/exfil).
  3. Execution: The OpenClaw agent executes the allowed command (e.g., echo hello) using bash.
  4. Trigger: Bash starts, sees xtrace, and expands PS4 to print the trace for echo hello. During this expansion, cat /etc/passwd is executed.

This technique is particularly dangerous because it does not require the primary command to be malicious. The allowed command echo is sufficient to trigger the vulnerability because the payload executes as a side effect of the shell's debugging features.

Impact Assessment

The impact of this vulnerability is Critical (CVSS 9.8). Successful exploitation results in Remote Code Execution (RCE) on the host machine running OpenClaw. The code executes with the same privileges as the OpenClaw process.

Consequences include:

  • Total System Compromise: If OpenClaw is running as a user with sudo access or Administrator privileges, the attacker gains full control over the operating system.
  • Data Exfiltration: Attackers can read sensitive files (SSH keys, credentials, personal documents) and exfiltrate them via network requests.
  • Persistence: The attacker can install backdoors, reverse shells, or malware to maintain access even after the OpenClaw process is restarted.
  • Lateral Movement: The compromised host can be used as a pivot point to attack other devices on the local network.

Fix Analysis (1)

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 Node.js HostOpenClaw macOS Companion App

Affected Versions Detail

Product
Affected Versions
Fixed Version
OpenClaw
OpenClaw
< Feb 22 2026 Commite80c803fa887f9699ad87a9e906ab5c1ff85bd9a
AttributeDetail
CWE IDCWE-78
Vulnerability TypeEnvironment Variable Injection
Attack VectorNetwork / Prompt Injection
CVSS9.8 (Critical)
Exploit StatusPoC Available
ImpactRemote Code Execution

MITRE ATT&CK Mapping

T1059.004Command and Scripting Interpreter: Unix Shell
Execution
T1574Hijack Execution Flow
Persistence
CWE-78
Improper Neutralization of Special Elements used in an OS Command

Vulnerability Timeline

Fix Developed and Committed
2026-02-22
Advisory Published (Approximate)
2026-02-28

References & Sources

  • [1]GitHub Advisory: GHSA-2fgq-7j6h-9rm4
  • [2]Fix Commit (openclaw/openclaw)
  • [3]SkyPilot Blog: Don't Run OpenClaw on Your Main Machine

More Reports

•31 minutes ago•CVE-2026-47676
5.3

CVE-2026-47676: Inconsistent Path Parsing and Slicing in Hono Framework Sub-Application Mounting

A path parsing and normalization inconsistency vulnerability exists in the Hono web framework prior to version 4.12.21. When hosting sub-applications via the app.mount() routing interface, Hono calculates the routing path prefix length on a percent-decoded representation of the URI but executes the path-slicing offset on the raw, percent-encoded string. This discrepancy results in malformed request paths being dispatched to mounted sub-applications, potentially leading to route bypasses, route confusion, and application-level Denial of Service.

Alon Barad
Alon Barad
2 views•6 min read
•about 3 hours ago•CVE-2026-47706
5.3

CVE-2026-47706: Application-Level Denial of Service via Uncontrolled Recursion in Strawberry GraphQL

An application-level Denial of Service vulnerability exists in the Strawberry GraphQL library (versions 0.71.0 through 0.315.6) due to uncontrolled recursion within the QueryDepthLimiter and MaxAliasesLimiter extensions when processing circular fragment references.

Amit Schendel
Amit Schendel
4 views•6 min read
•about 4 hours ago•CVE-2026-34077
7.5

CVE-2026-34077: Denial of Service and Unsafe Deserialization in React Router Single Fetch

React Router and the underlying turbo-stream vendor library contain a vulnerability allowing remote unauthenticated attackers to trigger a Denial of Service (DoS) or potentially client-side Cross-Site Scripting (XSS) due to unsafe dynamic deserialization of streaming error payloads.

Amit Schendel
Amit Schendel
6 views•6 min read
•about 4 hours ago•CVE-2026-47707
5.3

CVE-2026-47707: GraphQL Alias Amplification Bypass in Strawberry GraphQL MaxAliasesLimiter

A security flaw in strawberry-graphql versions 0.172.0 through 0.315.6 allows unauthenticated attackers to bypass the MaxAliasesLimiter extension. By utilizing GraphQL fragment spreads, clients can trigger high levels of alias amplification, causing uncontrolled backend resource consumption and application-level Denial of Service.

Amit Schendel
Amit Schendel
3 views•5 min read
•about 6 hours ago•CVE-2026-48710
7.0

CVE-2026-48710: Starlette BadHost HTTP Host-Header Path-Poisoning and Authentication Bypass

CVE-2026-48710 is a critical security-desynchronization vulnerability in the Starlette ASGI framework (versions >= 0.8.3, < 1.0.1) that allows remote attackers to bypass path-based security middleware and access-control decorators. By injecting URI authority-to-path delimiters into the Host header, attackers can manipulate the application-level parsed URL path while the underlying ASGI server dispatches the request to target endpoints.

Amit Schendel
Amit Schendel
10 views•7 min read
•about 6 hours ago•CVE-2026-20230
8.6

CVE-2026-20230: Server-Side Request Forgery in Cisco Unified Communications Manager WebDialer Service

CVE-2026-20230 is a critical Server-Side Request Forgery (SSRF) vulnerability in the WebDialer service of Cisco Unified Communications Manager (Unified CM) and Cisco Unified Communications Manager Session Management Edition (Unified CM SME). The flaw arises from improper validation of input parameters within WebDialer HTTP requests. Unauthenticated remote attackers can exploit this vulnerability to force the application to make HTTP requests to internal administrative services bound to the loopback interface. In the Cisco Voice Operating System (VOS) environment, these local services trust loopback traffic inherently, permitting unauthorized file writes. By writing malicious files to specific system directories, the attacker can execute arbitrary commands with root privileges.

Alon Barad
Alon Barad
14 views•6 min read