/

CVE-2026-28470

Severity:

CRITICAL RISK

(9.8)

Command Injection / Shell Metacharacter Injection

CVE-2026-28470

Modified

Vulnerability type

Category:

Command Injection / Shell Metacharacter Injection

CWE:

CWE-78

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

OpenClaw versions prior to 2026.2.2 contain a command injection vulnerability in the exec approvals allowlist feature, where shell command substitution within double-quoted strings is not safely handled.

By embedding unescaped $() or backtick syntax in approved commands, an attacker can bypass the allowlist and execute arbitrary, unauthorized commands on the underlying system.

Affected context

This vulnerability arises in OpenClaw deployments that:

  • Have the exec approvals feature enabled
  • Rely on an allowlist to restrict which commands can be executed
  • Build or pass commands through a shell where command substitution ($() or backticks) is interpreted

The issue typically manifests where user-controlled input is interpolated into shell commands or command templates and only the outer command is validated, while embedded substitutions are not constrained or sanitized.

Exploit preconditions

  • Attack surface: Interfaces that trigger command execution through OpenClaw's exec approvals mechanism (e.g., web UI actions, APIs, or automation hooks that end up invoking shell commands).
  • Required access: Ability to submit or influence command strings that are subject to the exec allowlist check (such as specifying parameters, command arguments, or templates).
  • Trigger point: Execution of an "approved" command that contains double-quoted segments with embedded $() or backtick expressions.
  • Why exploitation is possible: The allowlist validation focuses on the top-level command string and does not neutralize or block shell command substitution operators. When executed in a shell context, these operators are evaluated, allowing attacker-controlled subcommands to run despite the apparent allowlist restrictions.

Why this happens

The underlying issue is improper neutralization of special elements in command strings, aligning with CWE-78 (Improper Neutralization of Special Elements used in an OS Command) and CWE-88 (Argument Injection or Modification).

OpenClaw's exec approvals allowlist appears to validate only the high-level command or its leading tokens, without accounting for nested shell syntax that can introduce additional commands.

By placing $() or backticks inside double-quoted strings, an attacker can inject additional OS commands that the shell evaluates at runtime, effectively bypassing the allowlist and resulting in arbitrary command execution under the privileges of the OpenClaw process or associated service account.

Potential impact

  • Execution of arbitrary OS commands under the OpenClaw runtime user, which can lead to full system compromise.
  • Reading, modifying, or deleting sensitive data accessible to the OpenClaw host or connected systems.
  • Installing backdoors, cryptocurrency miners, or other persistent malware on the affected host.
  • Moving laterally to other systems or services reachable from the compromised environment.
  • Tampering with build, deployment, or operational pipelines that depend on OpenClaw, enabling further supply-chain impacts.

General mitigation guidance

Effective mitigation focuses on removing shell interpretation from user-controlled input and constraining command execution:

  • Prefer APIs or libraries that execute commands without involving a generic shell (e.g., using direct system calls or parameterized process execution APIs that accept argument arrays rather than raw command strings).
  • If a shell must be used, rigorously neutralize or disallow command substitution operators ($(), backticks) and other metacharacters in any user-controlled segments, and enforce strict patterns for allowed arguments.
  • Design allowlists around structured operations rather than raw command strings; map high-level actions to fixed, server-side command templates with no direct interpolation of attacker-controlled data into shell-executed segments.
  • Apply least-privilege principles to the OpenClaw runtime environment so that the executing process has minimal system access, reducing the blast radius of any injection that does occur.
  • Consider sandboxing or containerizing the execution environment with restricted capabilities to limit file system and network access.

How teams detect issues like this

Detection typically combines code-level analysis with runtime monitoring:

  • Use static analysis or manual code review to identify places where OpenClaw constructs shell commands from user-controlled input, particularly where exec approvals or allowlists are implemented via string matching rather than structured execution.
  • Look for patterns such as:
  • Passing concatenated strings to generic shell interpreters (e.g., /bin/sh -c, system, popen, or similar APIs).
  • Allowlist checks that only inspect the prefix or a subset of a command, without parsing or validating nested syntax.
  • Absence of explicit handling or rejection of $(), backticks, or other metacharacters in user input.
  • Implement runtime logging and monitoring around all exec approvals to detect unusual command patterns, especially commands containing $(, `, semicolons, or other chaining operators.
  • Integrate security scanning tools that include rules for OS command injection and shell metacharacter misuse into CI/CD pipelines to prevent reintroduction of similar patterns.

Sources

SourceLink
github.comgithub.com/openclaw/openclaw/commit/d1ecb46076145deb188abcba8f0699709ea17198
github.comgithub.com/openclaw/openclaw/security/advisories/GHSA-3hcm-ggvf-rch5
vulncheck.comvulncheck.com/advisories/openclaw-exec-allowlist-bypass-via-command-substitution-in-double-quotes

Frequently asked

questions

Yes, if OpenClaw is exposed through remote interfaces (such as a web UI or API) that allow users to submit or influence commands passed through exec approvals. In such cases, attackers may exploit the issue over the network without local access to the host.

An attacker must be able to reach a feature or workflow that invokes the exec approvals mechanism and accept attacker-influenced command content. This may require authenticated access depending on how OpenClaw is deployed and what permissions are needed to trigger approved commands.

The most robust fix is to eliminate shell-based execution of untrusted input altogether by using structured command execution APIs that accept argument arrays and do not perform shell parsing. Additionally, the allowlist logic should be redesigned to operate on structured actions or fixed command templates, rather than free-form command strings.

Establish secure coding patterns that prohibit direct interpolation of user-controlled data into shell commands, enforce strict validation and encoding of any inputs that influence command execution, and apply defense-in-depth controls such as least-privilege, sandboxing, and automated security checks in development pipelines to catch shell metacharacter misuse early.

Find out what's already
exploitable in your codebase.