Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2026-41373

CVE-2026-41373: OpenClaw RCE Vulnerability

CVE-2026-41373 is a remote code execution vulnerability in OpenClaw that allows attackers to execute arbitrary code by overriding compiler binaries during build processes. This article covers technical details, affected versions, impact, and mitigation strategies.

Published:

CVE-2026-41373 Overview

OpenClaw before version 2026.3.31 contains an incomplete host-env-security-policy.json configuration that fails to restrict compiler binary environment variables. This vulnerability allows untrusted models to substitute critical compiler environment variables including CC, CXX, CARGO_BUILD_RUSTC, and CMAKE_C_COMPILER via environment overrides. Attackers with approved host-exec requests can leverage this flaw to override compiler binaries and execute arbitrary code during build processes.

Critical Impact

Attackers can execute arbitrary code by substituting compiler binaries during build processes through unrestricted environment variable overrides.

Affected Products

  • OpenClaw versions prior to 2026.3.31

Discovery Timeline

  • 2026-04-28 - CVE CVE-2026-41373 published to NVD
  • 2026-04-28 - Last updated in NVD database

Technical Details for CVE-2026-41373

Vulnerability Analysis

This vulnerability is classified as CWE-427 (Uncontrolled Search Path Element), where the security policy configuration fails to properly restrict environment variables that control compiler binary paths. The incomplete host-env-security-policy.json policy omitted critical compiler-related environment variables from its blocklist, creating a gap in the security sandbox.

When untrusted models execute build processes through approved host-exec requests, they can inject malicious values for compiler environment variables. Since build systems like Make, CMake, and Cargo rely on these environment variables to locate compiler binaries, an attacker can redirect compilation to execute arbitrary malicious binaries instead of legitimate compilers.

The attack requires local access and an approved host-exec request, which limits the attack surface but still poses a significant risk in multi-tenant or shared build environments where untrusted code may be compiled.

Root Cause

The root cause is an incomplete security policy configuration in host-env-security-policy.json. The original policy blocked various dangerous environment variables related to Git, shell configuration, and other utilities, but failed to include compiler-related environment variables in its blocklist. This oversight allowed the CC, CXX, CARGO_BUILD_RUSTC, CMAKE_C_COMPILER, and CMAKE_CXX_COMPILER variables to be overridden by untrusted models.

Attack Vector

An attacker with an approved host-exec request can exploit this vulnerability by:

  1. Setting malicious values for compiler environment variables (CC, CXX, CARGO_BUILD_RUSTC, CMAKE_C_COMPILER)
  2. Triggering a build process that relies on these environment variables
  3. The build system invokes the attacker-controlled binary instead of the legitimate compiler
  4. Arbitrary code execution occurs with the privileges of the build process

The following patch adds the missing compiler environment variables to the security policy blocklist:

text
     "GIT_EXEC_PATH",
     "GIT_SEQUENCE_EDITOR",
     "GIT_TEMPLATE_DIR",
+    "CC",
+    "CXX",
+    "CARGO_BUILD_RUSTC",
+    "CMAKE_C_COMPILER",
+    "CMAKE_CXX_COMPILER",
     "SHELL",
     "SHELLOPTS",
     "PS4",

Source: GitHub Commit Reference

Detection Methods for CVE-2026-41373

Indicators of Compromise

  • Unexpected values set for CC, CXX, CARGO_BUILD_RUSTC, CMAKE_C_COMPILER, or CMAKE_CXX_COMPILER environment variables during build processes
  • Build logs showing compiler binary paths pointing to non-standard locations
  • Unusual process spawning patterns during compilation operations
  • Evidence of environment variable manipulation in host-exec request logs

Detection Strategies

  • Monitor environment variable assignments during host-exec requests for compiler-related variables
  • Implement logging for all build process invocations and verify compiler binary paths match expected locations
  • Deploy file integrity monitoring on known compiler binary locations
  • Audit host-exec request approvals and track which environment variables are being set

Monitoring Recommendations

  • Enable verbose logging for all host-exec requests and build operations
  • Configure alerts for environment variable overrides targeting CC, CXX, CARGO_BUILD_RUSTC, CMAKE_C_COMPILER, or CMAKE_CXX_COMPILER
  • Review build process audit logs for anomalous compiler binary invocations
  • Implement runtime monitoring for unexpected process execution during compilation

How to Mitigate CVE-2026-41373

Immediate Actions Required

  • Upgrade OpenClaw to version 2026.3.31 or later immediately
  • Review recent host-exec requests for any suspicious environment variable overrides
  • Audit build logs for evidence of compiler binary substitution
  • Temporarily restrict host-exec permissions until the patch is applied

Patch Information

The vulnerability has been addressed in OpenClaw version 2026.3.31. The fix adds CC, CXX, CARGO_BUILD_RUSTC, CMAKE_C_COMPILER, and CMAKE_CXX_COMPILER to the blocked environment variables list in host-env-security-policy.json. The patch is available via commit e277a37f896b5011a1df06e6490c6630074d0afa.

For additional details, refer to the GitHub Security Advisory and the VulnCheck Advisory.

Workarounds

  • Manually add the missing compiler environment variables to your host-env-security-policy.json blocklist if immediate upgrade is not possible
  • Restrict host-exec request approvals to trusted sources only
  • Implement additional access controls around build processes
  • Consider running builds in isolated environments with fixed compiler paths
bash
# Verify OpenClaw version
openclaw --version

# Check if your security policy includes compiler env blocks
grep -E "(CC|CXX|CARGO_BUILD_RUSTC|CMAKE_C_COMPILER|CMAKE_CXX_COMPILER)" /path/to/host-env-security-policy.json

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.