CVE-2026-41373
Received Received - Intake
Environment Variable Override in OpenClaw Enables Arbitrary Code Execution

Publication date: 2026-04-28

Last updated on: 2026-05-01

Assigner: VulnCheck

Description
OpenClaw before 2026.3.31 contains an incomplete host-env-security-policy.json that fails to restrict compiler binary environment variables, allowing untrusted models to substitute CC, CXX, CARGO_BUILD_RUSTC, and CMAKE_C_COMPILER via environment overrides. Attackers with approved host-exec requests can override compiler binaries to execute arbitrary code during build processes.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-04-28
Last Modified
2026-05-01
Generated
2026-05-07
AI Q&A
2026-04-28
EPSS Evaluated
2026-05-05
NVD
EUVD
Affected Vendors & Products
Showing 1 associated CPE
Vendor Product Version / Range
openclaw openclaw to 2026.3.31 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-427 The product uses a fixed or controlled search path to find resources, but one or more locations in that path can be under the control of unintended actors.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

CVE-2026-41373 is a vulnerability in OpenClaw versions before 2026.3.31 caused by an incomplete host-env-security-policy.json file. This incomplete policy fails to restrict certain environment variables related to compiler binaries, specifically CC, CXX, CARGO_BUILD_RUSTC, and CMAKE_C_COMPILER. Because of this, attackers who already have approved host execution permissions can override these environment variables to substitute the compiler binaries with malicious ones. This allows them to execute arbitrary code during build processes.

The vulnerability is classified under CWE-427 (Uncontrolled Search Path Element), meaning that the system uses a search path to locate resources but some parts of that path can be manipulated by unauthorized actors. The issue was fixed in OpenClaw version 2026.3.31 by blocking these dangerous environment variables and sanitizing the host execution environment to prevent such overrides.


How can this vulnerability impact me? :

This vulnerability can impact you by allowing an attacker with approved host execution permissions to substitute compiler binaries during build processes. By overriding environment variables like CC, CXX, CARGO_BUILD_RUSTC, and CMAKE_C_COMPILER, the attacker can execute arbitrary or malicious code within the build environment.

Such arbitrary code execution can lead to compromise of the build process, potentially injecting malicious code into software builds, affecting software integrity and trustworthiness. This poses a moderate security risk, especially in environments where build processes are critical and trusted.


How can this vulnerability be detected on my network or system? Can you suggest some commands?

This vulnerability involves environment variables such as CC, CXX, CARGO_BUILD_RUSTC, and CMAKE_C_COMPILER being overridden to substitute compiler binaries during build processes. Detection involves checking if these environment variables are set to unexpected or untrusted paths during host execution requests.

One way to detect potential exploitation is to inspect the environment variables in build or host-exec processes to see if any of these compiler override variables are set. For example, you can run commands to print these variables in the environment where builds occur.

  • Check environment variables in the shell or build environment: `echo $CC`, `echo $CXX`, `echo $CARGO_BUILD_RUSTC`, `echo $CMAKE_C_COMPILER`
  • Use process inspection tools to check environment variables of running build processes, e.g., `ps eww <pid>` or `cat /proc/<pid>/environ | tr '\0' '\n' | grep -E 'CC|CXX|CARGO_BUILD_RUSTC|CMAKE_C_COMPILER'` on Linux.
  • Monitor build logs or scripts for unexpected compiler paths or commands that differ from standard system compilers.

What immediate steps should I take to mitigate this vulnerability?

The primary mitigation is to upgrade OpenClaw to version 2026.3.31 or later, where the vulnerability is fixed by blocking dangerous compiler environment variables.

If upgrading immediately is not possible, you should ensure that environment variables such as CC, CXX, CARGO_BUILD_RUSTC, CMAKE_C_COMPILER, and CMAKE_CXX_COMPILER are not set or overridden in any host execution or build environment.

Additionally, restrict or audit host-exec requests to prevent untrusted models or users from executing builds with overridden environment variables.

  • Upgrade OpenClaw to version 2026.3.31 or later.
  • Sanitize or unset compiler override environment variables (CC, CXX, CARGO_BUILD_RUSTC, CMAKE_C_COMPILER, CMAKE_CXX_COMPILER) before build execution.
  • Audit and restrict host execution permissions to trusted users and processes only.

Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart