# CVE-2025-22150: Undici Uses Insufficiently Random Values

> Attackers can predict multipart boundaries in Undici HTTP client requests, allowing them to tamper with data sent to backend APIs.

- **Severity:** Medium 6.8 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 21 Jan 2025
- **Updated:** 12 Feb 2025
- **Also known as:** ALPINE-CVE-2025-22150, AZL-55931, AZL-55950, BELL-CVE-2025-22150, CLSA-2025-1758102713, DEBIAN-CVE-2025-22150, ECHO-e503-e375-1d79, GHSA-c76h-2ccp-4975, MINI-hwvv-359q-8cr5, MINI-j3mr-4f8v-7r4c, MINI-qj3h-grvq-3wrr, ROOT-APP-NPM-CVE-2025-22150, ROOT-OS-DEBIAN-12-CVE-2025-22150, UBUNTU-CVE-2025-22150

## What is CVE-2025-22150?

CVE-2025-22150 is a medium-severity vulnerability in nodejs undici, published on 21 Jan 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Undici is an HTTP/1.1 client. Starting in version 4.5.0 and prior to versions 5.28.5, 6.21.1, and 7.2.3, undici uses `Math.random()` 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. This is fixed in versions 5.28.5, 6.21.1, and 7.2.3. As a workaround, do not issue multipart requests to attacker controlled servers.

Weakness: CWE-330 (Use of Insufficiently Random Values)

## Which versions are affected by CVE-2025-22150?

6 open source packages ship an affected version, including undici.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `undici` | npm | From 4.5.0 | 5.28.5 |
| `undici` | npm | From 4.5.0 | 5.28.5 |
| `undici` | npm | From 6.0.0 | 6.21.1 |
| `undici` | npm | From 6.0.0 | 6.21.1 |
| `undici` | npm | From 7.0.0 | 7.2.3 |
| `undici` | npm | From 7.0.0 | 7.2.3 |

## How do I fix CVE-2025-22150?

Upgrade undici to a fixed version for your release line: 5.28.5, 6.21.1 or 7.2.3.

## Is CVE-2025-22150 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-22150 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-22150 and fix it if it is affected.

What it is: CVE-2025-22150 is a medium-severity vulnerability in nodejs undici, published on 21 Jan 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-22150 exists.

Affected packages and fixed versions:
- undici (npm): affected from 4.5.0; fixed in 5.28.5
- undici (npm): affected from 4.5.0; fixed in 5.28.5
- undici (npm): affected from 6.0.0; fixed in 6.21.1
- undici (npm): affected from 6.0.0; fixed in 6.21.1
- undici (npm): affected from 7.0.0; fixed in 7.2.3
- undici (npm): affected from 7.0.0; fixed in 7.2.3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-22150/ (Markdown: https://insights.sbomify.com/CVE-2025-22150/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-22150
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-22150
- OSV: https://osv.dev/vulnerability/CVE-2025-22150

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-22150/
Summaries are generated and may contain mistakes; the official description above is the record.
