Summary
OpenClaw versions prior to 2026.2.22 contain a command execution allowlist bypass in the system.run exec analysis logic, which fails to unwrap env and shell-dispatch wrapper chains.
By routing execution through wrapper binaries such as env or bash, an attacker can construct payloads that appear to match allowlisted commands while ultimately executing non-allowlisted programs or arguments.
Affected context
This vulnerability affects OpenClaw deployments that rely on system.run with an allowlist-based command enforcement model.
The issue manifests where OpenClaw analyzes only the apparent top-level binary and arguments, but does not recursively unwrap or normalize wrapper chains such as env, bash, or similar dispatch helpers.
In such environments, policies that assume strict control over which binaries may execute can be silently bypassed when users or automated processes can influence command lines or task definitions.
Exploit preconditions
- Attack surface: Interfaces that trigger
system.runexecution within OpenClaw (e.g., task runners, workflow definitions, job specs, or plugin hooks). - Required access: Ability to define or modify the command, arguments, or scripts that OpenClaw runs—either directly (through configuration) or indirectly (through user-supplied parameters).
- Trigger point: Execution of a command that appears to comply with the allowlist but actually invokes a wrapper binary (e.g.,
env,bash,sh) which then dispatches to a non-allowlisted command or script. - Why exploitation is possible: The exec analysis layer inspects only the initial command token and does not unwrap or resolve wrapper binaries and their subsequent dispatch targets, allowing attackers to "smuggle" disallowed executables behind allowlisted wrappers.
Why this happens
The core issue is an incomplete enforcement of OS command allowlisting, mapping to CWE-78: Improper Neutralization of Special Elements used in an OS Command with an emphasis on inadequate validation of the entire execution path.
OpenClaw's system.run analysis treats the first visible binary as the effective target for allowlist checks, without normalizing or expanding wrapper constructs such as env bash -c '...'.
Because wrappers are often legitimate and may themselves be allowlisted, the analysis fails to account for their role as dispatch mechanisms, enabling hidden non-allowlisted commands to be executed indirectly.
This represents a logical validation bug in the policy enforcement layer: the security decision is made on an incomplete view of the effective command that will ultimately reach the OS.
Potential impact
- Execution of non-allowlisted OS commands that would normally be blocked by policy.
- Circumvention of security controls that rely on command allowlisting for containment.
- Unauthorized access to sensitive files, services, or internal network resources via unintended tools.
- Escalation of impact of other vulnerabilities by enabling arbitrary helper binaries or interpreters.
- Potential lateral movement or persistence if OpenClaw runs with elevated privileges or broad environment access.
General mitigation guidance
Effective mitigation focuses on strengthening command validation, reducing trust in high-level command strings, and constraining the execution environment:
- Normalize and unwrap wrapper chains: Design the exec analysis to recursively inspect and interpret wrapper binaries like
env, shells, and other dispatch helpers, determining the ultimate executable and arguments before allowlist checks are applied. - Policy on interpreters and wrappers: Treat general-purpose dispatchers (e.g.,
/usr/bin/env,/bin/bash,sh, scripting runtimes) as high-risk and either disallow them or restrict their usage to tightly controlled contexts. - Argument-aware allowlisting: Base allowlist decisions on the full command structure (binary plus arguments) rather than just the first token, with clear patterns for acceptable interpreter invocations where needed.
- Least privilege for runners: Run OpenClaw jobs under minimally privileged accounts, limiting file system access, network reach, and available binaries to reduce the blast radius if a bypass occurs.
- Configuration hardening: Restrict who can define or alter system.run commands, use code review or approvals for workflow changes, and avoid dynamic construction of commands from untrusted inputs.
- Defense-in-depth controls: Combine command allowlisting with other controls such as seccomp profiles, containerization, or restricted PATHs to prevent access to unexpected executables.
How teams detect issues like this
Organizations can approach detection through both proactive code-level analysis and runtime monitoring:
- Static analysis and policy checks: Examine code paths and configuration logic around system.run to flag usage patterns that:
- Only check the first command token against an allowlist.
- Treat generic wrappers (
env, shells, interpreters) as inherently safe. - Build OS commands by concatenating untrusted or lightly validated input.
- Code review cues: During manual reviews, scrutinize the implementation of command enforcement and normalization, verifying that:
- Wrapper binaries are resolved and interpreted.
- Interpreters and shells are treated as dispatchers rather than final targets.
- Allowlist rules clearly define what "effective command" means.
- Runtime logging and alerting: Enable detailed logging of executed commands, including the full argument vector, and create alerts for:
- Unexpected use of wrappers or shells in flows that are supposed to run fixed binaries.
- Commands that do not match policy expectations for a given workflow or job type.
- Automated policy enforcement tools: Integrate CI/CD security checks or policy-as-code frameworks that can assert invariants (e.g., "no shell-based dispatch in production workflows") and reject changes that introduce risky patterns.

