CVE-2026-139849

Description

A flaw was found in undici, where EnvHttpProxyAgent fails to correctly apply custom Transport Layer Security (TLS) configuration options when routing requests. Depending on whether a request is routed directly or through a proxy, specified TLS settings—such as custom Certificate Authority (CA) trust stores or certificate pinning rules—are silently dropped, causing connections to fall back to default system trust settings. A remote attacker in a suitable network position could exploit this vulnerability by presenting a valid public certificate to intercept and modify encrypted traffic intended for custom-trusted endpoints.

Statement

This vulnerability is rated as Important because an unauthenticated network attacker can intercept and decrypt HTTPS traffic, bypassing custom TLS trust controls such as private CAs or certificate pinning. In Red Hat environments where Node.js applications use undici's EnvHttpProxyAgent, custom TLS configuration parameters are discarded depending on whether requests are routed directly or via proxy environment variables. Consequently, target TLS connections silently fall back to standard system trust stores, enabling man-in-the-middle exploitation if an attacker presents a publicly trusted certificate for the target host. Applications that explicitly configure standard Agent instances or do not rely on environment-based HTTP proxy routing are not affected.

Mitigation

To mitigate this issue in affected Node.js applications using undici without patching:

1. Configure duplicate target TLS options:
Ensure target TLS parameters (such as `ca`, `checkServerIdentity`, `servername`, or `rejectUnauthorized`) are supplied to both `requestTls` and `connect` properties in the client configuration. This ensures that custom TLS settings are preserved on both direct and proxied routes.

2. Replace EnvHttpProxyAgent:
Explicitly instantiate standard `Agent` (for direct connections) or `ProxyAgent` (for proxy connections) instances rather than relying on `EnvHttpProxyAgent` for dynamic route selection based on environment variables.

Note: Application code adjustments require restarting the affected Node.js application process for changes to take effect.

Common Vulnerability Scoring System (CVSS) Score Details

Info alert:Important note

CVSS scores for open source components depend on vendor-specific factors (e.g. version or build chain). Therefore, Red Hat's score and impact rating can be different from NVD and other vendors. Red Hat remains the authoritative CVE Naming Authority (CNA) source for its products and services (see Red Hat classifications).

The following CVSS metrics and score provided are preliminary and subject to review.

CVSS v3 Score Breakdown

Red HatNVDcve.org
Base Score7.4N/A7.4
Attack VectorNetworkN/ANetwork
Attack ComplexityHighN/AHigh
Privileges RequiredNoneN/ANone
User InteractionNoneN/ANone
ScopeUnchangedN/AUnchanged
ConfidentialityHighN/AHigh
Integrity ImpactHighN/AHigh
Availability ImpactNoneN/ANone

Vector

Red Hat: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N

cve.org: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N

Understanding the Weakness (CWE)

Integrity,Authentication

Technical Impact: Bypass Protection Mechanism; Gain Privileges or Assume Identity

When a certificate is invalid or malicious, it might allow an attacker to spoof a trusted entity by interfering in the communication path between the host and client. The product might connect to a malicious host while believing it is a trusted host, or the product might be deceived into accepting spoofed data that appears to originate from a trusted host.

Frequently Asked Questions

Want to get errata notifications? Sign up here.