# GHSA-5P8Q-MFQP-V63M: undici vulnerable to improper certificate validation via EnvHttpProxyAgent dropping target TLS options

- Database: GitHub
- Severity: CVSS 7.4 (High)
- Published: 2026-12-04
- Modified: 2026-12-05

## Tracked as

- [CVE-2026-139849](https://cve.now/CVE-2026-139849.md): undici certificate validation bypass in EnvHttpProxyAgent

## Affected versions

- undici (npm): from 6.14.0, fixed in 6.29.2
- undici (npm): from 7.0.0, fixed in 7.30.4
- undici (npm): from 8.0.0, fixed in 8.14.1

## Description

### Impact

`EnvHttpProxyAgent` picks a direct or proxied route for each request from the `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY` environment variables, but applies the application's target TLS options on only one of those routes. Options passed as `requestTls` (the documented option for TLS to the target) are dropped when a request goes direct, either because no proxy variable is set or because the host matches `NO_PROXY`. Options passed as `connect` are dropped when a request is tunnelled through a proxy. In both cases the TLS connection to the target is made without the application's `ca`, `checkServerIdentity`, `servername`, client certificate or `rejectUnauthorized` settings, falling back to Node.js's default trust store and hostname check, and nothing reports that the options were ignored.

Because the route is selected by the deployment environment rather than the application, the same code and options can enforce a private CA or certificate pinning in one environment and silently accept any publicly trusted certificate in another. An attacker able to present a publicly trusted certificate for the target host, for example through a network position on that route, can then intercept connections the application expected to be pinned or restricted to its own CA. All releases since `EnvHttpProxyAgent` was introduced in undici 6.14.0 are affected.

### Patches

Upgrade to undici `6.29.2`, `7.30.4`, or `8.14.1`. `EnvHttpProxyAgent` now applies the application's target TLS options on both the direct and proxied routes.

### Workarounds

Pass the same target TLS options as both `requestTls` and `connect` so they are applied on either route, or use `Agent` (direct) or `ProxyAgent` (proxied) explicitly instead of `EnvHttpProxyAgent`.

## References

- https://github.com/nodejs/undici/security/advisories/GHSA-5p8q-mfqp-v63m

Page: https://cve.now/GHSA-5P8Q-MFQP-V63M

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
