/

CVE-2026-28460

Severity:

HIGH RISK

(7.1)

OS Command Injection / Shell Command Injection

CVE-2026-28460

Modified

Vulnerability type

Category:

OS Command Injection / Shell Command Injection

CWE:

CWE-78

Impact:

Execution of Non-Allowlisted / Arbitrary Shell Commands

Severity:

HIGH RISK

(7.1)

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.22 contain an OS command injection vulnerability in system.run, where the shell command allowlist can be bypassed using crafted line-continuation sequences.

By injecting $\\ followed by a newline and an opening parenthesis inside double quotes, an attacker can transform benign-looking input into executable command substitution, enabling non-allowlisted commands to run despite security checks.

Affected context

This vulnerability manifests in environments where OpenClaw:

  • Invokes shell commands via system.run under an allowlist-based security model
  • Passes user-controlled or indirectly influenced input into shell command strings
  • Relies on static or naive parsing of command text to enforce which commands are permitted

The issue is specifically triggered when double-quoted segments of a command can contain shell metacharacters, including $, backslash, and newline, which are later interpreted by the shell in a way not reflected in the allowlist analysis.

Exploit preconditions

  • Attack surface: Any OpenClaw feature, plugin, or integration that calls system.run with attacker-controlled or attacker-influenced command arguments.
  • Required access: Ability to supply or modify strings that are passed into system.run (e.g., configuration fields, project definitions, scripts, or workflow parameters).
  • Trigger point: Execution of system.run where:
  • The application performs allowlist checks on the static command text, and
  • The shell eventually interprets the final command line, including line continuations and command substitution.
  • Why exploitation is possible: The allowlist logic analyzes the "visible" command string but does not model how the shell normalizes $\\ + newline + ( inside double quotes. The shell folds this into active command substitution syntax at runtime, effectively injecting a new command path that was never evaluated against the allowlist.

Why this happens

The root cause is an OS command injection pattern (CWE-78) combined with incomplete modeling of shell parsing semantics in the security allowlist.

system.run relies on textual allowlist checks to decide which commands are permissible, assuming that the checked string will be executed as-is. However, POSIX-like shells perform multiple transformations—such as line continuation processing, quote handling, and command substitution—after the allowlist decision. Attackers exploit this gap by embedding $\\ followed by a newline and ( inside double quotes, producing input that looks harmless during static analysis but is interpreted as command substitution by the shell.

Conceptually, this is a mismatch between security validation on a pre-processed representation and actual interpretation by the execution environment, allowing untrusted data to cross trust boundaries and influence which commands are ultimately executed.

Potential impact

  • Execution of non-allowlisted commands that would ordinarily be blocked by security policies
  • Escalation of attacker capabilities within the OpenClaw runtime environment
  • Unauthorized access to files, environment variables, or network resources reachable from the OpenClaw host
  • Tampering with build, test, or deployment pipelines that depend on OpenClaw automation
  • Lateral movement to other systems if the compromised environment has additional credentials or network trust

General mitigation guidance

Effective mitigation focuses on eliminating direct shell interpretation of untrusted strings and aligning validation with the true execution semantics:

  • Prefer APIs that bypass the shell entirely (e.g., structured command execution where arguments are passed as arrays) instead of constructing shell command strings.
  • Treat all user-controllable data as untrusted, even when wrapped in quotes, and avoid concatenating it into command text that will be parsed by a shell.
  • When an allowlist is required:
  • Implement checks on a structured representation of the command (e.g., parsed tokens or discrete arguments) rather than raw strings.
  • Normalize or reject inputs that contain shell metacharacters ($, backslash, backticks, (), |, &, ;, newlines) in contexts where only simple arguments are expected.
  • Apply least privilege to any process spawned via system.run, using restricted accounts and minimal file/system access to reduce the impact of misuse.
  • Centralize command execution logic so security checks and parsing rules are consistent, rather than duplicating them across the codebase.

How teams detect issues like this

Detection generally involves identifying unsafe command construction patterns and ensuring shell semantics are explicitly modeled:

  • Static analysis:
  • Flag any use of system.run (or analogous wrappers) where raw strings are constructed via concatenation, interpolation, or templating with user input.
  • Detect presence of shell metacharacters and line-continuation sequences (\ followed by newline) within quoted segments that originate from untrusted sources.
  • Code review signals:
  • Command allowlist logic that operates on raw strings without a formal parser.
  • Reliance on quoting or escaping alone as a security control for untrusted input.
  • Inconsistent handling of whitespace, newlines, or backslashes when building shell commands.
  • Policy and tooling:
  • Introduce coding standards that require argument-vector based command execution and prohibit dynamic shell string evaluation for untrusted data.
  • Use automated review tools or custom linters to enforce safe command execution APIs and highlight deviations from the policy.

Sources

SourceLink
github.comgithub.com/openclaw/openclaw/commit/3f0b9dbb36c86e308267924c0d3d4a4e1fc4d1e9
github.comgithub.com/openclaw/openclaw/security/advisories/GHSA-9868-vxmx-w862
vulncheck.comvulncheck.com/advisories/openclaw-allowlist-bypass-via-shell-line-continuation-command-substitution-in-system-run

Frequently asked

questions

It can be, depending on how OpenClaw is integrated. If remote users or external systems can control inputs that are ultimately passed into system.run, exploitation can occur over the network; otherwise, it may be limited to local or authenticated users who can influence those inputs.

The attacker must be able to supply or modify data that flows into the system.run command string—such as configuration values, scripts, workflow definitions, or parameters—without that data being normalized or rejected before execution.

The most robust pattern is to avoid shell-based execution of dynamically constructed strings altogether and use structured command invocation with explicit argument lists. If the shell must be used, commands should be parsed into a structured form that is validated and never reinterpreted in a way that introduces new syntax.

Adopt a design rule that untrusted input is never directly interpreted by a shell, enforce standard command execution APIs across the codebase, and incorporate security reviews and static analysis that understand shell semantics. Combining these with clear coding guidelines for command execution helps prevent new allowlist-bypass paths from emerging.

Find out what's already
exploitable in your codebase.