Summary
OpenClaw versions prior to 2026.2.24 contain an approval gating bypass in system.run allowlist mode, where nested transparent dispatch wrappers can evade shell-wrapper detection.
By chaining wrapper binaries such as /usr/bin/env, an attacker may execute /bin/sh -c commands without triggering the expected approval prompt in allowlist plus ask=on-miss configurations.
Affected context
This vulnerability appears in environments that use OpenClaw's system.run with:
- Allowlist-based command control enabled
- ask=on-miss interactive approval for non-allowlisted commands
- Shell or command execution pathways that rely on wrapper detection for policy enforcement
It primarily affects deployments where approval prompts are relied upon to gate access to shell commands or sensitive tooling, and where dispatch helpers like /usr/bin/env or other transparent wrappers are available on the path.
Exploit preconditions
- Attack surface: Interfaces or workflows that invoke OpenClaw system.run with allowlist plus ask=on-miss enforcement (e.g., orchestration jobs, automation hooks, CI/CD tasks, or operator tooling).
- Required access: Ability to submit or influence the command line executed through system.run (such as configuration changes, job specifications, or script contents).
- Trigger point: Execution of commands wrapped via a chain of transparent dispatch helpers (e.g., /usr/bin/env) that ultimately invoke /bin/sh -c or equivalent shell interpreters.
- Why exploitation is possible: The authorization logic evaluates only the outermost or a limited subset of wrappers, failing to correctly classify nested dispatchers as shell wrappers. As a result, the final shell execution path is not recognized as requiring approval, allowing the shell to run without an approval prompt.
Why this happens
The underlying issue is an authorization logic flaw in how OpenClaw classifies and inspects commands under system.run allowlist mode.
The implementation assumes that identifying shell-wrapper binaries at the top level is sufficient to decide whether a command should be allowed or gated. Nested or chained dispatch wrappers (such as /usr/bin/env) are treated as benign, and the evaluation does not consistently resolve through these layers to the ultimate shell interpreter (e.g., /bin/sh -c).
This maps to CWE-863: Incorrect Authorization, where the system performs an access control decision based on incomplete or overly narrow analysis of the action. The policy engine authorizes or skips approval prompts for commands that, after wrapper resolution, violate the intended security policy, enabling execution of shell commands that should have been gated.
Potential impact
- Attackers could launch interactive or scripted shells via /bin/sh -c without triggering the expected approval prompt.
- Users may bypass operational review or change-management controls enforced via ask=on-miss, increasing the risk of unsafe or untracked actions.
- Automation tasks with limited command allowlists could be coerced into running arbitrary shell commands beyond their intended scope.
- Defensive assumptions about who can execute certain shell-based tooling or maintenance commands may no longer hold, potentially facilitating lateral movement or privilege abuse within the environment.
General mitigation guidance
Effective mitigation focuses on hardening authorization logic and reducing reliance on shallow command classification:
- Ensure command evaluation walks through wrapper and dispatch chains to determine the actual target executable (e.g., resolving /usr/bin/env and similar helpers until the effective binary is identified).
- Treat known dispatch utilities (env, nohup, chpst, setsid, and similar wrappers) as transparent layers for policy purposes, applying the same controls as if the underlying shell or tool were invoked directly.
- Prefer explicit, tightly scoped allowlists for executables and disallow generic shells (/bin/sh, /bin/bash, /usr/bin/python -c, etc.) where possible, especially in automation or CI/CD contexts.
- Configure policies to treat invocations that use -c or equivalent "execute command string" flags as high risk, regardless of wrapper usage.
- Apply least-privilege principles to the accounts and roles that can define or modify commands passed into system.run, limiting the ability to introduce new wrapper chains.
- Consider adding a conservative "deny by default on nested wrappers" fallback mode in high-sensitivity environments, so that unexpected wrapper depth triggers a block or at least a mandatory approval.
How teams detect issues like this
Detection approaches can concentrate on policy evaluation paths, command patterns, and configuration drift:
- Use static or configuration analysis to identify OpenClaw system.run usages that:
- Allow wrapper utilities (e.g., /usr/bin/env) while intending to deny or gate shells.
- Permit -c style argument patterns or generic interpreter entry points.
- During code review, flag patterns where:
- Security relies solely on top-level binary names without considering wrapper chains.
- Assumptions are made that env or other dispatch helpers are "safe" while shells are blocked.
- Introduce runtime logging and policy audit trails that capture:
- The fully resolved command chain (each wrapper and the final executable).
- Whether an approval prompt was expected vs. actually triggered.
- Employ automated review tools or policy-as-code frameworks that can:
- Model the effective command after wrapper resolution.
- Enforce organizational rules (e.g., all shell invocations must be logged and approved).
- Periodically simulate or test commands that use common dispatch wrappers in staging environments to validate that policy enforcement behaves as intended.

