CVE-2024-53261: @sveltejs/kit Cross-Site Scripting Vulnerability

LOW
Advisory Identifier: GHSA-rjjv-87mx-6x3h
CVSS 0.0
CWE-79
Published
Advisory Summary

CVE-2024-53261 is a LOW (CVSS 0.0) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting @sveltejs/kit libraries in the npm ecosystem. The issue involves @sveltejs/kit vulnerable to xss on dev mode 404 page. Remediation is available by upgrading affected packages to version 2.8.3.

CVE-2024-53261 at a Glance

CVE Identifier CVE-2024-53261
GHSA Identifier GHSA-rjjv-87mx-6x3h
Severity LOW
CVSS v3.1 Base Score 0.0
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product @sveltejs/kit
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 0.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:A/AC:L/PR:N/UI:R/S:C/C:N/I:N/A:N).

Attack Vector Adjacent (AV:A)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality None (C:N)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2024-53261

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.

@sveltejs/kit fixed: 2.8.3
npm install @sveltejs/kit@2.8.3
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 @sveltejs/kit

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-53261, 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.8.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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. 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

### Summary "Unsanitized input from *the request URL* flows into `end`, where it is used to render an HTML page returned to the user. This may result in a Cross-Site Scripting attack (XSS)." ### Details Source of potentially tainted data is in `packages/kit/src/exports/vite/dev/index.js`, line 437. This potentially tainted data is passed through a number of steps (which I could detail if you'd like) all the way down to line 91 in `packages/kit/src/exports/vite/utils.js`, which performs an operation that Snyk believes an attacker shouldn't be allowed to manipulate. Another source of potentially tainted data (according to Snyk) comes from `‎packages/kit/src/exports/vite/utils.js`, line 30, col 30 (i.e., the `url` property of `req`). This potentially tainted data is passed through a number of steps (which I could detail if you'd like) all the way down line 91 in `packages/kit/src/exports/vite/utils.js`, which performs an operation that Snyk believes an attacker shouldn't be allowed to manipulate. ### PoC Not provided ### Impact Little to none. The Vite development is not exposed to the network by default. And even if someone were able to trick a developer into executing an XSS against themselves, a development database should not have any sensitive data.

CVE-2024-53261 Affected @sveltejs/kit Versions

1 component(s)
Fixed Versions:
2.8.3
Product / Package Ecosystem Affected Versions Fixed Version
@sveltejs/kit
npm
< 2.8.3
2.8.3

References

Frequently Asked Questions

What is CVE-2024-53261?
CVE-2024-53261 is a security vulnerability in @sveltejs/kit involving @sveltejs/kit vulnerable to XSS on dev mode 404 page under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which @sveltejs/kit versions are affected?
Affected versions include releases prior to 2.8.3 across affected packages: @sveltejs/kit.
What version fixes CVE-2024-53261?
Upgrading to 2.8.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @sveltejs/kit affected?
Yes, @sveltejs/kit is affected in releases prior to 2.8.3. Upgrade your dependency to 2.8.3 or later.
What is the CVSS score of CVE-2024-53261?
CVE-2024-53261 has a CVSS v3.1 base score of 0.0 (LOW) with vector string CVSS:3.1/AV:A/AC:L/PR:N/UI:R/S:C/C:N/I:N/A:N.
What CWE is associated with CVE-2024-53261?
CVE-2024-53261 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check npm dependencies for CVE-2024-53261?
Run the dependency tree command: 'npm ls @sveltejs/kit'. 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-rjjv-87mx-6x3h",
  "modified" : "2025-01-22T20:54:21Z",
  "published" : "2024-11-25T15:33:19Z",
  "aliases" : [ "CVE-2024-53261" ],
  "summary" : "@sveltejs/kit vulnerable to XSS on dev mode 404 page",
  "details" : "### Summary\n\n\"Unsanitized input from *the request URL* flows into `end`, where it is used to render an HTML page returned to the user. This may result in a Cross-Site Scripting attack (XSS).\"\n\n### Details\n\nSource of potentially tainted data is in `packages/kit/src/exports/vite/dev/index.js`, line 437. This potentially tainted data is passed through a number of steps (which I could detail if you'd like) all the way down to line 91 in `packages/kit/src/exports/vite/utils.js`, which performs an operation that Snyk believes an attacker shouldn't be allowed to manipulate.\n\nAnother source of potentially tainted data (according to Snyk) comes from `‎packages/kit/src/exports/vite/utils.js`, line 30, col 30 (i.e., the `url` property of `req`). This potentially tainted data is passed through a number of steps (which I could detail if you'd like) all the way down line 91 in `packages/kit/src/exports/vite/utils.js`, which performs an operation that Snyk believes an attacker shouldn't be allowed to manipulate.\n\n### PoC\n\nNot provided\n\n### Impact\n\nLittle to none. The Vite development is not exposed to the network by default. And even if someone were able to trick a developer into executing an XSS against themselves, a development database should not have any sensitive data.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:A/AC:L/PR:N/UI:R/S:C/C:N/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@sveltejs/kit"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.8.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/sveltejs/kit/security/advisories/GHSA-rjjv-87mx-6x3h"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-53261"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sveltejs/kit/pull/13039"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sveltejs/kit/commit/d338d4635a7fd947ba5112df6ee632c4a0979438"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/sveltejs/kit"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sveltejs/kit/releases/tag/%40sveltejs%2Fkit%402.8.3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-11-25T15:33:19Z",
    "nvd_published_at" : "2024-11-25T20:15:10Z"
  }
}