NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · OpenClaw

CVE-2026-42427: OpenClaw: HGRCPATH, CARGO_BUILD_RUSTC_WRAPPER, RUSTC_WRAPPER, and MAKEFLAGS missing from exec env denylist — RCE via build tool env injection (GHSA-cm8v-2vh9-cxf3 class)

highCVSS 4.0 8.6GHSA-7437-7hg8-frrw

OpenClaw's exec environment denylist missed four build-tool variables: HGRCPATH, CARGO_BUILD_RUSTC_WRAPPER, RUSTC_WRAPPER and MAKEFLAGS. Hostile values could change how host commands run and lead to code execution. The npm package `openclaw` is fixed in 2026.4.8.

Published Apr 9, 2026 · Updated Apr 28, 2026 · Analysis Oct 30, 2026

What an attacker can do

OpenClaw blocks certain environment variables from reaching commands it runs on the host, because some variables make a tool run other programs. The denylist was incomplete (CWE-184). RUSTC_WRAPPER and CARGO_BUILD_RUSTC_WRAPPER make cargo run a named program in front of the Rust compiler. MAKEFLAGS can alter how make behaves. HGRCPATH points Mercurial at a config file. Any of these can lead the tool to run attacker-chosen code.

If an attacker can get these variables set for an exec call, for instance through a crafted request or prompt that carries an environment map, a later cargo, make or hg command runs their code. The CVSS 4.0 vector is local, low complexity, no privileges and no user interaction, with high impact on confidentiality, integrity and availability. The sources do not spell out how the variables reach the exec path.

The advisory notes OpenClaw is a user-controlled local assistant and does not assume a multi-tenant boundary. It names the same class as an earlier advisory, GHSA-cm8v-2vh9-cxf3.

Who is affected

The npm package openclaw below 2026.4.8 is affected.

npm ls openclaw

For a global install:

npm ls -g openclaw

Setups where OpenClaw runs build tools such as cargo, make or Mercurial are the ones where the missing entries matter.

openclaw

Ecosystem
npm
Affected
< 2026.4.8
Fixed in
2026.4.8
Check
npm ls openclaw

How to fix it

Upgrade to openclaw 2026.4.8.

npm install -g [email protected]

The advisory names commit d7c3210cd6f5fdfdc1beff4c9541673e814354d5 as the verified fixed tree. It lists no workarounds.

How to tell if you were hit

The sources give no indicators. Look in shell history and process logs for cargo, rustc, make or hg runs where RUSTC_WRAPPER, CARGO_BUILD_RUSTC_WRAPPER, MAKEFLAGS or HGRCPATH was set to an unexpected value, and for compiler wrapper processes you did not configure. Check for unfamiliar .hgrc files. Beam records agent shell commands and its rules flag risky ones, so commands with these variables set are visible if an agent ran them.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Impact

HGRCPATH, CARGO_BUILD_RUSTC_WRAPPER, RUSTC_WRAPPER, and MAKEFLAGS missing from exec env denylist — RCE via build tool env injection (GHSA-cm8v-2vh9-cxf3 class).

Missing denylist entries allowed hostile build-tool environment variables to influence host exec commands.

OpenClaw is a user-controlled local assistant. This advisory is scoped to the OpenClaw trust model and does not assume a multi-tenant service boundary.

Affected Packages / Versions

  • Package: openclaw (npm)
  • Affected versions: < 2026.4.8
  • Patched versions: 2026.4.8

Fix

The issue was fixed on main and is available in the patched npm version listed above. The verified fixed tree is commit d7c3210cd6f5fdfdc1beff4c9541673e814354d5.

Verification

The fix was re-checked against main before publication, including targeted regression tests for the affected security boundary.

Credits

Thanks @boy-hack of Tencent zhuque Lab (https://github.com/Tencent/AI-Infra-Guard) for reporting.

Credited to boy-hack.

Questions

Which OpenClaw version fixes CVE-2026-42427?

2026.4.8. All earlier versions are listed as vulnerable.

Which variables were missing from the denylist?

HGRCPATH, CARGO_BUILD_RUSTC_WRAPPER, RUSTC_WRAPPER and MAKEFLAGS.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More OpenClaw vulnerabilities

All OpenClaw entries