Automated Threat Modeling

Overview of CVE-2026-123866: Node.js HTTP/2 Use After Free Exposes Response Memory, with Patch Analysis

A brief summary of CVE-2026-123866, a use after free in Node.js HTTP/2 stream teardown that can send freed or unrelated heap memory, including other connections' response data, to a peer. Covers the root cause, affected release lines, and the fix shipped in Node.js 22.23.5, 24.22.3 and 26.13.1.

CVE Analysis

9 min read

Gaurav Sarraf
Gaurav Sarraf

2026-11-11

Overview of CVE-2026-123866: Node.js HTTP/2 Use After Free Exposes Response Memory, with Patch Analysis

Introduction

A Node.js HTTP/2 server that is slow to flush a response can, under the right teardown conditions, send a peer bytes that were never meant for it, including fragments of other connections' responses. The trigger can be an ordinary per-stream idle timeout on every supported branch, and a peer-controlled RST_STREAM on recent 24.x and 26.x releases. That makes CVE-2026-123866 a cross-connection data exposure issue, and it is best treated as one rather than as a crash bug.

The OpenJS CNA scored the issue at CVSS 3.0 7.5 with the vector CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N: network reachable, low complexity, no privileges, no user interaction, high confidentiality impact, and no scored integrity or availability impact. NVD has not supplied an independent assessment. Fixes shipped on November 11, 2026 in Node.js 22.23.5, 24.22.3 and 26.13.1. The Node.js advisory does not report exploitation in the wild, and Cyber Kendra reported no public proof of concept as of the release date.

Technical information

Root cause: buffer lifetime was tied to write completion

The weakness is CWE 416, Use After Free. A response buffer is released during HTTP/2 stream teardown while a pending socket write still references it, so the socket transmits whatever now lives at that address instead of the intended response.

Two code paths in src/node_http2.cc combine to create the condition.

1. Queuing in Http2Stream::DoWrite(). When JavaScript writes a response chunk to an HTTP/2 stream, each buffer is placed into the stream's queue_ as an NgHttp2StreamWrite. That entry holds a uv_buf_t (a raw pointer and a length) and, optionally, a strong reference named req_wrap to the JavaScript write request that owns the memory. Before the patch, only the last buffer of a request received that reference. It did double duty: it kept the memory alive and it signaled that the write was finished. Every earlier buffer in the same request was just a raw pointer with nothing keeping it alive.

2. Slicing in Http2Session::OnSendData(). When nghttp2 asks for fewer bytes than the head buffer holds, Node.js slices off length bytes and pushes the slice into the session's outgoing socket write, again as a bare uv_buf_t with no owner.

On their own these are harmless as long as the stream outlives the socket write. The problem appears when it does not:

  • The socket is backpressured, so the outgoing write containing the slices stays pending.
  • The stream is destroyed, either by a peer RST_STREAM or by the server's own per-stream timeout.
  • The stream's write request completes, JavaScript drops the Buffer, and the garbage collector is free to reclaim it.
  • The socket still holds pointers into that memory. When it drains, whatever now occupies those addresses is sent to the peer: freed memory, or another connection's response data.

The upstream commit message puts it directly: destroying the stream "allows those buffers to be collected while the socket still references them."

Why backpressure is the key precondition

Backpressure is ordinary behavior rather than a separate bug, and it is the state in which this defect lives. Node.js documents that response.write() returns false when some or all data remains queued in user memory, followed by a drain event once the buffer clears. In that window, data has been handed off but not yet flushed to the socket, and stream teardown can free the memory out from under the pending write.

Attack flow

Based on the advisory and the upstream regression test, the sequence looks like this:

  1. A peer connects to an affected Node.js HTTP/2 server and causes a response write to stay backpressured, for example by not reading from the connection so the server's outgoing socket write remains pending.
  2. Response DATA for the target stream is sitting in that pending socket write as unowned slices or unowned queued buffers.
  3. The stream is torn down. On 24.x and 26.x releases that contain the window-size change from 24.22.0 and 26.9.0, the peer can drive this directly, for example with RST_STREAM. On all supported lines, including 22.x, an application-initiated teardown such as a per-stream idle timeout reaches the same defect.
  4. Teardown completes the write request, the Buffer becomes unreachable, and garbage collection can free it. The heap may then reuse that memory for other allocations, including other connections' responses.
  5. When the peer resumes reading, the socket drains and transmits the bytes currently at the stale addresses.

The sources establish that disclosure is possible and that the disclosed memory can belong to other connections. They do not establish a guaranteed disclosure size, a reliable way to select a specific victim connection's data, or a published reproducible exploit. The record also does not describe code execution or modification of other connections' responses.

For exposure analysis, assess both remote peer cancellation and application-driven destruction. Looking only for attacker-supplied resets would miss the separately documented timeout path, which is why 22.x is affected even though the advisory does not attribute the newer peer-driven path to that line.

Patch information

The fixed releases are Node.js 22.23.5, 24.22.3 and 26.13.1, all published on November 11, 2026. Each release's changelog lists CVE-2026-123866 under the commit title "http2: retain buffers until socket writes finish" (Matteo Collina), which came through private security PR #1017. The backported commits are:

  • 22.x (v22.23.5): 6cd7e80d68
  • 24.x (v24.22.3): 7be19aa614 (full hash 7be19aa6140db9feaf3bca5198b26c64c3c61b67)
  • 26.x (v26.13.1): 7df134e2ce

