CVE-2024-23641: @sveltejs/kit Sending A GET Or HEAD Vulnerability
HIGHCVE-2024-23641 is a HIGH (CVSS 7.5) sending a get or head vulnerability (CWE-20: Improper Input Validation) affecting @sveltejs/kit libraries in the npm ecosystem. The issue involves sending a get or head request with a body crashes sveltekit. Remediation is available by upgrading affected packages to version 2.4.3, 2.1.2, 3.0.3, 4.0.1.
CVE-2024-23641 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2024-23641
To remediate this vulnerability, upgrade all affected @sveltejs/kit 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 @sveltejs/kit@2.4.3
npm install @sveltejs/adapter-node@2.1.2
npm install @sveltejs/adapter-node@3.0.3
npm install @sveltejs/adapter-node@4.0.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @sveltejs/kit
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-23641, inspect your project dependencies using npm:
npm ls @sveltejs/kit
Analyze the terminal output to locate any version of @sveltejs/kit in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.4.3), your application is affected.
Note: The npm ls @sveltejs/kit 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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In @sveltejs/kit, 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-2024-23641 Affected @sveltejs/kit Versions
4 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@sveltejs/kit
|
npm |
≥ 2.0.0
< 2.4.3
|
2.4.3
|
|
@sveltejs/adapter-node
|
npm |
≥ 2.0.0
< 2.1.2
|
2.1.2
|
|
@sveltejs/adapter-node
|
npm |
≥ 3.0.0
< 3.0.3
|
3.0.3
|
|
@sveltejs/adapter-node
|
npm |
≥ 4.0.0
< 4.0.1
All 1 versions
4.0.0
|
4.0.1
|
References
Frequently Asked Questions
What is CVE-2024-23641?
Which @sveltejs/kit versions are affected?
What version fixes CVE-2024-23641?
Is @sveltejs/kit affected?
Is @sveltejs/adapter-node affected?
What is the CVSS score of CVE-2024-23641?
What CWE is associated with CVE-2024-23641?
How can I check npm dependencies for CVE-2024-23641?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-g5m6-hxpp-fc49",
"modified" : "2024-01-24T19:13:36Z",
"published" : "2024-01-24T14:22:22Z",
"aliases" : [ "CVE-2024-23641" ],
"summary" : "Sending a GET or HEAD request with a body crashes SvelteKit",
"details" : "### Summary\nIn SvelteKit 2 sending a GET request with a body eg `{}` to a SvelteKit app in preview or with `adapter-node` throws `Request with GET/HEAD method cannot have body.` and crashes the app.\n\n```\nnode:internal/deps/undici/undici:6066\n throw new TypeError(\"Request with GET/HEAD method cannot have body.\");\n ^\n\nTypeError: Request with GET/HEAD method cannot have body.\n at new Request (node:internal/deps/undici/undici:6066:17)\n at getRequest (file:///C:/Users/admin/Desktop/reproduction/node_modules/@sveltejs/kit/src/exports/node/index.js:107:9)\n at file:///C:/Users/admin/Desktop/reproduction/node_modules/@sveltejs/kit/src/exports/vite/preview/index.js:181:26\n at call (file:///C:/Users/admin/Desktop/reproduction/node_modules/vite/dist/node/chunks/dep-9A4-l-43.js:44795:7)\n at next (file:///C:/Users/admin/Desktop/reproduction/node_modules/vite/dist/node/chunks/dep-9A4-l-43.js:44739:5)\n at file:///C:/Users/admin/Desktop/reproduction/node_modules/@sveltejs/kit/src/exports/vite/preview/index.js:172:6\n at call (file:///C:/Users/admin/Desktop/reproduction/node_modules/vite/dist/node/chunks/dep-9A4-l-43.js:44795:7)\n at next (file:///C:/Users/admin/Desktop/reproduction/node_modules/vite/dist/node/chunks/dep-9A4-l-43.js:44739:5)\n at file:///C:/Users/admin/Desktop/reproduction/node_modules/@sveltejs/kit/src/exports/vite/preview/index.js:211:27\n at call (file:///C:/Users/admin/Desktop/reproduction/node_modules/vite/dist/node/chunks/dep-9A4-l-43.js:44795:7)\n\nNode.js v20.11.0\n```\n\n`TRACE` requests will also cause the app to crash. Prerendered pages and SvelteKit 1 apps are not affected.\n\n<!--\n### Details\n_Give all details on the vulnerability. Pointing to the incriminated source code is very helpful for the maintainer._\n-->\n### PoC\n<!-- _Complete instructions, including specific configuration details, to reproduce the vulnerability._ -->\nFirst do a fresh install of SvelteKit 2 with the example app. Typescript.\n\n1. `npm run build`\n2. `npm run preview`\n3. Go to http://localhost:4173 (works)\n4. curl -X GET -d \"{}\" http://localhost:4173/bye\n5. Application crashes and http://localhost:4173 is down\n\n### Impact\n<!-- _What kind of vulnerability is it? Who is impacted?_ -->\nDenial of Service for apps using `adapter-node`",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@sveltejs/kit"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0"
}, {
"fixed" : "2.4.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "@sveltejs/adapter-node"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0"
}, {
"fixed" : "2.1.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "@sveltejs/adapter-node"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0"
}, {
"fixed" : "3.0.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "@sveltejs/adapter-node"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.0.1"
} ]
} ],
"versions" : [ "4.0.0" ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/sveltejs/kit/security/advisories/GHSA-g5m6-hxpp-fc49"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-23641"
}, {
"type" : "WEB",
"url" : "https://github.com/sveltejs/kit/commit/af34142631c876a7eb62ff81f71e8a3f90dafee9"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/sveltejs/kit"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-20" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-01-24T14:22:22Z",
"nvd_published_at" : "2024-01-24T17:15:08Z"
}
}