Cross-Origin WebSocket Hijacking in Cline Hub Dashboard
The Cline Hub dashboard fails to validate Origin headers and bypasses authorization when no secret is configured, allowing malicious websites to hijack local WebSocket connections to execute arbitrary code.
The Cline Hub dashboard server ('@cline/cline-hub'), typically initiated via the cline dashboard CLI command, contains a critical security flaw involving Cross-Origin WebSocket Hijacking (CSWSH). In its default configuration, the dashboard binds to 127.0.0.1 without requiring a ROOM_SECRET. Under these conditions, the server's isAuthorizedBrowserRequest() function returns true for all requests and performs no validation of the HTTP Origin header during the WebSocket upgrade process.
This vulnerability allows any malicious website visited by a developer running the Cline dashboard to open a WebSocket connection to ws://127.0.0.1:8787/browser. Once connected, the attacker can interact with the Cline session as if they were a legitimate user. This includes the ability to inject malicious MCP server configurations, modify tool approval policies, and command agent sessions to perform unauthorized actions such as file system manipulation or arbitrary command execution on the host machine. Because dashboard sessions default to auto-approving tools, this process requires no victim interaction beyond simply visiting a compromised page.
Attack Chain
- The victim starts
cline dashboardlocally, which defaults to127.0.0.1:8787without aROOM_SECRET. - The attacker lures the victim to a malicious website containing a cross-origin WebSocket payload.
- The victim's browser initiates a WebSocket connection request to
ws://127.0.0.1:8787/browser. - The Cline Hub dashboard server receives the request, identifies the missing secret, and unconditionally approves the connection, ignoring the
Originheader. - The attacker's script sends a
desktopCommandframe of typeupsert_mcp_serverover the established WebSocket. - The server processes the frame and writes a malicious
stdioMCP server entry to$CLINE_DATA_DIR/settings/cline_mcp_settings.json. - Upon the next invocation or activation of the MCP server by the Cline agent, the injected command is executed with the privileges of the victim's local user account.
Impact
Successful exploitation allows for full command execution on the developer's local machine, potential exfiltration of sensitive session tokens or API keys, and persistent compromise via the injection of malicious MCP server entries into the developer's configuration files. This impacts any environment where developers use the default dashboard settings, posing a significant risk to individual workstations and the local development ecosystem.
Recommendation
- Ensure that the
ROOM_SECRETenvironment variable is always explicitly set for any instance of the Cline dashboard to enforce mandatory authentication. - Implement local firewall rules or browser security extensions to restrict WebSocket connections to
127.0.0.1to authorized origins only. - Regularly audit
$CLINE_DATA_DIR/settings/cline_mcp_settings.jsonfor unexpected entries or suspiciousstdiocommands. - Avoid running the
cline dashboardin environments where untrusted browser activity is expected.
Immediate actions
Review local developer environments for instances of cline-hub running without ROOM_SECRET
Mitigations
Mandate ROOM_SECRET environment variable for all cline dashboard deployments
CSWSH vulnerability in cline-hub