CVE-2022-32210: Undici ProxyAgent Vulnerable To MITM Vulnerability

HIGH
Advisory Identifier: GHSA-pgw7-wx7w-2w33
CVSS 7.7
CWE-295
Published
Advisory Summary

CVE-2022-32210 is a HIGH (CVSS 7.7) proxyagent vulnerable to mitm vulnerability (CWE-295: Improper Certificate Validation) affecting Undici libraries in the npm ecosystem. The issue involves proxyagent vulnerable to mitm. Remediation is available by upgrading affected packages to version 5.5.1.

CVE-2022-32210 at a Glance

CVE Identifier CVE-2022-32210
GHSA Identifier GHSA-pgw7-wx7w-2w33
Severity HIGH
CVSS v3.1 Base Score 7.7
CWE Classification CWE-295: Improper Certificate Validation
Affected Product Undici
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2022-32210

To remediate this vulnerability, upgrade all affected Undici dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

undici fixed: 5.5.1
npm install undici@5.5.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls undici

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2022-32210, inspect your project dependencies using npm:

npm ls undici

Analyze the terminal output to locate any version of Undici in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.5.1), your application is affected.

Note: The npm ls undici command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-295: Improper Certificate Validation, where the product does not validate, or incorrectly validates, a certificate. In Undici, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Description `Undici.ProxyAgent` never verifies the remote server's certificate, and always exposes all request & response data to the proxy. This unexpectedly means that proxies can MitM all HTTPS traffic, and if the proxy's URL is HTTP then it also means that nominally HTTPS requests are actually sent via plain-text HTTP between Undici and the proxy server. ### Impact This affects all use of HTTPS via HTTP proxy using **`Undici.ProxyAgent`** with Undici or Node's global `fetch`. In this case, it removes all HTTPS security from all requests sent using Undici's `ProxyAgent`, allowing trivial MitM attacks by anybody on the network path between the client and the target server (local network users, your ISP, the proxy, the target server's ISP, etc). This less seriously affects HTTPS via HTTPS proxies. When you send HTTPS via a proxy to a remote server, the proxy can freely view or modify all HTTPS traffic unexpectedly (but only the proxy). ### Patches This issue was patched in Undici v5.5.1. ### Workarounds At the time of writing, the only workaround is to not use `ProxyAgent` as a dispatcher for TLS Connections.

CVE-2022-32210 Affected Undici Versions

1 component(s)
Fixed Versions:
5.5.1
Product / Package Ecosystem Affected Versions Fixed Version
undici
npm
≥ 4.8.2
< 5.5.1
5.5.1

References

Frequently Asked Questions

What is CVE-2022-32210?
CVE-2022-32210 is a security vulnerability in Undici involving ProxyAgent vulnerable to MITM under CWE-295: Improper Certificate Validation.
Which Undici versions are affected?
Affected versions include releases prior to 5.5.1 across affected packages: undici.
What version fixes CVE-2022-32210?
Upgrading to 5.5.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is undici affected?
Yes, undici is affected in releases prior to 5.5.1. Upgrade your dependency to 5.5.1 or later.
What is the CVSS score of CVE-2022-32210?
CVE-2022-32210 has a CVSS v3.1 base score of 7.7 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2022-32210?
CVE-2022-32210 is classified under CWE-295: Improper Certificate Validation (The product does not validate, or incorrectly validates, a certificate.).
How can I check npm dependencies for CVE-2022-32210?
Run the dependency tree command: 'npm ls undici'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-pgw7-wx7w-2w33",
  "modified" : "2022-07-29T18:13:25Z",
  "published" : "2022-06-17T01:02:29Z",
  "aliases" : [ "CVE-2022-32210" ],
  "summary" : "ProxyAgent vulnerable to MITM",
  "details" : "### Description\n\n`Undici.ProxyAgent` never verifies the remote server's certificate, and always exposes all request & response data to the proxy. This unexpectedly means that proxies can MitM all HTTPS traffic, and if the proxy's URL is HTTP then it also means that nominally HTTPS requests are actually sent via plain-text HTTP between Undici and the proxy server.\n\n### Impact\n\nThis affects all use of HTTPS via HTTP proxy using **`Undici.ProxyAgent`**  with Undici or Node's global `fetch`. In this case, it removes all HTTPS security from all requests sent using Undici's `ProxyAgent`, allowing trivial MitM attacks by anybody on the network path between the client and the target server (local network users, your ISP, the proxy, the target server's ISP, etc).\nThis less seriously affects HTTPS via HTTPS proxies. When you send HTTPS via a proxy to a remote server, the proxy can freely view or modify all HTTPS traffic unexpectedly (but only the proxy). \n\n### Patches\n\nThis issue was patched in Undici v5.5.1.\n\n### Workarounds\n\nAt the time of writing, the only workaround is to not use `ProxyAgent` as a dispatcher for TLS Connections.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "undici"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.8.2"
      }, {
        "fixed" : "5.5.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.5.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/undici/security/advisories/GHSA-pgw7-wx7w-2w33"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-32210"
  }, {
    "type" : "WEB",
    "url" : "https://hackerone.com/reports/1583680"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nodejs/undici"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-295" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-17T01:02:29Z",
    "nvd_published_at" : "2022-07-14T15:15:00Z"
  }
}