/

CVE-2026-28463

Severity:

HIGH RISK

(8.4)

OS Command Injection in OpenClaw Exec-Approvals Allowlist

CVE-2026-28463

Modified

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Local File Disclosure via Shell Command Injection

Severity:

HIGH RISK

(8.4)

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's exec-approvals allowlist validates command arguments before shell expansion, but the actual execution occurs with real shell expansion semantics.

This mismatch allows authorized callers or prompt-injection driven requests to use seemingly safe commands (e.g., head, tail, grep) together with glob patterns or environment variables to read arbitrary local files accessible to the gateway or node process when host execution is enabled.

Affected context

The vulnerability appears in OpenClaw deployments that:

  • Enable host execution behind the exec-approvals gateway
  • Rely on an allowlist of "safe" binaries (e.g., head, tail, grep) for command execution
  • Perform validation on pre-expansion argv tokens while ultimately invoking a real system shell that performs globbing and environment variable expansion

It primarily affects environments where untrusted or partially trusted inputs (including LLM or prompt-driven tools) can influence the arguments to these allowed commands.

Exploit preconditions

  • Attack surface: Exec-approvals gateway or any interface that can trigger host command execution in allowlist mode.
  • Required access:
  • Ability to submit commands or arguments through an approved caller, API, or workflow; or
  • Capability to influence prompts or tool instructions that the system converts into shell commands (prompt injection).
  • Trigger point: Execution of an allowlisted binary through the gateway when its arguments include shell-metacharacters, glob patterns (*, ?, []), or environment variable references ($VAR, ${VAR}).
  • Why exploitation is possible: The validation logic inspects the unexpanded argv tokens as though they will be used directly, but the underlying execution path invokes a real shell that performs expansion. As a result, malicious file patterns or variable references can bypass validation and cause the allowed command to operate on arbitrary local files.

Why this happens

This issue stems from a classic OS command injection pattern mapped to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

The security model assumes that validating the raw argv tokens is sufficient to constrain behavior, but those tokens are later passed through a shell that performs additional processing (globbing, variable expansion). Because the validation does not reason about the post-expansion form and does not neutralize shell metacharacters, attackers can craft arguments that are benign in pre-expansion form yet expand to sensitive file paths or content sources at execution time. The core design flaw is mixing shell semantics with application-level access control while validating only a subset of the effective command behavior.

Potential impact

  • Disclosure of arbitrary local files readable by the gateway or node process (e.g., application logs, config files, API keys, tokens).
  • Exposure of secrets embedded in environment variables via expanded references.
  • Leakage of system metadata (e.g., /proc, /etc) that can assist in further attacks or lateral movement.
  • Violation of intended allowlist boundaries, where "safe" commands become powerful data exfiltration tools.
  • Potential chaining with other vulnerabilities or misconfigurations to escalate impact beyond file disclosure.

General mitigation guidance

Effective mitigation focuses on removing shell semantics from the execution path and tightening the trust boundary around arguments:

  • Prefer direct exec-style APIs (e.g., execve/posix_spawn, subprocess with shell disabled) that do not invoke a system shell or perform globbing or environment variable expansion.
  • Treat all user-controlled and prompt-controlled arguments as untrusted; perform strict allowlisting of both commands and argument patterns, not just binary names.
  • Normalize and validate arguments in the exact form they will be executed, avoiding any implicit transformations after validation.
  • Limit the file system exposure of the gateway or node process by running with least privilege, constrained working directories, and restricted access to sensitive paths.
  • Consider introducing an intermediate policy layer that only allows references to approved resources (e.g., specific directories or file types) instead of arbitrary paths.
  • Reduce reliance on environment-variable derived secrets for processes that can be reached via exec-approvals, preferring separate, tightly scoped secret stores.

How teams detect issues like this

To detect and monitor for this class of issue:

  • Use static analysis and code review to flag:
  • Any execution paths that call out to a shell (e.g., system(), popen(), subprocess with shell=True) from within allowlist or approval logic.
  • Validation routines that inspect argv but later pass values to shell-based runners without re-validation.
  • Add explicit checks in CI/CD pipelines to prevent introduction of shell-based execution for security-sensitive gateways.
  • Instrument logging around exec-approvals:
  • Record the full, post-expansion command where feasible (with careful handling of sensitive data).
  • Alert on suspicious patterns such as wildcards targeting sensitive directories (/etc, /var, ~/.).
  • Apply policy-based scanners or security linters that enforce "no shell execution in control-plane components" as an organizational rule.

Sources

SourceLink
github.comgithub.com/openclaw/openclaw/commit/77b89719d5b7e271f48b6f49e334a8b991468c3b
github.comgithub.com/openclaw/openclaw/security/advisories/GHSA-xvhf-x56f-2hpp
vulncheck.comvulncheck.com/advisories/openclaw-arbitrary-file-read-via-shell-expansion-in-safe-bins-allowlist

Frequently asked

questions

It can be, depending on how OpenClaw's exec-approvals interface is exposed. If remote users, services, or LLM-powered tools can submit commands or arguments to the gateway, then exploitation can occur remotely over the network.

The attacker must either be an authorized caller capable of invoking the allowlisted commands or have influence over a workflow (such as prompt injection against an LLM or automation pipeline) that ultimately feeds arguments into the exec-approvals interface. Direct shell access is not required.

The most robust fix is to eliminate shell-based execution entirely for allowlisted commands, executing binaries directly with no globbing or environment-variable expansion, and to apply strict, argument-level allowlisting in the same form used at runtime.

Design execution gateways so that validation and execution operate on the exact same semantics: avoid hidden shell layers, forbid special shell characters in untrusted inputs by default, enforce least-privilege filesystem access, and adopt secure coding guidelines that prohibit shell invocation in security-sensitive control paths.

Find out what's already
exploitable in your codebase.