GHSA-2m5v-pch6-74hx: High severity npm/undici vulnerability
Impact
undici's Agent passes its constructor options through a JSON-based deep clone (JSON.parse(JSON.stringify(...))) before forwarding them to each per-origin Pool. JSON cannot represent functions, so a caller-supplied tls option containing a checkServerIdentity callback is silently dropped before it reaches the TLS layer. As a result, a TLS peer whose certificate a custom checkServerIdentity was written to reject, but which passes Node's default hostname and chain checks, is silently accepted when the request is made through Agent. Because Agent is the default dispatcher behind request, fetch, and setGlobalDispatcher, this is the path most applications use. EnvHttpProxyAgent is also affected on its direct and NOPROXY routes, which delegate to an internal Agent.
Only applications that pass a function-valued tls option (such as a custom checkServerIdentity for certificate or public-key pinning) are affected. Passing the same options through connect is not affected. This is the Agent counterpart of the BalancedPool certificate validation bypass fixed in CVE-2026-84961.
Patches
Upgrade to undici 6.29.1, 7.30.1, or 8.12.2. Agent now preserves the tls option outside the JSON clone, so custom TLS verification callbacks are forwarded to each origin unchanged.
Workarounds
Pass the TLS options through connect instead of tls. For proxied EnvHttpProxyAgent destinations, use requestTls / proxyTls.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/undicito a version that resolves this vulnerability.Fixed in 8.12.2 - Upgrade
Upgrade
npm/undicito a version that resolves this vulnerability.Fixed in 7.30.1 - Upgrade
Upgrade
npm/undicito a version that resolves this vulnerability.Fixed in 6.29.1 - Upgrade
Upgrade
undicito a version that resolves this vulnerability.Fixed in 6.29.1 - Upgrade
Upgrade
undicito a version that resolves this vulnerability.Fixed in 7.30.1 - Upgrade
Upgrade
undicito a version that resolves this vulnerability.Fixed in 8.12.2 - Configuration
Pass TLS options through connect instead of tls; for proxied EnvHttpProxyAgent destinations, use requestTls or proxyTls.
undici Agent TLS option forwarding = connect; requestTls/proxyTls for proxied EnvHttpProxyAgent destinations
Event History
Frequently Asked Questions
Which applications are realistically exposed?
Only applications that supply a function-valued tls option, such as a custom checkServerIdentity callback used for certificate or public-key pinning, are affected. Applications using Agent through request, fetch, or setGlobalDispatcher may be exposed because Agent is their default dispatcher.
What must an attacker be able to do for the validation bypass to matter?
The TLS peer must present a certificate that passes Node's default hostname and certificate-chain checks but would have been rejected by the application's custom checkServerIdentity callback. The issue causes that callback to be silently omitted when requests use Agent.
Are proxy configurations affected, and is every connection path vulnerable?
EnvHttpProxyAgent is affected on its direct and NO_PROXY routes because those routes delegate to an internal Agent. Supplying the same tls options through connect is not affected.
What version should be deployed to remediate this issue?
Upgrade undici to version 6.29.1, 7.30.1, or 8.12.2.
How can teams identify whether they are affected before upgrading?
Review code and dependency configuration for Agent or EnvHttpProxyAgent usage combined with a tls.checkServerIdentity function. Focus on request, fetch, and setGlobalDispatcher call paths, and distinguish them from connections configured through connect.