Miggo Logo

CVE-2025-62381: `sveltekit-superforms` has Prototype Pollution in `parseFormData` function of `formData.js`

N/A

CVSS Score

Basic Information

EPSS Score
-
Published
10/15/2025
Updated
10/15/2025
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
-
Package NameEcosystemVulnerable VersionsFirst Patched Version
sveltekit-superformsnpm<= 2.27.32.27.4

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability is a prototype pollution issue within the sveltekit-superforms library, specifically in how it handles form data. The analysis of the provided vulnerability description and the commit patch reveals the core of the issue.

The investigation started by examining the provided patch, which is in the traversePath function within src/lib/traversal.ts. The patch adds a check to prevent the use of __proto__ and prototype in the path, which is a clear indication of a prototype pollution fix. This makes traversePath a key vulnerable function, as it's the location of the unsafe operation.

The vulnerability description further clarifies the attack vector. It points to the parseFormData function in src/lib/formData.ts as the entry point. This function is responsible for parsing the request's form data. An attacker can send a specially crafted request containing fields like __superform_files___proto__.toString. The parseFormData function processes these fields, extracts the malicious path, and then calls other functions (setPaths which then calls traversePath) to perform a nested assignment on an object. This is what triggers the prototype pollution.

Therefore, two main functions are identified as part of the vulnerability:

  1. parseFormData: This function is the initial processor of the malicious user input. It would be present in the stack trace during exploitation as it handles the crafted form data.
  2. traversePath: This is the function that contains the actual flaw – the lack of path validation. The patch is applied here to fix the vulnerability at its root.

An engineer with this CVE in their environment should be aware that any form submission handled by sveltekit-superforms could be a potential vector for this attack. Profiling for calls to parseFormData and traversePath could help in identifying if the vulnerable code path is being exercised.

Vulnerable functions

traversePath
src/lib/traversal.ts
This function is responsible for traversing an object based on a given path. Before the patch, it did not properly sanitize the path, allowing an attacker to use `__proto__` or `prototype` to access and modify the Object.prototype. This is a classic prototype pollution vulnerability. The patch mitigates this by explicitly checking for and blocking paths that contain `__proto__` or `prototype`.
parseFormData
src/lib/formData.ts
This function acts as the entry point for the vulnerability. It parses incoming form data and, if it finds a `__superform_json` field, it proceeds to process other fields (`__superform_file_` and `__superform_files_`) to set values within the object parsed from `__superform_json`. An attacker can craft the names of these fields to include a malicious path (e.g., `__superform_files___proto__.toString`), which is then passed to `setPaths` and ultimately to the vulnerable `traversePath` function, leading to prototype pollution.

WAF Protection Rules

WAF Rule

### Summ*ry `sv*lt*kit-sup*r*orms` v*.**.* *n* prior *r* sus**pti*l* to * prototyp* pollution vuln*r**ility wit*in t** `p*rs**orm**t*` *un*tion o* `*orm**t*.js`. *n *tt**k*r **n inj**t strin* *n* *rr*y prop*rti*s into `O*j**t.prototyp*`, l***in* to *

Reasoning

T** vuln*r**ility is * prototyp* pollution issu* wit*in t** `sv*lt*kit-sup*r*orms` li*r*ry, sp**i*i**lly in *ow it **n*l*s *orm **t*. T** *n*lysis o* t** provi*** vuln*r**ility **s*ription *n* t** *ommit p*t** r*v**ls t** *or* o* t** issu*. T** inv*