undici: weak encryption in Math.random function (CVE-2025-22150) #shorts
Summary
On today's podcast, we're diving into CVE-2025-22150, a notable security vulnerability affecting the Undici HTTP client library used in Node.js environments. This issue arises from the use of non-cryptographically secure random values, presenting potential risk to data integrity.
Product details
The affected product here is Undici, an HTTP/1.1 client utilized extensively within Node.js applications. This vulnerability impacts specific versions of the library: those starting from 4.5.0 and going up to versions 5.28.4, 6.21.0, and 7.2.2.
Vulnerability type summary
The core of the issue is the CWE-330 classification, which pertains to the use of insufficiently random values. In this context, the Undici client improperly leverages the `Math.random()` function for generating multipart request boundaries, potentially allowing attackers to predict these values under certain conditions.
Details of the vulnerability
In detailed terms, the vulnerability makes it possible for an attacker to predict request boundaries if they can observe a series of values produced by `Math.random()`. This can be particularly problematic if an application makes multipart requests to an attacker-controlled server. Exploitation could lead to tampering with requests sent to backend APIs. For mitigation, users should upgrade to Undici versions 5.28.5, 6.21.1, or 7.2.3, where this issue has been addressed.
Conclusion
In conclusion, CVE-2025-22150 highlights the potential risks associated with non-secure random number generation for critical functions in web clients. It's crucial for developers relying on the Undici library to update to the latest patches to secure their applications against potential exploits targeting this vulnerability.
Watch the full video on YouTube: CVE-2025-22150
Remediation and exploitation details
This chain involves the following actors
This following systems are involved
Attack entry point
Remediation actions
Exploitation actions
Related Content
NOTE: The following related content has not been vetted and may be unsafe.
- https://github.com/nodejs/undici/security/advisories/GHSA-c76h-2ccp-4975
- https://github.com/nodejs/undici/commit/711e20772764c29f6622ddc937c63b6eefdf07d0
- https://github.com/nodejs/undici/commit/c2d78cd19fe4f4c621424491e26ce299e65e934a
- https://github.com/nodejs/undici/commit/c3acc6050b781b827d80c86cbbab34f14458d385
- https://hackerone.com/reports/2913312
- https://blog.securityevaluators.com/hacking-the-javascript-lottery-80cc437e3b7f
- https://github.com/nodejs/undici/blob/8b06b8250907d92fead664b3368f1d2aa27c1f35/lib/web/fetch/body.js#L113