@anephenix/hub Unauthenticated WebSocket RPC Waiter Resource Exhaustion (CVE-None)
An unauthenticated Denial-of-Service vulnerability in `@anephenix/hub` versions prior to 0.2.16 allows attackers to exhaust server CPU and memory resources by opening numerous WebSocket connections and ignoring server-initiated RPC messages, leading to unbounded timers and heap entries.
A high-severity unauthenticated Denial-of-Service (DoS) vulnerability exists in the @anephenix/hub Node.js library, affecting all versions prior to 0.2.16. This flaw arises because the server initiates a setInterval polling loop and accumulates pending RPC request objects for every incoming WebSocket connection. Specifically, if a remote client fails to reply to the server's get-client-id RPC, these timers and corresponding request objects are never cleaned up, even after the WebSocket connection is terminated. An unauthenticated attacker can exploit this by establishing a large number of WebSocket connections and deliberately ignoring server RPC messages. This action causes the server to accumulate an unbounded number of setInterval timers and heap entries, leading to severe CPU and memory exhaustion and rendering the @anephenix/hub server unavailable to legitimate clients. The vulnerability does not require any authentication or specialized headers, making it easily exploitable.
Attack Chain
- An unauthenticated client establishes a WebSocket connection to the
@anephenix/hubserver. - The server's connection listener, registered in
src/lib/index.ts:128, invokesrequestClientIdfor the newly established WebSocket (src/lib/index.ts:262). requestClientIdthen callsrpc.sendto issue aget-client-idRPC request to the client (src/lib/clientId.ts:112).- The RPC request payload is pushed onto the server's
this.requestsarray withinrpc.send(src/lib/rpc.ts:282), marking it as a pending request. - Inside
rpc.send,waitForReplyis invoked, which starts asetIntervaltimer polling every 10 ms to check for a matching reply in theresponses[]array (src/lib/rpc.ts:250). - The attacker's client deliberately ignores the server's
get-client-idRPC message and then closes the WebSocket connection without sending any reply. - Due to the absence of a reply, the
setIntervaltimer and the corresponding entry inthis.requestsare not cleared, leading to a resource leak within the server process. - The attacker repeats this process with numerous connections, causing an accumulation of unbounded timers and heap objects, ultimately leading to CPU and memory exhaustion and a Denial of Service.
Impact
This is an unauthenticated Denial-of-Service (DoS) vulnerability affecting any network-reachable @anephenix/hub server running with default configurations. Exploitation allows an attacker to exhaust the server's CPU and memory resources by forcing it to accumulate an ever-increasing number of setInterval timers and heap entries. Each unanswered WebSocket connection contributes one setInterval timer (polling every 10 ms) and one heap object that is never released. As more connections are made and then silently dropped, the server's resource consumption spirals, leading to performance degradation and eventually making the server unresponsive or unavailable to legitimate clients. No complex authentication, headers, or protocol knowledge is required for successful exploitation.
Recommendation
- Upgrade
@anephenix/hubto version 0.2.16 or higher immediately to address the vulnerability. - Monitor server resource utilization (CPU, memory) for
@anephenix/hubinstances to detect anomalous spikes that could indicate a DoS attack. - Implement application-layer logging for WebSocket RPC requests and responses to track incomplete transactions that may indicate exploitation of this vulnerability.