Use of Insufficiently Random Values in undici

Description

Impact

Undici fetch() 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.

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

Basic information

Type
reviewed
Severity
medium
Advisory on GitHub
Open advisory ↗
Repository advisory
Open repository advisory ↗
Source code
Browse source ↗
Published (advisory)
2025-01-21 21:10:47 UTC
Updated
2025-01-22 08:01:28 UTC
GitHub reviewed
2025-01-21 21:10:47 UTC
NVD published
2025-01-21

EPSS Score

Score Percentile
0.60% 69.52%

CVSS Scores

Base score Version Severity Vector
6.8 3.1
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network—not just someone sitting at the machine.
Attack complexity (AC:H)
Even with access, the exploit needs extra luck, timing, or a fussy environment to actually work.
Privileges required (PR:N)
No account or special rights needed—anonymous or random user is enough.
User interaction (UI:R)
A real person has to do something—click, install, enable—otherwise it doesn’t land.
Scope (S:U)
Damage stays in the same “trust bubble” as the broken component—no big spill into unrelated systems.
Confidentiality (C:H)
Serious risk that confidential data gets exposed in a big way.
Integrity (I:H)
They could widely tamper with or forge data—trust in the data is badly hurt.
Availability (A:N)
Service keeps running; no real outage angle.

Identifiers

CWEs

CWE id Name
CWE-330 Use of Insufficiently Random Values

Credits

  • mcollina (coordinator)
  • parrot409 (reporter)

Affected packages (3)

Vulnerable version ranges and first patched releases as published by GitHub.

Ecosystem Package Vulnerable range First patched Vulnerable functions
npm undici >= 4.5.0, < 5.28.5 5.28.5
npm undici >= 6.0.0, < 6.21.1 6.21.1
npm undici >= 7.0.0, < 7.2.3 7.2.3

References

cvelogic Threat Intelligence