The same security release also contains "http2: retain streams during pending writes", which belongs to CVE-2026-123874 and concerns the Http2Stream object itself. CVE-2026-123866 is specifically about the response data buffers, so keep the two separate when tracking remediation.

The fix: separating "keep alive" from "complete the write"

The patch adds a second strong reference, buffer_owner, to NgHttp2StreamWrite. It keeps the request and its buffers alive but never triggers completion, while req_wrap keeps its original role as the completion signal. The patched structure in src/node_http2.h reads as follows (template arguments are not shown in the fetched diff):

struct NgHttp2StreamWrite : public MemoryRetainer { // Completed once all buffers from the request have been consumed. BaseObjectPtr req_wrap; // Retains the request's buffers without completing it. BaseObjectPtr buffer_owner; uv_buf_t buf;

The two call sites change accordingly:

  • Http2Stream::DoWrite() now builds a single buffer_owner from the request's async wrap and attaches it to every queued buffer. Only the last buffer still carries the completing req_wrap, so completion semantics are unchanged.
  • Http2Session::OnSendData() now passes write.buffer_owner along with each partial slice it pushes to the socket, with req_wrap deliberately set to nullptr. A slice therefore keeps the memory alive but cannot finish the request early. The new inline comment states the intent: retain the originating request until the slice is no longer used by the socket.

Outgoing entries are released only after the socket write completes, so the backing Buffer now lives at least that long regardless of what happens to the stream. A small change to NgHttp2StreamWrite::MemoryInfo() also reports buffer_owner to the memory tracker so heap snapshots account for it. In total, the commit changes src/node_http2.cc (12 lines added, 9 removed) and src/node_http2.h (9 added, 2 removed), with the rest being a new test, for 220 additions and 11 deletions overall.

Regression test

The new sequential test runs with garbage collection exposed and drives the server with a raw HTTP/2 client over net. It is a useful reference for what the fix guarantees:

  • Building the shared write: stream 1 sends a 30 MB response, and stream 3 is marked exclusively dependent on stream 1, so its DATA is serialized behind stream 1 in one large socket write.
  • Hitting the unprotected path: stream 3's handler calls cork(), write() and end(), which goes through _writev(). The first buffer is therefore not the last one in the request, which is the case that had no owner before the fix.
  • Triggering the bug: the client stops reading so the socket write stays pending, then sends RST_STREAM(CANCEL) for stream 3.
  • Reusing the memory: in the server's close handler, the test forces gc() and allocates 32 buffers of the same size filled with 0x56 to take over the freed memory, and only then lets the client resume.
  • Checking the output: the test asserts that stream 3's DATA is still all 0x53, and fails with "pending DATA used memory from a canceled write" if it is not.

With the fix, socket slices that are already queued keep pointing at the original response bytes, which stay live even after the stream they came from is torn down.

Deployment notes

The advisory and release notes provide no specific workaround for this CVE. Adjusting timeouts, HTTP/2 window settings or reset handling is not an established substitute for the patch, and a change that only addresses the peer-driven trigger would leave the application-initiated teardown path intact. Cyber Kendra's operational guidance is to upgrade to the fixed versions and then restart every Node.js process so the patched runtime is actually loaded.

Affected systems and versions

Affected configurations are Node.js processes serving HTTP/2 where a stream can be torn down while a response write is backpressured.

  • Node.js 22.x before 22.23.5: reachable through application-initiated teardown, including a per-stream idle timeout. The advisory does not attribute the newer window-size-driven remote path to this line. Fixed in 22.23.5.
  • Node.js 24.x before 24.22.3: peer-driven teardown is possible on releases containing the window-size change introduced in 24.22.0. Application-initiated teardown is reachable as well. Fixed in 24.22.3.
  • Node.js 26.x before 26.13.1: peer-driven teardown is possible on releases containing the window-size change introduced in 26.9.0. Application-initiated teardown is reachable as well. Fixed in 26.13.1.

The machine-readable CNA record encodes broader ranges: versions before 22.23.5, versions from 23.0.0 before 24.22.3, and versions from 25.0.0 before 26.13.1. Security updates were published only for the three supported lines listed above.

Vendor security history

Node.js is governed through a Consensus Seeking model and a Technical Steering Committee, with OpenJS acting as CNA. The OpenJS Foundation's 2025 security report states that Node.js reduced security release steps from over 20 to 3 per release line through automation, and that the project published a maintainers threat model and incident response plans for core and web infrastructure. Node.js accepts reports through HackerOne with a bug bounty, with policy targets of acknowledgment within 5 days and a more detailed response within 10 days, while noting possible delays when volunteer triage capacity is limited.

According to Cyber Kendra, the November 11, 2026 security release that fixed this issue addressed 16 vulnerabilities, 7 of them rated High, including the related HTTP/2 stream lifetime issue CVE-2026-123874. For CVE-2026-123866, the vendor credits aidan02 with the report and mcollina with the fix, and the CNA record credits aduh95 as coordinator. A mature release process still coexists with memory-lifetime defects in native code, so keep runtime upgrades on a short cycle.

References

Detect & fix
what others miss

Works with
  • GitHub
  • GitLab
  • Bitbucket
  • Azure DevOps Services
  • Gerrit
  • CVS
  • Jira
  • Linear
  • Slack
  • Security Compass
Explore integrations
Security magnifying glass visualization