⚠️

Disclaimer & Liability

The content provided on this website is for educational, research, and security awareness purposes only. Any unauthorized, illegal, or abusive use of the information, tools, and techniques discussed is solely the responsibility of the user. The author and publisher assume no liability for any damages, injuries, or consequences resulting from the misuse of this content.

CVE-2026-141996: undici Reuses TLS Servername Across Cross-Origin Redirects, Weakening Certificate Validation | Alireza Bolbolabadi - Red Team Security
LOADING

CVE-2026-141996: undici Reuses TLS Servername Across Cross-Origin Redirects, Weakening Certificate Validation

Affected Products: 8.0.0, 8.14.1, 7.0.0, 7.30.4, 6.8.0, 6.29.2

Executive summary

A flaw in undici's redirect interceptor breaks the hostname binding that TLS is supposed to enforce. When a request is redirected to a different origin, undici builds the follow-up request by copying the options of the previous hop. Those copied options still contain the TLS servername value, which drives both the SNI sent in the ClientHello and the identity against which the peer certificate is checked.

The result is that the certificate presented by the redirect target is validated against the name of the first host. If an attacker sits on the network path and presents a certificate that is legitimately valid for the original host, the client accepts it while connecting to the redirect target. The attacker can then impersonate that target and read or modify the redirected request — including any authorization headers, cookies or payload it carries — along with the response returned to the application.

The advisory (CVE-2026-141996) assigns a CVSS 3.1 base score of 7.4 (HIGH) and maps the issue to CWE-295, Improper Certificate Validation. Fixed releases are undici 6.29.2, 7.30.4 and 8.14.1.

Affected systems

undici is an HTTP client for Node.js and is used both standalone and as the basis of Node.js's built-in networking APIs.

Vulnerable versions

  • undici 6.8.0 through 6.29.1

  • undici 7.0.0 through 7.30.3

  • undici 8.0.0 through 8.14.0

Fixed versions

  • undici 6.29.2

  • undici 7.30.4

  • undici 8.14.1

Conditions that must hold for exposure

  1. The application follows redirects using undici's redirect interceptor, and

  1. The first request carries a servername — either supplied explicitly as a request option, or set by a dns interceptor that is composed outside the redirect interceptor; or

  1. Requests are issued through a ProxyAgent tunnel without requestTls set, which exhibits the same behaviour.

Not affected

  • undici's fetch implementation.

  • dns interceptors composed inside the redirect interceptor.

How the flaw works

The redirect interceptor is implemented by cloning the outgoing request options for each subsequent hop. That clone carries the original servername with it. On a cross-origin redirect — a 30x response whose Location header points at a different host — the client opens a new TLS connection to the new host but still requests and validates against the previous host's identity.

The practical consequences break both halves of TLS authentication:

  • Confidentiality — the redirected request body, headers, cookies and bearer tokens become visible to whoever terminates the connection.

  • Integrity — the attacker can substitute the response, returning forged data that the application treats as coming from the legitimate target.

An attacker needs two things: a network position on the path to the redirect target (a compromised router, hostile Wi-Fi or egress network, a tampered proxy), and a valid certificate for the original host — for example one issued by a public CA for a domain the attacker controls or compromises, or a certificate the attacker can obtain for a domain they legitimately operate. From that position, the attacker redirects the client to the target and answers with a certificate matching the stale servername, which the client accepts.

Exploitation status and real-world exposure

Exposure is conditional, not universal. A large share of undici consumers use the default client or fetch, and neither pattern is affected, so the practical blast radius is narrower than the raw version range suggests. What raises concern is the set of applications that do match the profile: services authenticating upstream APIs, payment endpoints, identity providers or token-exchange flows while explicitly setting servername or layering dns interceptors around redirect.

At the time of publication:

  • The vulnerability was not listed on the CISA Known Exploited Vulnerabilities catalog.

  • A repository scan performed by cvefeed.io surfaced no public proof-of-concept exploits.

  • The advisory records no in-the-wild incidents.

