NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · npm

CVE-2026-87018: undici vulnerable to Denial of Service via TLS 1.2 certificate-changing renegotiation

highCVSS 3.1 7.5GHSA-qrxm-fqhp-jwvm

undici, the Node.js HTTP client behind global `fetch()`, crashes the whole process when a TLS 1.2 server renegotiates and presents a different, trusted certificate for the wrong hostname. A malicious or compromised HTTPS endpoint can use this to take down any client that calls it. Upgrade to undici 6.29.1, 7.30.1 or 8.12.2.

Published Oct 27, 2026 · Analysis Nov 1, 2026

What an attacker can do

After a TLS 1.2 connection is established, a server can start a renegotiation and present a second certificate. Node.js re-runs hostname verification on that handshake. When the name does not match, it destroys the socket with ERR_TLS_CERT_ALTNAME_INVALID. undici's handler for errors on established sockets asserted that this code could never occur. The assertion throws an uncaught AssertionError, and Node.js terminates the process. Both the HTTP/1.1 and HTTP/2 paths are affected.

The attacker needs no CA compromise. They control an endpoint your code calls, serve a valid certificate for the requested host first, then renegotiate with a second ordinary valid certificate for another name. One request is enough. Every in-flight request and background job in that process dies with it. The impact is availability only (CVSS A:H). Services that fetch user-supplied URLs, webhooks or third-party APIs are the most exposed, because the attacker can pick the endpoint. TLS 1.3 connections are not affected, since TLS 1.3 has no renegotiation.

Who is affected

Three undici lines are affected: >= 4.2.1, < 6.29.1, >= 7.0.0, < 7.30.1 and >= 8.0.0, < 8.12.2. Node.js's built-in fetch() is backed by undici, so check your runtime as well as your dependency tree. Only TLS 1.2 connections are exploitable.

npm ls undici

This lists every copy of undici, including transitive ones. Also run node --version and check whether your Node.js release has shipped an undici update.

undici

Ecosystem
npm
Affected
>= 4.2.1, < 6.29.1
Fixed in
6.29.1
Check
npm ls undici

undici

Ecosystem
npm
Affected
>= 7.0.0, < 7.30.1
Fixed in
7.30.1
Check
npm ls undici

undici

Ecosystem
npm
Affected
>= 8.0.0, < 8.12.2
Fixed in
8.12.2
Check
npm ls undici

How to fix it

Upgrade undici to 6.29.1, 7.30.1 or 8.12.2, whichever matches your major version.

npm install undici@latest

For transitive copies, update the parent package or use an overrides entry in package.json.

If you cannot upgrade and your targets support TLS 1.3, pin the client to it so renegotiation cannot happen: set connect: { minVersion: 'TLSv1.3', maxVersion: 'TLSv1.3' } on the client or agent.

How to tell if you were hit

Look for unexplained Node.js process exits with an uncaught AssertionError whose stack passes through undici's socket error handler. The renegotiated handshake produces ERR_TLS_CERT_ALTNAME_INVALID (hostname mismatch) on a connection that had already been established. Correlate crash times with outbound requests to one remote host, and check whether that host negotiated TLS 1.2. Repeated restarts of a service right after it calls a specific external endpoint are a strong signal.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Impact

undici crashes the client process when a TLS 1.2 server renegotiates after the connection is established and presents a different, CA-trusted certificate whose hostname does not match the requested host. Node.js re-runs hostname verification on the renegotiated handshake and destroys the socket with ERR_TLS_CERT_ALTNAME_INVALID. undici's established socket error handler asserted that this error code could never occur, so the peer-controlled error became an uncaught AssertionError that terminates the Node.js process. Both the HTTP/1.1 and HTTP/2 paths are affected.

A malicious or compromised HTTPS endpoint reached through undici or the global fetch() can crash the client with a single server-initiated renegotiation, taking down all in-flight requests and background work in the process. Only TLS 1.2 is affected, because TLS 1.3 does not support renegotiation. Exploitation does not require a CA compromise: the attacker controls the endpoint and can present two ordinary valid certificates, the first matching the requested URL and the second intentionally not matching it.

Patches

Upgrade to undici 6.29.1, 7.30.1, or 8.12.2.

Workarounds

Restrict outbound connections to TLS 1.3, for example by setting connect: { minVersion: 'TLSv1.3', maxVersion: 'TLSv1.3' } on the client or agent, so that renegotiation cannot occur, when the target endpoints support TLS 1.3.

Credited to benzdeus, mcollina, UlisesGascon.

Questions

Does CVE-2026-87018 affect TLS 1.3 connections?

No. TLS 1.3 does not support renegotiation, so the crash path cannot be reached. Only TLS 1.2 connections are affected, which is why pinning minVersion: 'TLSv1.3' works as a workaround when the target supports it.

Does the attacker need a stolen or forged certificate?

No. The attacker controls the endpoint and presents two ordinary CA-trusted certificates. The first matches the requested URL. The second deliberately does not match it.

Is CVE-2026-87018 exploited in the wild?

The sources do not report exploitation, and it is not in CISA's KEV catalog. EPSS is low (0.0019).

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More npm vulnerabilities

All npm entries