Summary
Prior to version 2026.2.14, OpenClaw's Gateway tool accepted tool-supplied gatewayUrl values without adequate validation, allowing callers to direct the OpenClaw host to initiate outbound WebSocket connections to arbitrary targets.
Under conditions where a caller can influence gatewayUrl and observe responses, this behavior can be abused for network reachability probing and, in some cases, further interaction with internal services that speak WebSocket.
Affected context
This vulnerability affects OpenClaw deployments that:
- Use the Gateway tool or tools that indirectly pass
gatewayUrloverrides, and - Allow authenticated operators, automation, or other callers to influence
gatewayUrl, and - Run OpenClaw in environments where the host can reach internal or sensitive network targets (e.g., localhost services, private network ranges, cloud metadata endpoints).
In typical setups, only trusted operators or automation can trigger these tool calls; however, in deployments where tool invocation is exposed to less-trusted or external users, the risk expands to include semi-trusted or untrusted callers.
Exploit preconditions
- Attack surface: Tool invocation paths that accept a
gatewayUrloverride, either directly or via higher-level tools. - Required access: Ability to invoke the affected tool(s) with attacker-controlled
gatewayUrlvalues. This is usually limited to authenticated operators or trusted automation, unless the deployment explicitly exposes these capabilities more broadly. - Trigger point: Passing a crafted
gatewayUrlthat is subsequently used by the Gateway WebSocket client to establish an outbound connection. - Why exploitation is possible: The implementation trusted caller-supplied
gatewayUrlwithout validating it against an allowlist of known-safe endpoints, protocols, or host/port combinations. As a result, the OpenClaw host could be instructed to attempt WebSocket connections to arbitrary locations, including internal or otherwise unreachable-from-the-internet services.
Why this happens
The root cause aligns with CWE-918: Server-Side Request Forgery (SSRF). The Gateway WebSocket client logic treated the tool-supplied gatewayUrl as a trusted endpoint and did not sufficiently constrain it to known gateway addresses or safe patterns.
Conceptually, this is an unvalidated remote endpoint selection issue: code that constructs outbound network requests (WebSocket connections in this case) accepts caller-controlled URLs without applying scheme, host, port, or path restrictions. When running on a host with access to private, loopback, or metadata networks, this pattern allows an attacker with request-injection capability to pivot through the server and probe or communicate with internal services that are not otherwise exposed.
Potential impact
- The OpenClaw host may attempt connections to attacker-specified endpoints, including:
- Localhost-only services running on the same machine
- Internal/private network services (e.g.,
10.x.x.x,192.168.x.x,172.16-31.x.x) - Cloud provider metadata or control-plane IPs
- Callers who can see connection results may use the behavior for:
- Network reachability and port probing via success/failure, error types, or timing
- Limited banner or protocol interaction with internal WebSocket-speaking services
- In specialized environments, if an internal WebSocket service processes messages in a sensitive way, this could contribute to:
- Unauthorized interaction with internal APIs
- Chaining with other vulnerabilities on internal services (e.g., misconfigured WebSocket endpoints)
- Potential leakage of coarse-grained network topology information (which hosts or addresses the OpenClaw host can reach).
General mitigation guidance
Effective mitigation focuses on constraining outbound connection targets and treating caller-supplied URLs as untrusted:
- Prefer a design where the Gateway client connects only to:
- A fixed, configured gateway endpoint, or
- A tightly constrained set of allowlisted hosts and ports.
- Apply strict URL validation on any user- or tool-supplied network endpoint:
- Enforce allowed schemes (e.g.,
ws:///wss://only). - Restrict to expected hostnames or IP ranges; reject private/loopback/metadata ranges unless explicitly required and carefully controlled.
- Disallow embedded credentials, query strings, fragments, and non-root paths if they are not essential to the protocol.
- Treat loopback and private network targets as sensitive resources:
- Avoid exposing generic "connect to any host/port" capabilities via tool parameters.
- Ensure any internal network access from OpenClaw follows the principle of least privilege.
- Where possible, separate roles:
- Use configuration-only mechanisms (not per-request input) to define gateway endpoints.
- Avoid mixing operator-level configuration capabilities with routine tool invocation parameters.
How teams detect issues like this
Detection can combine code-centric and runtime perspectives:
- Static analysis and code review:
- Search for code paths where network/WebSocket clients accept caller-provided URLs or hosts without validation or allowlisting.
- Flag patterns where:
- URL strings are passed directly from tool parameters or request bodies into connection constructors.
- There is no clear enforcement of allowed schemes, hosts, or ports.
- Highlight functions that construct outbound connections using generic URL parameters in shared libraries or platform components.
- Configuration and policy enforcement:
- Define policies that require all outbound gateway connections to originate from configuration, not dynamic user input.
- Use linters or security checks in CI to block changes that introduce new unvalidated network targets.
- Runtime monitoring:
- Monitor egress traffic from OpenClaw hosts for unusual or unexpected destinations (e.g., metadata IPs, atypical private ranges, non-standard ports).
- Use network-level egress controls (firewalls, security groups) to block sensitive target ranges and log attempted access.

