Severity:

HIGH RISK

(7.4)

TLS Validation Bypass (CWE-295) in undici ProxyAgent

CVE-2026-9697

Modified

Vulnerability type

Category:

Improper Certificate Validation

CWE:

CWE-295

Impact:

TLS Certificate Pinning Bypass and HTTPS MITM Risk

Severity:

HIGH RISK

(7.4)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A TLS validation flaw in undici's ProxyAgent causes the requestTls configuration to be ignored when using SOCKS5 proxies, silently falling back to Node.js's default trust store.

Applications that rely on custom CA pinning or strict TLS options through requestTls with a SOCKS5 proxy may unknowingly trust any publicly valid certificate, exposing HTTPS traffic to potential man-in-the-middle attacks.

Affected context

This vulnerability affects Node.js applications that:

  • Use undici's ProxyAgent or Socks5ProxyAgent
  • Configure a SOCKS5 proxy via socks5:// or socks:// URIs
  • Depend on requestTls options (e.g., ca, cert, key, rejectUnauthorized, servername) for TLS scope restriction or certificate pinning

In these conditions, the intended custom trust configuration is silently ignored and the default Mozilla CA bundle is used instead.

Exploit preconditions

  • Attack surface: Outbound HTTPS connections initiated through undici's ProxyAgent/Socks5ProxyAgent with a SOCKS5 proxy.
  • Required access: Network-level positioning (e.g., on-path attacker, compromised proxy, or malicious network infrastructure) capable of intercepting and terminating TLS traffic.
  • Trigger point: Any HTTPS request made through a SOCKS5-configured ProxyAgent that is expected to enforce requestTls constraints.
  • Why exploitation is possible: The requestTls options are dropped on the SOCKS5 code path, so certificate pinning and custom CA trust are not applied; any certificate chaining to a public CA for the target hostname can be accepted.

Why this happens

The root cause is an incorrect handling of TLS configuration parameters in the SOCKS5 proxy path within undici's ProxyAgent.

When a SOCKS5 URI is used, the requestTls structure—intended to carry custom trust anchors and TLS constraints—is not propagated into the TLS handshake configuration.

This behavior falls under CWE-295: Improper Certificate Validation, because the application's configured certificate validation policy is not actually enforced, allowing connections to be established using broader trust than the developer intended.

Potential impact

  • TLS certificate pinning can be bypassed for outbound HTTPS requests routed via SOCKS5.
  • On-path attackers may read or modify supposedly protected HTTPS traffic.
  • Sensitive data, such as credentials, API tokens, or business data, could be exfiltrated.
  • Integrity of API calls and responses can be tampered with, potentially leading to data corruption or fraudulent operations.
  • Security assumptions about corporate or internal CA–pinned services may no longer hold.

General mitigation guidance

Effective mitigation focuses on enforcing strict TLS validation policies and avoiding reliance on code paths that ignore them:

  • Prefer proxy configurations and agent types that correctly honor explicit TLS settings, especially custom CAs and certificate pinning.
  • Centralize TLS configuration to reduce the chance that certain routes or agents silently diverge from the desired validation policy.
  • Apply least-privilege and segmentation for network paths that carry sensitive HTTPS traffic so that only trusted infrastructure can observe it.
  • Use defense-in-depth: combine TLS pinning with application-level integrity checks or signed payloads where practical.
  • Regularly exercise and test TLS settings (including CA bundles and pinning) under different proxy and agent configurations to detect unexpected fallbacks.

How teams detect issues like this

Potential detection approaches include:

  • Static analysis and code review: Look for usages of undici's ProxyAgent or Socks5ProxyAgent where requestTls is configured alongside socks5:// or socks:// proxy URIs; verify that TLS constraints are actually enforced in those paths.
  • Configuration audits: Inventory outbound HTTP client configurations and highlight cases where certificate pinning or custom CAs are expected, then confirm that behavior by controlled tests.
  • Dynamic and integration testing: In staging environments, replace upstream endpoints with services using untrusted or mismatched certificates to ensure that connections fail when pinning is intended.
  • Policy enforcement: Incorporate automated checks in CI/CD pipelines that flag proxy configurations known to bypass strict TLS options, and encourage use of vetted HTTP client patterns or wrappers.

Sources

SourceLink
cna.openjsf.orgcna.openjsf.org/security-advisories.html
github.comgithub.com/nodejs/undici/security/advisories/GHSA-vmh5-mc38-953g
access.redhat.comaccess.redhat.com/errata/RHSA-2026:22380
access.redhat.comaccess.redhat.com/errata/RHSA-2026:22934
access.redhat.comaccess.redhat.com/errata/RHSA-2026:34342
access.redhat.comaccess.redhat.com/errata/RHSA-2026:35841
access.redhat.comaccess.redhat.com/errata/RHSA-2026:35891
access.redhat.comaccess.redhat.com/errata/RHSA-2026:36621
access.redhat.comaccess.redhat.com/errata/RHSA-2026:36754
access.redhat.comaccess.redhat.com/errata/RHSA-2026:36820
access.redhat.comaccess.redhat.com/errata/RHSA-2026:38236
access.redhat.comaccess.redhat.com/errata/RHSA-2026:39868
access.redhat.comaccess.redhat.com/errata/RHSA-2026:41929
access.redhat.comaccess.redhat.com/errata/RHSA-2026:47728
access.redhat.comaccess.redhat.com/errata/RHSA-2026:48124
access.redhat.comaccess.redhat.com/errata/RHSA-2026:48151
access.redhat.comaccess.redhat.com/errata/RHSA-2026:7378
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-9697
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2490018
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-9697.json

Frequently asked

questions

Yes, in the sense that an attacker who can position themselves on the network path—such as a compromised proxy, malicious Wi-Fi, or ISP-level attacker—can exploit the weakened TLS validation to intercept and tamper with HTTPS connections.

The attacker generally needs network-level access between the client and the destination server, or control over the SOCKS5 proxy or upstream infrastructure, to present a certificate and act as a man-in-the-middle.

The safest pattern is to ensure that any HTTP client code path requiring certificate pinning or custom CAs uses an agent and proxy configuration that properly applies requestTls (or equivalent) settings, and to standardize on client wrappers that enforce these constraints consistently.

Prevent similar issues by treating TLS configuration as critical security policy: design APIs so that validation settings cannot be silently dropped, add tests to verify pinning for all supported proxy types, and include TLS behavior checks in both security reviews and automated testing pipelines.

Find out what's already
exploitable in your codebase.