The vulnerability exists in the @openclaw/voice-call package, where the media stream WebSocket endpoint accepted connections before performing any validation. This created a window for unauthenticated clients to open and hold idle connections, leading to a resource exhaustion (denial-of-service) vulnerability. The core of the issue lies in the MediaStreamHandler class, which is responsible for managing these WebSocket connections.
The analysis of the patch commit 1d8968c8a821ff1a05c294a1846b3bcb6f343794 reveals several key changes that address this vulnerability:
-
Pre-Upgrade Connection Capping: The MediaStreamHandler.handleUpgrade function, which is the initial entry point for a new WebSocket connection, was modified to check the total number of current connections against a new maxConnections limit before upgrading the HTTP request to a WebSocket connection. Previously, it would upgrade any request unconditionally.
-
Pending Connection Management: The MediaStreamHandler.handleConnection function, which executes after a connection is established, was updated to register the new connection in a 'pending' state. The new registerPendingConnection logic enforces limits on the number of pending connections both globally (maxPendingConnections) and per source IP (maxPendingConnectionsPerIp). It also sets a timeout (preStartTimeoutMs) to automatically close connections that do not successfully authenticate by sending a valid start message within a specified time.
-
Safe URL Parsing: In the VoiceCallWebhookServer, the event handler for WebSocket upgrades was hardened to parse the request URL more safely, preventing potential crashes from malformed URLs.
These changes collectively fix the vulnerability by ensuring that incoming connections are strictly managed and validated at multiple stages, preventing the resource exhaustion that was previously possible.