undici cut v8.1.0 on April 13, 2026 with a new maxPayloadSize option for its WebSocket client. The same author cut v6.25.0 the same day with the same option and the same commit subject line, feat: add configurable maxPayloadSize for WebSocket (#4955). v6.25.0's ByteParser.run() consulted this.#fragmentsBytes against this.#maxPayloadSize on both the compressed path and the uncompressed path. v8.1.0's version of the same function maintained #fragmentsBytes on every fragment write and never read it on the uncompressed path. CVE-2026-9675 is the eight weeks during which a malicious WebSocket server could stream sixty-byte fragments at a client with a hundred-byte limit until the client's heap ran out.
CVE-2026-9675: undici's 6.x Port of PR #4955 Had the Cumulative Check. The 8.x Port Did Not.
vendor
patterns
cve
proof of concept
The patch is one line, and the variable was already in the file.
The v8.5.0 fix to lib/web/websocket/receiver.js, committed as b4c287b3 by Matteo Collina on June 8, 2026:
#validatePayloadLength () {
if (
this.#maxPayloadSize > 0 &&
!isControlFrame(this.#info.opcode) &&
- this.#info.payloadLength > this.#maxPayloadSize
+ this.#info.payloadLength + this.#fragmentsBytes > this.#maxPayloadSize
) {
failWebsocketConnection(this.#handler, 1009, 'Payload size exceeds maximum allowed size')
return false
}
return true
}#fragmentsBytes is not a new field. It was declared at line 27 of the same file in the same PR that introduced maxPayloadSize. It was incremented on every call to writeFragments(), which the receiver calls for every frame body it consumes:
writeFragments (fragment) {
this.#fragmentsBytes += fragment.length
this.#fragments.push(fragment)
}The class wrote into #fragmentsBytes every time it accepted a frame body. The gate at #validatePayloadLength(), called from each of the three payload-length-decoding states (7-bit, 16-bit, 64-bit), compared only the current frame's payloadLength against #maxPayloadSize and stopped. The state needed to enforce the cumulative limit was in the object the whole time. The condition that reads it against the limit was not.
The compressed path read #fragmentsBytes. The uncompressed path did not.
Inside ByteParser.run() at the READ_DATA state, the receiver branches on this.#info.compressed. The two branches are sister branches. Both handle a single frame's body. Both call writeFragments(). Both check whether the FIN bit is set. Both transition the state machine back to INFO for the next frame. In v8.4.1, only one of them consulted #fragmentsBytes.
The uncompressed branch:
if (!this.#info.compressed) {
this.writeFragments(body)
// If the frame is not fragmented, a message has been received.
// If the frame is fragmented, it will terminate with a fin bit set
// and an opcode of 0 (continuation), therefore we handle that when
// parsing continuation frames, not here.
if (!this.#info.fragmented && this.#info.fin) {
websocketMessageReceived(this.#handler, this.#info.binaryType, this.consumeFragments())
}
this.#state = parserStates.INFO
}The compressed branch, fifteen lines below it in the same function:
} else {
this.#extensions.get('permessage-deflate').decompress(
body,
this.#info.fin,
(error, data) => {
if (error) {
const code = error instanceof MessageSizeExceededError ? 1009 : 1007
failWebsocketConnection(this.#handler, code, error.message)
return
}
this.writeFragments(data)
// Check cumulative fragment size
if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
failWebsocketConnection(this.#handler, 1009, new MessageSizeExceededError().message)
return
}
if (!this.#info.fin) {
this.#state = parserStates.INFO
this.#loop = true
this.run(callback)
return
}
websocketMessageReceived(this.#handler, this.#info.binaryType, this.consumeFragments())
this.#loop = true
this.#state = parserStates.INFO
this.run(callback)
},
this.#fragmentsBytes
)
}The compressed branch carries an explicit comment, // Check cumulative fragment size, naming the concern the receiver is supposed to enforce. The same concern applies to the uncompressed branch. The check is not there. This is the parallel-implementation-gap shape at its smallest grain: not two adapters in two files for two runtimes, but two arms of an if/else inside one function, sharing the same private field, with one arm consulting the field against the configured limit and the other arm not.
The CVSS vector reads AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H. The attacker is the WebSocket server the client opens. The class of victim is any Node.js application that calls new WebSocket(url, ...) against a server it does not fully control and trusts the maxPayloadSize knob to bound its heap: server-side fetches of third-party WebSocket APIs, webhook delivery loops, observability shippers, MCP transports, plugin-marketplace gateways. For every such application running undici 8.0.0 through 8.4.1, the knob was advisory on the uncompressed fragmented path. The application configured a hundred-byte ceiling and the receiver allowed sixty-five thousand frames of sixty bytes each.
The 6.x port of the same PR had both checks.
The April 13, 2026 commit that introduced the feature on the 8.x line, bd91f867 feat: add configurable maxPayloadSize for WebSocket (#4955), has a sibling on the 6.x line: d7a1e55f feat: add configurable maxPayloadSize for WebSocket (#4955). Same author. Same commit subject. Same PR reference. Committed within seconds of each other on the same Monday at 06:59 UTC. The two commits diverge in lib/web/websocket/receiver.js. The 6.x port's READ_DATA handler:
} else {
if (!this.#info.compressed) {
this.writeFragments(body)
if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
failWebsocketConnection(this.ws, new MessageSizeExceededError().message)
return
}
if (!this.#info.fragmented && this.#info.fin) {
websocketMessageReceived(this.ws, this.#info.binaryType, this.consumeFragments())
}
this.#state = parserStates.INFO
} else {
this.#extensions.get('permessage-deflate').decompress(
body,
this.#info.fin,
(error, data) => {
if (error) {
failWebsocketConnection(this.ws, error.message)
return
}
this.writeFragments(data)
if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
failWebsocketConnection(this.ws, new MessageSizeExceededError().message)
return
}
// ...Both branches in the 6.x port carry the four-line #maxPayloadSize > 0 && #fragmentsBytes > #maxPayloadSize check immediately after writeFragments(). v6.25.0 enforced cumulative payload size on uncompressed fragmented messages from the day the feature shipped. v8.1.0 did not. The two ports were committed to the repository inside the same minute.
The 7.x line is unaffected for a different reason. The maxPayloadSize option was never ported there. v7.x clients have no cumulative bound because they have no per-frame bound either. The CVE record names 8.0.0 through 8.4.x because that is the range where the option exists, advertises a limit, and lets the application configure a knob that does not function on fragmented uncompressed input. Six.x has the same option and the limit is enforced; seven.x has no option; eight.x had the option without the enforcement.
This is the backport-gap shape from a different angle. The pattern's earlier exhibits, Apache MINA's 2.0.28 / 2.1.11 / 2.2.6 release and FreeBSD's setcred(2) fix sitting in main since November, describe a fix authored once and propagated to some maintenance branches and not others. CVE-2026-9675 describes the inverse direction. A feature was authored once and propagated to two branches on the same day. The safety check that came with the feature shipped intact on one port and was stripped from the other. The CVE record covers the branch that received the abridged port. The patch logic that closes it had been running in production on the 6.x branch for eight weeks before the v8.5.0 fix landed.
The PoC is the test the maintainer wrote.
The same b4c287b3 commit that adds + this.#fragmentsBytes to the gate adds a regression test the bug class did not have. The test is also the proof of concept the advisory does not include:
test('cumulative payload size', (t, done) => {
t.plan(1)
const LIMIT = 100
const FRAGMENT_SIZE = 60
const NUM_FRAGMENTS = 10
const server = new WebSocketServer({ port: 0 })
server.on('connection', (ws) => {
const socket = ws._socket
const payload = Buffer.alloc(FRAGMENT_SIZE, 0x41)
for (let i = 0; i < NUM_FRAGMENTS; i++) {
const fin = i === NUM_FRAGMENTS - 1 ? 0x80 : 0x00
const opcode = i === 0 ? 0x02 : 0x00
const header = Buffer.alloc(2)
header[0] = fin | opcode
header[1] = FRAGMENT_SIZE
socket.write(header)
socket.write(payload)
}
})
const agent = new Agent({ webSocket: { maxPayloadSize: LIMIT } })
const client = new WebSocket(`ws://127.0.0.1:${server.address().port}`, { dispatcher: agent })
client.onmessage = t.assert.fail
client.addEventListener('error', (event) => {
t.assert.ok(event)
done()
})
})The server writes ten frames by hand at the socket level. The first frame's first byte is 0x02, a binary opcode with FIN unset. The next eight frames' first bytes are 0x00, a continuation opcode with FIN unset. The tenth frame's first byte is 0x80, a continuation opcode with FIN set. Every frame declares a 60-byte payload. The configured maxPayloadSize is 100 bytes. Each frame, on its own, passes #validatePayloadLength(): 60 is not greater than 100. The cumulative payload is six hundred bytes, six times the configured limit. Before the patch, client.onmessage would be invoked with the full assembled six-hundred-byte buffer; the test's client.onmessage = t.assert.fail would fire and the test would fail. After the patch, client.addEventListener('error') fires partway through the fragment stream and the test passes.
The numbers in the test are pedagogical. A production attacker chooses 60 and 65,000 instead of 60 and 10, sends frames at line rate, and watches the Node.js process's resident-set climb past the configured ceiling until the kernel kills it. The application's WebSocket bound was 100 bytes. The receiver buffered as many bytes as the attacker chose to send. The limit was advisory.
The advisory credits the bug to mauriceng98 and Str1ckl4nd. Neither reporter had to read code the maintainer had not already written. The cumulative-bytes counter was being maintained correctly inside ByteParser on every frame the v8.1.0 client ever received. The condition that compares it against the configured ceiling was sitting in lib/web/websocket/receiver.js on the 6.x branch the entire time, in the version of READ_DATA shipped by the same feat: add configurable maxPayloadSize for WebSocket (#4955) subject line.
The branch that shipped the bug is the one that holds the variable.
v8.5.0 unifies the two former 6.x checks into the single per-frame gate at #validatePayloadLength(). The architectural shape is cleaner than the 6.x version: one comparison, one place, both compressed and uncompressed branches covered because they both pass through the same gate before the body is read. The 6.x branch will, in time, presumably be refactored to match. For now, two of undici's three live maintenance lines enforce maxPayloadSize across fragments through different mechanisms in different files in different commits, and the third never had the option at all. The PR that shipped the feature shipped two ports of the same change. One of the ports is what the CVE is about.
The check was in the file. It was on the wrong branch's port.