Summary
OpenClaw's Browser Relay exposes a /cdp WebSocket endpoint on the local loopback interface without requiring authentication tokens when the extension is installed and enabled.
Malicious websites can connect to this local endpoint and abuse debugging capabilities to steal session cookies and execute JavaScript in other browser tabs, leading to account compromise and cross-tab hijacking.
Affected context
The vulnerability appears when the OpenClaw Browser Relay extension is installed, enabled, and the /cdp WebSocket endpoint is listening on the loopback interface (e.g., ws://127.0.0.1:18792/cdp).
In this configuration, the endpoint implicitly trusts any process that can reach localhost and does not enforce authentication or origin checks.
Environments where users browse untrusted websites while the extension is active are especially exposed, as pages can silently probe and connect to the local debugging endpoint.
Exploit preconditions
- Attack surface: Local WebSocket endpoint bound to 127.0.0.1 on port 18792 under the /cdp path.
- Required access: Ability for a malicious web page or script running in the user's browser to initiate WebSocket connections to localhost (no prior authentication with OpenClaw needed).
- Trigger point: A user visits a crafted website while the OpenClaw Browser Relay extension is installed and enabled, and the endpoint is active.
- Why exploitation is possible: The /cdp endpoint does not validate authentication tokens or enforce strict origin or client verification, treating any loopback connection as trusted and granting access to powerful debugging and session-control operations.
Why this happens
The core issue is a missing authentication check on a privileged local WebSocket endpoint that exposes browser debugging capabilities.
By design, the /cdp (Chrome DevTools Protocol-like) interface can read and manipulate page state, cookies, and JavaScript execution contexts.
Mapping to CWE-306: Missing Authentication for Critical Function, the implementation assumes that connections from 127.0.0.1 are inherently trustworthy and omits explicit token-based or session-bound authentication.
This trust-in-localhost pattern, combined with browsers permitting web content to connect to localhost services, enables untrusted websites to invoke critical functions without any user or extension-level authorization.
Potential impact
- Theft of session cookies from other browser tabs or profiles that Browser Relay can access.
- Execution of arbitrary JavaScript in other tabs, potentially leading to account takeover and data exfiltration.
- Hijacking of active authenticated sessions on web applications accessed via the affected browser.
- Impersonation of the user on sensitive services (email, banking, corporate portals) by leveraging stolen cookies or injected actions.
- Expanded attack surface for chained exploits, where control of other tabs enables phishing or further malware delivery.
General mitigation guidance
Effective mitigation focuses on treating local debugging and relay endpoints as sensitive APIs that require explicit trust and strong authentication:
- Require cryptographically strong authentication tokens or session keys for all connections to the /cdp WebSocket endpoint, independent of the client's IP address.
- Bind debugging endpoints to explicitly trusted clients only (e.g., via OS-level IPC, loopback restrictions combined with per-session secrets, or user-approved pairing flows) rather than assuming localhost is safe.
- Implement strict origin and capability scoping, ensuring that web content cannot directly invoke full debugging capabilities without an out-of-band user consent or extension-mediated approval.
- Apply least-privilege principles to the Browser Relay: limit which tabs, profiles, or cookies can be accessed and segregate sensitive contexts where possible.
- Provide secure-by-default configuration where the debugging endpoint is disabled, firewalled, or locked down until explicitly enabled by an informed user or administrator.
How teams detect issues like this
Detection strategies can focus on both application-level behavior and surrounding environment controls:
- Code review: Examine components that expose local HTTP/WebSocket endpoints, looking for critical operations (debugging, cookie access, script execution) lacking authentication or origin checks.
- Static analysis: Use rules that flag network listeners on loopback interfaces combined with sensitive operations (cookie access, DevTools protocol handlers, remote execution APIs) when no authentication or authorization logic is present.
- Runtime monitoring: Instrument the Browser Relay or host environment to log and alert on WebSocket connections to /cdp, especially when initiated from browser processes or unrecognized clients.
- Policy enforcement: Adopt secure coding policies that forbid unauthenticated debug or control endpoints and require documented threat models for any localhost exposure from browser extensions or desktop agents.

