CVE-2025-7783: form-data Package Boundary Value Vulnerability

form-data Updated 14 Dec 2025

Summary

21/07/2025
Yes i
Critical
9.4

CVE-2025-7783: form-data uses unsafe random function in form-data for choosing boundary. Affects form-data across 3 version ranges.

< 2.5.4 >= 3.0.0, < 3.0.4 >= 4.0.0, < 4.0.4

Fixed in 2.5.4, 3.0.4 or 4.0.4, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2025-7783 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The form-data package is a popular npm library used for constructing multipart/form-data streams, which are essential for uploading files and data in web applications. It simplifies the process of sending data to servers, particularly in scenarios involving file uploads. However, a critical vulnerability has been identified in how it generates boundary values for multipart requests, making it susceptible to attacks that can manipulate request parameters.

Vulnerability Detail

The vulnerability arises from the use of Math.random() to select boundary values for multipart form-encoded data. This method is predictable and can be exploited by an attacker who can observe the output of Math.random() in the application. If an attacker can control a field in a request made using form-data and has access to sequential Math.random() values, they can predict the boundary value and inject additional parameters into the request. This could lead to unauthorized data manipulation or injection attacks, effectively allowing the attacker to craft malicious requests.

How To Fix

Latest published version: 4.0.6 as of 22 Oct 2026

npm install form-data@4.0.6

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 2.5.4 2.5.4
    npm install form-data@2.5.4
  • >= 3.0.0, < 3.0.4 3.0.4
    npm install form-data@3.0.4
  • >= 4.0.0, < 4.0.4 4.0.4
    npm install form-data@4.0.4

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a temporary workaround, consider avoiding the use of Math.random() for generating boundary values in your application. Instead, implement a more secure random number generator or use a library designed for cryptographic purposes to ensure unpredictability.

Conclusion

The CVE-2025-7783 vulnerability in the form-data package poses a significant risk due to its reliance on Math.random() for generating boundary values. It is crucial for developers to update to the patched versions of the package to protect their applications from potential attacks. Utilizing tools like Vulert can help monitor and alert for such vulnerabilities in real-time.

See every vulnerability recorded for form-data →

Share this vulnerability

FAQ

CVE-2025-7783 is a vulnerability in the form-data package that allows attackers to predict boundary values used in multipart form data, potentially leading to unauthorized data manipulation.

You can check if your application is affected by using Vulert, which monitors open-source vulnerabilities in your software. Visit Vulert Scanner to analyze your package-lock.json without any signup.

If exploited, this vulnerability can allow attackers to inject additional parameters into requests, leading to unauthorized access or manipulation of data.

You can update the form-data package by running the following command in your terminal: npm install form-data@<version>, replacing <version> with 2.5.4, 3.0.4, or 4.0.4 as appropriate.

While updating is the best solution, you can temporarily mitigate the vulnerability by avoiding the use of Math.random() for generating boundary values and using a more secure random number generator.

Related vulnerabilities

Recent vulnerabilities recorded for form-data.

How To Fix

Latest published version: 4.0.6 as of 22 Oct 2026

npm install form-data@4.0.6

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 2.5.4 2.5.4
    npm install form-data@2.5.4
  • >= 3.0.0, < 3.0.4 3.0.4
    npm install form-data@3.0.4
  • >= 4.0.0, < 4.0.4 4.0.4
    npm install form-data@4.0.4

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback