Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. form-data
  4. ›
  5. CVE-2025-7783

CVE-2025-7783: form-data uses unsafe random function in form-data for choosing boundary

July 21, 2025

form-data uses Math.random() to select a boundary value for multipart form-encoded data. This can lead to a security issue if an attacker:

  1. can observe other values produced by Math.random in the target application, and
  2. can control one field of a request made using form-data

Because the values of Math.random() are pseudo-random and predictable (see: https://blog.securityevaluators.com/hacking-the-javascript-lottery-80cc437e3b7f), an attacker who can observe a few sequential values can determine the state of the PRNG and predict future values, includes those used to generate form-data’s boundary value. The allows the attacker to craft a value that contains a boundary value, allowing them to inject additional parameters into the request.

This is largely the same vulnerability as was recently found in undici by parrot409 – I’m not affiliated with that researcher but want to give credit where credit is due! My PoC is largely based on their work.

References

  • github.com/advisories/GHSA-fjxv-7rqg-78g4
  • github.com/benweissmann/CVE-2025-7783-poc
  • github.com/form-data/form-data
  • github.com/form-data/form-data/commit/3d1723080e6577a66f17f163ecd345a21d8d0fd0
  • github.com/form-data/form-data/security/advisories/GHSA-fjxv-7rqg-78g4
  • nvd.nist.gov/vuln/detail/CVE-2025-7783

Code Behaviors & Features

Detect and mitigate CVE-2025-7783 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 2.5.4, all versions starting from 3.0.0 before 3.0.4, all versions starting from 4.0.0 before 4.0.4

Fixed versions

  • 2.5.4
  • 3.0.4
  • 4.0.4

Solution

Upgrade to versions 2.5.4, 3.0.4, 4.0.4 or above.

Weakness

  • CWE-330: Use of Insufficiently Random Values

Source file

npm/form-data/CVE-2025-7783.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Tue, 19 Aug 2025 12:19:06 +0000.