CVE-2025-22150: Undici Use Of Insufficiently Random Values Vulnerability

MODERATE
Advisory Identifier: GHSA-c76h-2ccp-4975
CVSS 6.8
CWE-330
Published
Advisory Summary

CVE-2025-22150 is a MODERATE (CVSS 6.8) use of insufficiently random values vulnerability (CWE-330: Use of Insufficiently Random Values) affecting Undici libraries in the npm ecosystem. The issue involves use of insufficiently random values in undici. Remediation is available by upgrading affected packages to version 5.28.5, 6.21.1, 7.2.3.

CVE-2025-22150 at a Glance

CVE Identifier CVE-2025-22150
GHSA Identifier GHSA-c76h-2ccp-4975
Severity MODERATE
CVSS v3.1 Base Score 6.8
CWE Classification CWE-330: Use of Insufficiently Random Values
Affected Product Undici
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.8

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

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

How to Fix CVE-2025-22150

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.28.5
npm install undici@5.28.5
undici fixed: 6.21.1
npm install undici@6.21.1
undici fixed: 7.2.3
npm install undici@7.2.3
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-2025-22150, 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.28.5), 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-330: Use of Insufficiently Random Values, where the product uses insufficiently random numbers or values in a security context that depends on unpredictable numbers. 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

### Impact [Undici `fetch()` uses Math.random()](https://github.com/nodejs/undici/blob/8b06b8250907d92fead664b3368f1d2aa27c1f35/lib/web/fetch/body.js#L113) to choose the boundary for a multipart/form-data request. It is known that the output of Math.random() can be predicted if several of its generated values are known. If there is a mechanism in an app that sends multipart requests to an attacker-controlled website, they can use this to leak the necessary values. Therefore, An attacker can tamper with the requests going to the backend APIs if certain conditions are met. ### Patches This is fixed in 5.28.5; 6.21.1; 7.2.3. ### Workarounds Do not issue multipart requests to attacker controlled servers. ### References * https://hackerone.com/reports/2913312 * https://blog.securityevaluators.com/hacking-the-javascript-lottery-80cc437e3b7f

CVE-2025-22150 Affected Undici Versions

3 component(s)
Fixed Versions:
5.28.56.21.17.2.3
Product / Package Ecosystem Affected Versions Fixed Version
undici
npm
≥ 4.5.0
< 5.28.5
5.28.5
undici
npm
≥ 6.0.0
< 6.21.1
6.21.1
undici
npm
≥ 7.0.0
< 7.2.3
7.2.3

References

Frequently Asked Questions

What is CVE-2025-22150?
CVE-2025-22150 is a security vulnerability in Undici involving Use of Insufficiently Random Values in undici under CWE-330: Use of Insufficiently Random Values.
Which Undici versions are affected?
Affected versions include releases prior to 5.28.5, 6.21.1, 7.2.3 across affected packages: undici.
What version fixes CVE-2025-22150?
Upgrading to 5.28.5, 6.21.1, 7.2.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is undici affected?
Yes, undici is affected in releases prior to 5.28.5, 6.21.1, 7.2.3. Upgrade your dependency to 5.28.5, 6.21.1, 7.2.3 or later.
What is the CVSS score of CVE-2025-22150?
CVE-2025-22150 has a CVSS v3.1 base score of 6.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2025-22150?
CVE-2025-22150 is classified under CWE-330: Use of Insufficiently Random Values (The product uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.).
How can I check npm dependencies for CVE-2025-22150?
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-c76h-2ccp-4975",
  "modified" : "2025-01-21T21:10:47Z",
  "published" : "2025-01-21T21:10:47Z",
  "aliases" : [ "CVE-2025-22150" ],
  "summary" : "Use of Insufficiently Random Values in undici",
  "details" : "### Impact\n\n[Undici `fetch()` uses Math.random()](https://github.com/nodejs/undici/blob/8b06b8250907d92fead664b3368f1d2aa27c1f35/lib/web/fetch/body.js#L113) to choose the boundary for a multipart/form-data request. It is known that the output of Math.random() can be predicted if several of its generated values are known.\n\nIf there is a mechanism in an app that sends multipart requests to an attacker-controlled website, they can use this to leak the necessary values. Therefore, An attacker can tamper with the requests going to the backend APIs if certain conditions are met.\n\n### Patches\n\nThis is fixed in 5.28.5; 6.21.1; 7.2.3.\n\n### Workarounds\n\nDo not issue multipart requests to attacker controlled servers.\n\n### References\n\n* https://hackerone.com/reports/2913312\n* https://blog.securityevaluators.com/hacking-the-javascript-lottery-80cc437e3b7f\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "undici"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.5.0"
      }, {
        "fixed" : "5.28.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "undici"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "6.21.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "undici"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0.0"
      }, {
        "fixed" : "7.2.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/undici/security/advisories/GHSA-c76h-2ccp-4975"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-22150"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/undici/commit/711e20772764c29f6622ddc937c63b6eefdf07d0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/undici/commit/c2d78cd19fe4f4c621424491e26ce299e65e934a"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/undici/commit/c3acc6050b781b827d80c86cbbab34f14458d385"
  }, {
    "type" : "WEB",
    "url" : "https://hackerone.com/reports/2913312"
  }, {
    "type" : "WEB",
    "url" : "https://blog.securityevaluators.com/hacking-the-javascript-lottery-80cc437e3b7f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nodejs/undici"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/undici/blob/8b06b8250907d92fead664b3368f1d2aa27c1f35/lib/web/fetch/body.js#L113"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-330" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-01-21T21:10:47Z",
    "nvd_published_at" : "2025-01-21T18:15:14Z"
  }
}