Home/Research/Post

GHSA-j7r2-xppq-m353: websocket-driver: Memory exhaustion triggered by small fragment frames holding long-lived references to TCP reads

  • Severity: HIGH
  • CVE: CVE-2026-140000
  • Ecosystems: npm
  • Packages: websocket-driver

### Summary

With the default configuration options, an unauthenticated remote client is able to force the server to retain large `Buffer` objects in memory far longer than necessary, by sending it a series of small fragment frames embedded in larger chunks of TCP input. This can cause substantial memory inflation and lead to the server running out of memory and crashing.

### Details

`websocket-driver` handles incoming TCP input via a `pipe()` call that feeds `Buffer` objects read from a TCP stream into the driver. A class named `StreamReader` stores the sequence of received buffers in an array and its `read(length)` method is used by the parser to consume arbitrary-sized chunks of the input stream.

If the requested `length` is smaller than the length of the first `Buffer` in the input queue, the `Buffer.slice()` method is used to take a reference to a slice of that `Buffer` without copying it. Since `slice()` takes a reference to the source `Buffer`, the source is not garbage collected until all slices taken from it are dropped.

A client can abuse this by embedding a 1-byte fragmented message frame in a larger chunk of TCP input, for example a long sequence of pong frames. The parser will take a 4-byte slice for the frame mask and a 1-byte slice for the frame payload, and these slices will internally reference the original TCP read input. Since the fragments are buffered indefinitely until either the message is completed or the total of the 1-byte fragments exceeds `maxL…

Source: GitHub Security Advisories · 2026-12-03