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·28 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

•2 days ago•GHSA-7PPR-R889-MCF2
7.5

GHSA-7PPR-R889-MCF2: Unbounded WebSocket Message Aggregation in http4s-blaze-server leads to Denial of Service

An uncontrolled resource consumption vulnerability exists in the Scala-based http4s-blaze-server package of the http4s/blaze library. The vulnerability allows remote, unauthenticated attackers to cause an Out of Memory Error (OOM) and JVM crash by streaming a continuous sequence of small or empty WebSocket continuation frames with the FIN bit set to 0. This bypasses typical payload size checks because of the JVM's per-object allocation overhead, leading to rapid heap exhaustion with minimal network bandwidth.

Alon Barad
Alon Barad
7 views•5 min read
•2 days ago•GHSA-95CV-R8X4-VH75
7.6

GHSA-95cv-r8x4-vh75: Path Traversal Vulnerability in OpenList Batch Rename Handler

A critical path traversal vulnerability has been identified in the OpenList Go-based backend package. The vulnerability exists within the batch rename handler because the application does not validate the source filename parameter before constructing filesystems paths. This omission allows authenticated users to escape their designated directory and rename files in sibling paths.

Amit Schendel
Amit Schendel
9 views•7 min read
•3 days ago•GHSA-P6PH-3JX2-3337
4.3

GHSA-P6PH-3JX2-3337: Horizontal Privilege Escalation and Metadata Information Disclosure via Bleve Search in OpenList

OpenList version 4.2.3 and prior is vulnerable to an authorization bypass and metadata leakage. When configured with the Bleve search engine backend, OpenList fails to perform separator-aware path matching when validating tenant containment. This allows authenticated users to access sibling directories sharing similar name prefixes. Furthermore, the search backend returns unfiltered global result counts, leaking existence verification data of unauthorized files via side-channel analysis.

Amit Schendel
Amit Schendel
8 views•5 min read
•3 days ago•GHSA-86CX-WWF4-PHQ4
6.5

GHSA-86cx-wwf4-phq4: Path Prefix Confusion Authorization Bypass in OpenList

An authorization bypass vulnerability in OpenList version 4.2.3 and below allows authenticated users to read arbitrary files outside of their designated base directories due to an insecure path prefix check using Go's standard strings.HasPrefix function.

Amit Schendel
Amit Schendel
7 views•6 min read
•3 days ago•CVE-2026-16584
7.0

CVE-2026-16584: Security Policy Bypass in AWS API MCP Server via Startup Initialization Failure

A security policy bypass vulnerability exists in the AWS API MCP Server (awslabs-aws-api-mcp-server) from version 0.2.13 through 1.3.46. When the server fails to load the read-only operations index during startup (due to transient network failures, file permission issues, or other exceptions), it logs a warning but continues running in an insecure, degraded state. Under this condition, the security policy engine fails open, silently skipping all subsequent security checks and consent prompts for the lifetime of the process. This permits unauthorized mutating AWS CLI commands to execute via indirect prompt injection attacks.

Amit Schendel
Amit Schendel
12 views•7 min read
•3 days ago•GHSA-6V4M-FW66-8R4X
6.5

GHSA-6V4M-FW66-8R4X: Path Disclosure and Shell Expansion Bypass in Shescape

An incomplete escaping vulnerability in the npm package 'shescape' allows unauthenticated users to trigger dynamic shell expansions, absolute path disclosure, and command block break-outs on Unix and Windows systems.

Alon Barad
Alon Barad
6 views•7 min read