CVE-2026-84961: undici vulnerable to TLS certificate validation bypass via dropped connect options in BalancedPool
Impact
undici's BalancedPool passes its constructor options through a JSON-based deep clone (JSON.parse(JSON.stringify(...))) before forwarding them to each per-upstream Pool. JSON cannot represent functions, so a caller-supplied connect or tls option containing a checkServerIdentity callback (or a custom connector function) 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 BalancedPool. Client, Pool, Agent, and RoundRobinPool destructure connect/tls before the clone and are not affected. Only applications that use BalancedPool with a function-valued connect/tls option (such as a custom checkServerIdentity or connector) are affected.
Patches
Upgrade to 7.29.1 or 8.10.2. BalancedPool now preserves the connect and tls options outside the JSON clone, so custom TLS verification callbacks are forwarded to each upstream unchanged.
Workarounds
Use Client, Pool, or Agent instead of BalancedPool for connections that rely on a custom checkServerIdentity or connector, until upgraded.
Other sources
undici's BalancedPool constructor passes its entire options object through an internal deep-clone that serializes and reparses the value as JSON. Because JSON cannot represent functions, any function-valued TLS option, such as a caller-supplied checkServerIdentity callback or a custom connector inside the connect option, is silently discarded before it reaches the TLS layer. As a result a peer whose certificate the application's custom checkServerIdentity was written to reject, but which still passes Node's default hostname and chain checks, is accepted when reached through BalancedPool. The Client, Pool, and Agent dispatchers are not affected because they extract the connect and tls options before cloning. This affects undici versions from 7.24.1 up to 7.29.1 and from 8.0.0 up to 8.10.2, and only when the application supplies a function-valued connect or tls option to BalancedPool. Users should upgrade to undici 7.29.1 or 8.10.2.
— MITRE
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.10.2 - Upgrade
Upgrade
npm/undicito a version that resolves this vulnerability.Fixed in 7.29.1 - Upgrade
Upgrade
undicito a version that resolves this vulnerability.Fixed in 7.29.1 - Upgrade
Upgrade
undicito a version that resolves this vulnerability.Fixed in 8.10.2 - Compensating control
Use Client, Pool, or Agent instead of BalancedPool for connections that rely on a custom checkServerIdentity callback or connector until undici is upgraded.
Event History
Frequently Asked Questions
Which deployments are affected?
Only applications that use undici's BalancedPool and supply a function-valued connect or TLS option are affected. This includes custom checkServerIdentity callbacks and custom connectors passed through the connect option; Client, Pool, and Agent dispatchers are not affected.
What certificate validation can be bypassed?
A peer certificate can bypass the application's custom checkServerIdentity policy because that callback is discarded before reaching the TLS layer. The peer must still pass Node's default hostname and certificate-chain validation.
Which undici versions need remediation?
Affected versions are 7.24.1 through 7.29.1 and 8.0.0 through 8.10.2. Upgrade to undici 7.29.1 or 8.10.2.
How can I determine whether my application is exposed?
Review BalancedPool construction and its options for function-valued TLS or connect settings, especially checkServerIdentity callbacks and custom connectors. If those functions are used with BalancedPool on an affected version, they are silently removed by the internal cloning step.