T09 · Insecure Skill Coding Practices
- Location
relay-client.cjs:11- Finding
Authentication Token Can Be Transmitted over an Unencrypted WebSocket Connection
- Content
View full analysis
{ ws.send(JSON.stringify({ type: 'auth', token: opts.token, agent_id: opts.agentId })); }); ``` ### Technical Analysis The client accepts arbitrary WebSocket URLs and does not enforce encrypted `wss://` transport. Once the connection opens, it sends the relay authentication token and agent identifier in an authentication message. The default plaintext endpoint is a loopback address, which is generally appropriate for local development. However, the `--url` option and `CLAW_RELAY_URL` environment variable can specify a non-loopback `ws://` endpoint without any validation or warning. When that occurs, authentication credentials and subsequent browser-control messages are transmitted without transport encryption. An attacker with access to the network path could observe or modify WebSocket traffic. The documentation recommends a `wss://` production endpoint, but documentation alone does not provide runtime protection against configuration mistakes. ### Attack Path 1. A user or Agent configures `CLAW_RELAY_URL` or `--url` with a remote `ws://` address. 2. The client opens an unencrypted WebSocket connection to that relay. 3. The client sends the relay token and agent ID in the authentication frame. 4. An attacker positioned on the local network, proxy, gateway, or another relevant network segment captures the frame. 5. The attacker extracts the token and attempts to authenticate to the relay as the affected agent. 6. If the token ...[truncated 787 chars]- Remediation
View remediation
