/

CVE-2026-25593

Severity:

HIGH RISK

(8.4)

Command Injection in OpenClaw Gateway WebSocket API

CVE-2026-25593

Analyzed

Vulnerability type

Category:

Command Injection

CWE:

CWE-78, CWE-306

Impact:

Arbitrary Command Execution as Gateway User

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 versions prior to 2026.1.20 contain a command injection vulnerability where an unauthenticated local client can abuse the Gateway WebSocket API to write configuration and set a malicious cliPath.

When this unsafe cliPath is later used for command discovery, attacker-controlled shell commands may be executed with the privileges of the gateway user.

Affected context

The issue arises in OpenClaw deployments where the Gateway WebSocket API is reachable by local processes and accepts unauthenticated requests.

Specifically, it affects instances that:

  • Expose the Gateway WebSocket API on the local system
  • Allow config.apply operations without robust authentication or authorization checks
  • Use the cliPath configuration value for command discovery or execution without proper sanitization

In such environments, any local user or process capable of connecting to the WebSocket endpoint may influence how external commands are located and run.

Exploit preconditions

  • Attack surface: Local machine, via the Gateway WebSocket API endpoint.
  • Required access: Ability to open a WebSocket connection to the Gateway as a local client (no authentication required in the vulnerable configuration).
  • Trigger point: Invocation of config.apply to write configuration, including a crafted cliPath value that is later consumed by the command discovery logic.
  • Why exploitation is possible: The API trusts configuration updates from unauthenticated local clients (CWE-306) and later uses the attacker-controlled cliPath directly in OS command contexts without robust validation or escaping (CWE-78).

Why this happens

The vulnerability stems from a combination of missing authentication for a sensitive configuration operation and unsafe handling of configuration data when invoking OS commands.

The Gateway WebSocket API allows config.apply calls without enforcing strong authentication or authorization, which aligns with CWE-306: Missing Authentication for Critical Function.

The cliPath configuration field, once set, is later used in command discovery or execution logic, effectively assembling shell or process invocation parameters from untrusted input.

Because this value is not constrained to safe paths or sanitized to prevent interpretation as arbitrary shell syntax, it falls under CWE-78: Improper Neutralization of Special Elements used in an OS Command, enabling command injection.

Potential impact

  • Execution of arbitrary OS commands as the gateway user.
  • Reading, modifying, or deleting data accessible to the gateway account.
  • Installing or running additional malware or persistence mechanisms on the host.
  • Pivoting to other processes or services reachable from the compromised gateway.
  • Interference with or manipulation of OpenClaw assistant behavior via compromised environment or tooling.

General mitigation guidance

Effective mitigation relies on tightening both configuration trust boundaries and command execution patterns:

  • Require authentication and, where appropriate, authorization checks for any configuration-modifying API, especially those that affect command paths or execution behavior.
  • Treat all configuration values that influence execution (such as cliPath) as untrusted until validated, even when they originate from local clients.
  • Constrain cliPath and similar fields to a restricted set of allowed binaries or directories (allowlists) instead of accepting arbitrary strings.
  • Avoid passing configuration values through a shell; prefer direct execution of fixed binaries with explicit argument lists, and avoid string concatenation for building commands.
  • Run the gateway service under a minimally privileged account and apply OS-level hardening (e.g., filesystem permissions, application sandboxing) to limit damage if a command is compromised.

How teams detect issues like this

Organizations can look for this class of issue using a mix of code-level and operational signals:

  • Static analysis and code review:
  • Flag APIs that modify configuration (e.g., config.apply) when they are callable without authentication or live on locally exposed ports.
  • Search for places where configuration values are used to construct command-line strings or passed into shell-executing functions (exec, popen, or equivalent) without clear validation.
  • Review for any dynamic command discovery mechanisms that rely on user- or client-controlled paths.
  • Policy and testing:
  • Enforce security review for any feature that adjusts execution paths or tooling configuration.
  • Include tests that attempt to inject shell metacharacters or unexpected paths via configuration channels and verify they are rejected or safely handled.
  • Runtime monitoring:
  • Monitor gateway processes for unusual child process trees, unexpected binaries executing, or anomalous command-line patterns.
  • Correlate configuration changes over the WebSocket API with subsequent process launches to detect suspicious sequences.

Sources

SourceLink
github.comgithub.com/openclaw/openclaw/security/advisories/GHSA-g55j-c2v4-pjcg

Frequently asked

questions

The vulnerability, as described, is exploitable by unauthenticated local clients that can reach the Gateway WebSocket API. Remote exploitation would generally require an additional vector to gain local code execution or the ability to connect to the local endpoint.

An attacker needs the ability to establish a WebSocket connection to the Gateway on the affected system. No authentication is required on the vulnerable endpoint, so any local user or process with network access to that socket may attempt exploitation.

Enforce strong authentication and authorization for configuration-changing operations, and ensure that configuration values cannot directly dictate which commands or binaries are executed. Paths like cliPath should be constrained to vetted options, and command execution should avoid shells and string concatenation.

Treat configuration as untrusted input regardless of its origin, require authentication for all critical administrative APIs, and adopt a design where execution paths and tools are selected from controlled allowlists. Complement this with regular security reviews, static analysis focused on command execution and configuration APIs, and tests that attempt to inject malicious values through configuration interfaces.

Find out what's already
exploitable in your codebase.