CVE-2026-27902
JavaScript vulnerability analysis and mitigation

Overview

CVE-2026-27902 is a Cross-Site Scripting (XSS) vulnerability in the Svelte performance-oriented web framework, specifically affecting its Server-Side Rendering (SSR) error boundary hydration markers. Prior to version 5.53.5, errors returned from the transformError function were not correctly escaped before being embedded in HTML output as hydration comments, enabling HTML injection and XSS if attacker-controlled content flows through transformError. The vulnerability affects Svelte versions 5.53.0 through 5.53.4 (inclusive) for Node.js. It was published on February 25–26, 2026, with a fix released the same day. The CVSS v4 base score is 5.3 (Medium) (Github Advisory, Svelte Advisory).

Technical details

The root cause is CWE-79 (Improper Neutralization of Input During Web Page Generation — Cross-site Scripting). During SSR, Svelte embeds error data from transformError as JSON inside HTML comments used as hydration boundary markers (e.g., <!--<svelte:boundary failed=...-->) without sanitizing special HTML comment sequences such as --> or --!>. An attacker who can control the content returned by transformError — for example, by injecting malicious input into an error message that propagates through the error transformation pipeline — can break out of the HTML comment context and inject arbitrary HTML or JavaScript. The fix, applied in commit 0298e97, introduces a #serialize_failed_boundary method that Unicode-escapes < characters in the JSON payload (e.g., --> becomes -->) to prevent comment breakout (Svelte Advisory, Fix Commit). Exploitation requires that the application passes attacker-influenced data into transformError and that a victim user loads the affected SSR-rendered page.

Impact

Successful exploitation allows an attacker to inject and execute arbitrary JavaScript in the context of a victim user's browser session on the affected Svelte application. This can lead to session hijacking, credential theft, malware distribution, or unauthorized actions performed on behalf of the victim. The CVSS v4 scoring reflects high subsequent-system confidentiality and integrity impact, indicating that downstream systems accessible via the user's session are also at risk (Github Advisory, Feedly). Availability is not directly impacted by this vulnerability.

Exploitation steps

  1. Identify a target application: Locate a web application built with Svelte 5.53.0–5.53.4 using SSR (server-side rendering) with error boundaries and a transformError handler that incorporates user-supplied input into error messages.
  2. Craft a malicious input: Prepare a payload that, when passed through transformError, produces an error message containing HTML comment-breaking sequences such as --><img src=x onerror=alert(1)><!-- or --!><img src=x onerror=alert(1)><!--.
  3. Trigger the error boundary: Submit the crafted input to the application in a way that causes the SSR error boundary to invoke transformError with the attacker-controlled content (e.g., via a search query or form field that is passed to a function that throws an error).
  4. Observe HTML injection: The server renders the page with the unescaped error content embedded in an HTML hydration comment, breaking out of the comment context and injecting the attacker's HTML/JavaScript into the page source.
  5. Deliver to victim: Distribute a link to the crafted URL to a victim user. When the victim loads the page, the injected script executes in their browser, enabling session theft, credential harvesting, or other malicious actions (Svelte Advisory, Fix Commit).

Indicators of compromise

  • Network: HTTP requests to SSR-rendered Svelte pages containing URL-encoded HTML comment-breaking sequences (-->, --!>) in query parameters or form fields; unexpected outbound connections from victim browsers to attacker-controlled domains following page load.
  • Logs: Server-side logs showing requests with parameters containing -->, --!>, or <script patterns in inputs that flow into error-handling code; SSR rendering logs with unusual error messages containing HTML special characters.
  • File System / Response Content: SSR-rendered HTML responses containing unescaped --> sequences within <!--<svelte:boundary hydration comments, or unexpected <img>, <script>, or event handler attributes appearing outside of comment boundaries in the page source.
  • Browser: Unexpected JavaScript execution (e.g., alert dialogs, network requests to unknown domains) triggered on page load for pages using Svelte error boundaries (Svelte Advisory).

Mitigation and workarounds

The primary remediation is to upgrade Svelte to version 5.53.5 or later, which sanitizes transformError output by Unicode-escaping < characters before embedding JSON in HTML hydration comments (Svelte Release, Fix Commit). No official workaround short of upgrading has been published; however, as an interim measure, developers should ensure that any custom transformError implementations sanitize or strip HTML special characters from error messages before returning them. Additionally, reviewing all error-handling code to prevent attacker-controlled data from reaching transformError output can reduce exposure (Github Advisory).

Community reactions

The vulnerability was reported and remediated by the Svelte security team, with credits to researcher elliott-with-the-longest-name-on-github (reporter), KarimPwnz (remediation developer), and maksyche (remediation reviewer) (Svelte Advisory). Red Hat tracked the issue via Bugzilla and assigned it medium priority/severity (Red Hat Bugzilla). The Svelte 5.53.5 release received positive community reactions on GitHub, with 10 users reacting favorably to the patch (Svelte Release). No significant broader media coverage or threat actor commentary has been observed.

Additional resources


SourceThis report was generated using AI

Related JavaScript vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-71319CRITICAL9.6
  • JavaScript logoJavaScript
  • @nuxt/devtools
NoYesAug 05, 2026
CVE-2026-70611MEDIUM6.9
  • JavaScript logoJavaScript
  • electron
NoYesAug 05, 2026
CVE-2026-70609MEDIUM5.7
  • JavaScript logoJavaScript
  • electron
NoYesAug 05, 2026
CVE-2026-70612MEDIUM5.4
  • JavaScript logoJavaScript
  • electron
NoYesAug 05, 2026
CVE-2026-70610MEDIUM5.4
  • JavaScript logoJavaScript
  • electron
NoYesAug 05, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management