One external feed labels the issue "Remotely Exploit: No," which reflects the absence of a wormable, unauthenticated remote trigger: the attacker needs positioning rather than a single unauthenticated request. It should not be read as an absence of risk — where the trigger conditions hold, the result is a full TLS bypass on the redirected hop.

Mitigation

Upgrade path (preferred)

Move to undici 6.29.2, 7.30.4 or 8.14.1, or to any later release on the corresponding 6.x, 7.x or 8.x line. These versions stop propagating the stale servername to cross-origin redirect targets.

Workarounds when an upgrade is not immediately possible

  • Compose the dns interceptor inside the redirect interceptor so that servername is re-derived per hop instead of being carried over from the first request.

  • Do not pass a servername request option on requests that may be redirected to another origin.

  • Disable automatic redirect following and handle redirects in application code, issuing each new request with a correctly populated servername.

  • For ProxyAgent traffic, populate requestTls with explicit SNI/servername values for each target rather than relying on tunnel reuse.

Detection and inventory

  • Review dependency trees and lockfiles (npm ls undici) to locate versions inside the affected ranges.

  • Search the codebase for Agent configurations that combine a redirect interceptor with dns or with an explicit servername, and for ProxyAgent usage that omits requestTls; each match is a candidate vulnerable call site.

  • Watch network and proxy logs for unexpected cross-origin 30x responses on clients that talk to sensitive upstreams, and for certificate anomalies appearing in redirect chains.

  • Track vendor advisories at https://cna.openjsf.org/security-advisories.html and the project advisory at https://github.com/nodejs/undici/security/advisories/GHSA-fgj4-8x8v-fqhm for changes in exploitation status.

Expert insight

The interesting part of this bug is not that a validation check was skipped; it is that the identity being validated drifted away from the peer being connected to. Every other part of the TLS handshake — cipher negotiation, signature verification, chain validation — worked correctly, and every check passed, because the check was simply asking the wrong question. This is the classic desynchronisation pattern: state that is correct in isolation and wrong in composition.

The redirect interceptor's design choice of cloning prior request options is what creates the desynchronisation. Cloning is convenient and preserves per-hop settings such as headers and timeouts, but hostname-bound attributes must be re-derived when the origin changes. The dns interceptor offers a clue about the intended shape of the fix: placing it inside the redirect pipeline lets each hop recompute its own servername, which is exactly the behaviour the vulnerable ordering breaks.

For defenders, the practical question is not "do we use undici" but "do we use undici's redirect interceptor with a pinned servername or an external dns interceptor." Applications that authenticate to third-party APIs are the ones where the difference matters most: they send credentials on the redirected hop, and a certificate that is valid for the original host will be accepted by the client without any visible error. Absence from the KEV catalog and absence of public PoCs are true today, but the primitive itself is small and reproducible, so the fix is inexpensive relative to the cost of discovering the compromise later.

Actionable recommendations

  1. Inventory undici usage with npm ls undici and lockfile review, and identify any dependency resolved to 6.8.0–6.29.1, 7.0.0–7.30.3 or 8.0.0–8.14.0.

  1. Upgrade undici to 6.29.2, 7.30.4 or 8.14.1 (or a later release on the same major line) in every affected application and service.

  1. Audit interceptor composition, looking specifically for a redirect interceptor combined with an explicit servername option or a dns interceptor placed outside it.

  1. Re-order dns inside redirect as an interim measure where an immediate upgrade is not possible, and remove servername from requests that may follow cross-origin redirects.

  1. Review ProxyAgent configurations and add explicit requestTls SNI/servername values for each target.

  1. Where automatic redirects are not strictly required, handle them in application code so each hop is issued with a fresh servername.

  1. Monitor outbound HTTP traffic for unexpected cross-origin 30x responses toward sensitive third-party endpoints, and correlate with certificate presentation anomalies in redirect chains.

  1. Subscribe to the OpenJS Foundation advisory feed and the undici GitHub Security Advisory for updates on exploitation activity.

advisory high CVE-2026-141996
·
← Back to Writeups