CVE-2024-53262: @sveltejs/kit @sveltejs/kit Has Unescaped Error Message Vulnerability

LOW
Advisory Identifier: GHSA-mh2x-fcqh-fmqv
CVSS 4.2
CWE-79
Published
Advisory Summary

CVE-2024-53262 is a LOW (CVSS 4.2) @sveltejs/kit has unescaped error message 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 has unescaped error message included on error page. Remediation is available by upgrading affected packages to version 2.8.3.

CVE-2024-53262 at a Glance

CVE Identifier CVE-2024-53262
GHSA Identifier GHSA-mh2x-fcqh-fmqv
Severity LOW
CVSS v3.1 Base Score 4.2
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: 4.2

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

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2024-53262

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-53262, 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 The static error.html template for errors contains placeholders that are replaced without escaping the content first. ### Details From https://kit.svelte.dev/docs/errors: > error.html is the page that is rendered when everything else fails. It can contain the following placeholders: %sveltekit.status% — the HTTP status %sveltekit.error.message% — the error message This leads to possible injection if an app explicitly creates an error with a message that contains user controlled content that ends up being something like this inside a server handle function: ```js error(500, '<script>alert("boom")</script>'); ``` Uncaught errors cannot be exploited like this, as they always render the message "Internal error". Escaping the message string in the function that creates the html output can be done to improve safety for applications that are using custom errors on the server. ### PoC None provided ### Impact Only applications where user provided input is used in the `Error` message will be vulnerable, so the vast majority of applications will not be vulnerable

CVE-2024-53262 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-53262?
CVE-2024-53262 is a security vulnerability in @sveltejs/kit involving @sveltejs/kit has unescaped error message included on error 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-53262?
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-53262?
CVE-2024-53262 has a CVSS v3.1 base score of 4.2 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N.
What CWE is associated with CVE-2024-53262?
CVE-2024-53262 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-53262?
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-mh2x-fcqh-fmqv",
  "modified" : "2024-11-25T21:46:57Z",
  "published" : "2024-11-25T15:32:45Z",
  "aliases" : [ "CVE-2024-53262" ],
  "summary" : "@sveltejs/kit has unescaped error message included on error page",
  "details" : "### Summary\n\nThe static error.html template for errors contains placeholders that are replaced without escaping the content first.\n\n### Details\n\nFrom https://kit.svelte.dev/docs/errors:\n\n> error.html is the page that is rendered when everything else fails. It can contain the following placeholders:\n%sveltekit.status% — the HTTP status\n%sveltekit.error.message% — the error message\n\nThis leads to possible injection if an app explicitly creates an error with a message that contains user controlled content that ends up being something like this inside a server handle function: \n```js\nerror(500, '<script>alert(\"boom\")</script>');\n```\nUncaught errors cannot be exploited like this, as they always render the message \"Internal error\".\n\nEscaping the message string in the function that creates the html output can be done to improve safety for applications that are using custom errors on the server.\n\n### PoC\n\nNone provided\n\n### Impact\n\nOnly applications where user provided input is used in the `Error` message will be vulnerable, so the vast majority of applications will not be vulnerable",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N/E:P"
  } ],
  "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-mh2x-fcqh-fmqv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-53262"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sveltejs/kit/pull/13050"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sveltejs/kit/commit/134e36343ef57ed7e6e2b3bb9e7f05ad37865794"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/sveltejs/kit"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sveltejs/kit/releases/tag/%40sveltejs%2Fkit%402.8.3"
  }, {
    "type" : "WEB",
    "url" : "https://kit.svelte.dev/docs/errors"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-11-25T15:32:45Z",
    "nvd_published_at" : "2024-11-25T20:15:10Z"
  }
}