CVE-2026-32003: OpenClaw has system.run shell-wrapper env injection via SHELLOPTS/PS4 can bypass allowlist intent (RCE)
OpenClaw up to 2026.2.21-2 lets a caller of `system.run` pass `SHELLOPTS` and `PS4` in the request `env`, which runs extra shell commands before the allowlisted command in `allowlist` mode. Upgrade to openclaw 2026.2.22. The caller must already be able to invoke `system.run` with a custom `env`.
Published Mar 3, 2026 · Updated Mar 30, 2026 · Analysis Oct 31, 2026
What an attacker can do
In allowlist mode, system.run is meant to execute only approved commands. The host env sanitizer blocked startup-file variables such as BASH_ENV and ENV, but not SHELLOPTS or PS4. For shell wrappers like bash -lc, request-scoped env overrides were passed through. With SHELLOPTS=xtrace, bash expands PS4 before it runs each command, so command substitution inside PS4 executes first, ahead of the allowlisted command body.
The result is arbitrary shell execution on the host with the OpenClaw process's rights, outside the allowlist's intent. The attacker needs a privileged position: the CVSS vectors require high privileges. The maintainers say authenticated Gateway callers are trusted operators under their documented trust model, and prompt-injection and multi-operator cases are out of scope. So they rate it medium, though the data here scores it high. The practical risk is any setup where less-trusted users or agents can reach system.run and set env, because the allowlist no longer limits what runs.
Who is affected
openclaw (npm) versions up to and including 2026.2.21-2. The flaw applies when system.run runs in allowlist mode and accepts a request-scoped env for shell wrappers (bash, sh or zsh with -c or -lc). The advisory covers both the Node host and the macOS host paths.
npm ls openclawopenclaw
- Ecosystem
- npm
- Affected
- < 2026.2.22
- Fixed in
- 2026.2.22
- Check
npm ls openclaw
How to fix it
Upgrade to openclaw 2026.2.22:
npm install [email protected]The fix blocks SHELLOPTS and PS4 in the Node and macOS host exec env sanitizers. For shell wrappers it also cuts request env overrides to an explicit allowlist: TERM, LANG, LC_*, COLORTERM, NO_COLOR and FORCE_COLOR. The advisory lists no other workaround. Until you upgrade, restrict who can call system.run with a custom env.
How to tell if you were hit
Search system.run request logs for an env object containing SHELLOPTS or PS4, especially PS4 values with $( or backticks. On hosts, look for unexpected child processes of the shell that system.run started, run before the allowlisted command. Beam records agent shell commands and flags risky ones, which can surface commands that ran outside the intended allowlist.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
system.run allowed SHELLOPTS + PS4 environment injection to trigger command substitution during bash -lc xtrace expansion before the allowlisted command body executed.
Affected Packages / Versions
- Package:
openclaw(npm) - Affected:
<= 2026.2.21-2(includes latest published npm version at triage time) - Patched (planned next release):
2026.2.22
Impact
In allowlist mode, an attacker who can invoke system.run with request-scoped env could execute additional shell commands outside the intended allowlisted command body.
Root Cause
Host exec env sanitization blocked startup-file vectors (BASH_ENV, ENV, etc.) but did not block SHELLOPTS/PS4. For shell wrappers (bash|sh|zsh ... -c/-lc), request env overrides were passed through and bash evaluated PS4 under xtrace, enabling command substitution.
Fix
- Block
SHELLOPTSandPS4in host exec env sanitizers (Node + macOS). - For shell wrappers (
bash|sh|zsh ... -c/-lc), reduce request-scoped env overrides to an explicit allowlist (TERM,LANG,LC_*,COLORTERM,NO_COLOR,FORCE_COLOR). - Add regression tests for TS and macOS paths.
Fix Commit(s)
e80c803fa887f9699ad87a9e906ab5c1ff85bd9a
Release Process Note
patched_versions is pre-set to the planned next release (2026.2.22). Once npm release 2026.2.22 is published, advisory publication is a final state action only.
Severity Rationale
This advisory is rated medium because exploitation requires a caller that can already invoke system.run with request-scoped env.
Under OpenClaw's documented trust model (SECURITY.md), authenticated Gateway callers are treated as trusted operators, and adversarial multi-operator / prompt-injection scenarios are out of scope.
The bug remains a real allowlist-intent bypass, but it does not cross a separate trust boundary in the documented deployment assumptions.
OpenClaw thanks @tdjackey for reporting.
Credited to tdjackey.
Questions
- Does the allowlist stop this attack?
No. The injected command substitution runs during xtrace expansion of
PS4, before the allowlisted command body, so the allowlist check does not cover it.- Who can exploit CVE-2026-32003?
Someone who can already call
system.runwith a request-scopedenv. The maintainers treat authenticated Gateway callers as trusted operators, which is why their own rating is medium.- Which version fixes it?
openclaw 2026.2.22. It blocks
SHELLOPTSandPS4and limits env overrides for shell wrappers to a short list of terminal, locale and color variables.
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 entriesCVE-2026-62197
OpenClaw: Browser CDP discovery could accept blocked WebSocket URLs
medium8.5Oct 21, 2026CVE-2026-35630
OpenClaw: QQBot native approval buttons did not enforce configured approver identity
high8.0Jul 2, 2026CVE-2026-53806
OpenClaw: Combined POSIX shell options could confuse exec revalidation
high8.8Jul 2, 2026CVE-2026-53809
OpenClaw: Embedded runner policy could be confused by provider aliases
medium3.8Jul 2, 2026CVE-2026-53810
OpenClaw's marketplace runtime extension metadata could point at unscanned payloads
high8.8Jul 2, 2026CVE-2026-53811
OpenClaw: Matrix allowFrom could bind to mutable display names
high8.8Jul 2, 2026
