CVE-2026-41392: OpenClaw: Shell init-file options could satisfy exec allowlist script matching
OpenClaw before 2026.3.31 can treat a shell wrapper call that uses --rcfile, --init-file or --startup-file as if the approved script were being run. The shell loads an attacker-chosen init file first, so the exec allowlist is bypassed. Upgrade to 2026.3.31.
Published Apr 7, 2026 · Updated May 6, 2026 · Analysis Oct 30, 2026
What an attacker can do
OpenClaw's exec approvals can allowlist a script, or remember an approval with allow-always. For a command like bash script.sh, the matcher in src/infra/exec-approvals-allowlist.ts finds the script path among the arguments and compares it with the allowlist. The function resolveShellWrapperScriptCandidatePath did not account for shell options that load another file first.
Take a command shaped like bash --rcfile scripts/evilrc approved.sh. The shell sources evilrc before the script. The matcher still saw approved.sh and accepted the call on the strength of the allowlist entry. The equals form, --rcfile=scripts/evilrc, worked the same way.
This matters only where exec allowlist or allow-always is on, and where the attacker can steer the shape of a shell wrapper command, for example through a prompt-injected agent that builds the command line. It also needs a file with attacker content to exist where the shell can read it. The maintainers call it a narrower bypass, not generic command execution from an untrusted boundary. The outcome is that commands run which the operator never approved.
Who is affected
openclaw on npm, every version before 2026.3.31, with exec allowlist or allow-always behavior enabled. Check the installed version:
npm ls openclawUse npm ls -g openclaw for a global install. If you do not use allowlist matching for exec approvals, this path does not apply.
openclaw
- Ecosystem
- npm
- Affected
- < 2026.3.31
- Fixed in
- 2026.3.31
- Check
npm ls openclaw
How to fix it
Upgrade to openclaw 2026.3.31 or later:
npm install [email protected]Commit 0c8375424620e12777ef24c162eedc7e9fcfd7e3 adds a list of disqualifying options (--rcfile, --init-file, --startup-file), in space-separated and equals forms. When one appears, the script path is no longer a candidate for allowlist matching. The advisory lists no workaround. Until you upgrade, review allow-always entries and remove ones you do not need.
How to tell if you were hit
Search exec approval history and shell command logs for bash or other shell calls that include --rcfile, --init-file or --startup-file, with or without an equals sign. Review the allow-always entries stored in your OpenClaw config and any init files the agent could write. Beam records the shell commands an agent runs, and its rules can flag shell invocations with init-file options.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
Before OpenClaw 2026.3.31, exec allowlist matching could treat shell init-file wrapper invocations as if the approved script itself were being executed. Shell options such as --rcfile, --init-file, and --startup-file could therefore inherit allowlist trust from a matched script path even though the shell loaded attacker-chosen initialization first.
Impact
This issue only applied when exec allowlist or allow-always behavior was enabled and the attacker could steer a shell-wrapper command shape that used init-file options. The result was a narrower allowlist bypass, not generic arbitrary command execution from an untrusted boundary.
Affected Packages / Versions
- Package:
openclaw(npm) - Affected versions:
< 2026.3.31 - Patched versions:
>= 2026.3.31 - Latest published npm version:
2026.4.1
Fix Commit(s)
0c8375424620e12777ef24c162eedc7e9fcfd7e3— reject shell init-file script matches
Release Process Note
The fix shipped in OpenClaw 2026.3.31 on March 31, 2026. The current published npm release 2026.4.1 from April 1, 2026 also contains the fix.
Thanks @cyjhhh for reporting.
Credited to cyjhhh.
Questions
- Which OpenClaw version fixes CVE-2026-41392?
2026.3.31. The advisory also confirms that 2026.4.1 contains the fix.
- Is this arbitrary command execution?
The maintainers say no. It is a narrower allowlist bypass that applies only when allowlist or allow-always is enabled and the attacker can shape a shell wrapper command with init-file options.
- Which options are involved?
--rcfile, --init-file and --startup-file. The fix rejects them in both the separate-argument and the equals form.
References
Read for this analysis:
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
