Miggo Logo

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

N/A

CVSS Score

Basic Information

EPSS Score
0.1207%
Published
7/21/2025
Updated
7/21/2025
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
-
Package NameEcosystemVulnerable VersionsFirst Patched Version
form-datanpm< 2.5.42.5.4
form-datanpm>= 3.0.0, < 3.0.43.0.4
form-datanpm>= 4.0.0, < 4.0.44.0.4

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability lies in the predictable nature of Math.random() used for generating the multipart boundary in the form-data library. The provided commit patch clearly shows the modification in the FormData.prototype._generateBoundary function within lib/form_data.js. The vulnerable implementation, which uses a loop with Math.random(), was replaced with a call to crypto.randomBytes(), a cryptographically secure random number generator. This change directly addresses the core of the vulnerability. An attacker exploiting this flaw could predict the boundary, craft a payload that includes this boundary, and thereby inject additional, unauthorized parameters into the form data. This could lead to various security impacts, such as privilege escalation or data manipulation, depending on how the receiving server processes the multipart form data.

Vulnerable functions

FormData.prototype._generateBoundary
lib/form_data.js
The function `_generateBoundary` in the `FormData` prototype uses `Math.random()` to generate the boundary for multipart form data. The pseudo-random nature of `Math.random()` makes the boundary predictable. An attacker who can observe other outputs of `Math.random()` can predict the boundary and inject malicious form fields, leading to a request smuggling vulnerability.

WAF Protection Rules

WAF Rule

### Summ*ry *orm-**t* us*s `M*t*.r*n*om()` to s*l**t * *oun**ry v*lu* *or multip*rt *orm-*n*o*** **t*. T*is **n l*** to * s**urity issu* i* *n *tt**k*r: *. **n o*s*rv* ot**r v*lu*s pro*u*** *y M*t*.r*n*om in t** t*r**t *ppli**tion, *n* *. **n *ontro

Reasoning

T** vuln*r**ility li*s in t** pr**i*t**l* n*tur* o* `M*t*.r*n*om()` us** *or **n*r*tin* t** multip*rt *oun**ry in t** `*orm-**t*` li*r*ry. T** provi*** *ommit p*t** *l**rly s*ows t** mo*i*i**tion in t** `*orm**t*.prototyp*._**n*r*t**oun**ry` *un*tion