CVE-2026-123874
Patch Available.
This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.
Overview
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. It uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, and it is widely used for web applications and server-side development. Its built-in http2 module lets a server send a file as a response body with stream.respondWithFile() or stream.respondWithFD().
A denial of service vulnerability (CVE-2026-123874) has been identified in the Node.js HTTP/2 implementation, which allows attackers to make a server free an Http2Stream while a file write that references it is still queued on the socket. When that write completes, Node.js uses the freed object, which corrupts server memory and can crash the process.
Per OWASP: The Denial of Service (DoS) attack is focused on making a resource (site, application, server) unavailable for the purpose it was designed.
This issue affects multiple versions of Node.js.
Details
Module Info
- Product: Node.js
- Affected packages:
node - Affected versions: >=24.0.0 <24.22.3, >=25.0.0 <26.13.1
- GitHub repository: https://github.com/nodejs/node
- Published packages: https://github.com/nodejs/node/releases/tag/v24.22.2
- Package manager: Not applicable. Node.js is distributed as runtime builds from nodejs.org rather than as a published npm package.
- Fixed in: OSS Node.js 24.22.3, 26.13.1
Vulnerability Info
This High-severity vulnerability is found in the node package in multiple versions of Node.js. It is a use-after-free (CWE-416) in the native HTTP/2 layer, src/node_http2.cc, rated CVSS 3.0 7.5 by the OpenJS Foundation, the CVE record's assigning CNA.
When a server answers a request with respondWithFile() or respondWithFD(), Node.js pipes the file into the Http2Stream natively. The write requests this creates hold no JavaScript reference to the Http2Stream wrapper. Http2Session::OnSendData moves each queued DATA write onto the session's outgoing buffers, and the NgHttp2StreamWrite entries it pushes carry only the write request and the buffer, not the stream.
If the stream is reset while one of those socket writes is still pending, for example by a client RST_STREAM, Http2Stream::Destroy() asks the session whether writes for the stream are still on the socket. That check only finds the stream through the write request:
bool Http2Session::HasWritesOnSocketForStream(Http2Stream* stream) {
for (const NgHttp2StreamWrite& wr : outgoing_buffers_) {
if (wr.req_wrap && WriteWrap::FromObject(wr.req_wrap)->stream() == stream)
return true;
}
return false;
}Nothing in the outgoing buffers keeps the stream alive, so once the stream is closed the garbage collector can delete the Http2Stream. When the socket write later finishes, Http2Session::ClearOutgoing completes each pending request with WriteWrap::FromObject(wrap)->Done(0), and WriteWrap::OnDone calls back into the stream:
void WriteWrap::OnDone(int status) {
stream()->EmitAfterWrite(this, status);
Dispose();
}stream() now points to the freed Http2Stream, so this is a virtual call through freed memory. An unauthenticated client can trigger it over TLS or cleartext HTTP/2 against any server that serves files with respondWithFile() or respondWithFD() with otherwise default settings, crashing the process or corrupting its memory. The advisory names Node.js 24.x and 26.x. The same stream tracking is present in the Node.js 12.x, 14.x, 16.x, 18.x and 20.x lines, which still pause reading while a socket write is pending, so a client reset is unlikely to reach this path there; an application that destroys or closes a stream during a pending file write, for example from a stream timeout, may still reach the same freed object.
Mitigation
Node.js release lines prior to v22 are End-of-Life and will not receive any upstream updates to address this issue. For more information see here. Node.js 25.x, which the affected range also covers, is End-of-Life as well.
Users of the affected components should apply one of the following mitigations:
- Upgrade to a supported Node.js release that carries the fix (v24.22.3 or v26.13.1 or later).
- Migrate affected applications away from the End-of-Life Node.js release lines.
- Leverage a commercial support partner like HeroDevs for post-EOL security support.
Credits
- Chris Rohlf in collaboration with Claude and Anthropic Research (finder)