GHSA-GW32-9RMW-QWWW: Svelte SSR XSS: The Textarea Trap

Published: (January 16, 2026 at 10:03 PM EST)
1 min read
Source: Dev.to

Source: Dev.to

Vulnerability Overview

  • ID: GHSA-GW32-9RMW-QWWW
  • CVSS Score: 8.4 (High)
  • Published: 2026-01-16
  • CWE: CWE-79
  • Vector: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:L/VA:N/SC:H/SI:H/SA:N
  • Attack Vector: Network
  • Type: XSS (Cross‑Site Scripting)

Description

A high‑severity XSS vulnerability exists in Svelte’s Server‑Side Rendering (SSR) compiler. The compiler fails to escape the content of bind:value directives on <textarea> elements during SSR. Because <textarea> contents are children, not attributes, an attacker can inject </textarea> to break out of the tag context and execute arbitrary JavaScript.

The issue is fixed in Svelte 3.59.2.

Affected Versions

  • Svelte ≥ 3.0.0 < 3.59.2
  • SvelteKit applications using SSR mode with the vulnerable compiler

Fix

The patch escapes textarea children during SSR:

@@ -149,7 +149,7 @@ export default function (node: Element, renderer: Renderer, options: RenderOptio
            // value = name === 'textContent' ? x`@escape($$value)` : x`$$value`;
        } else if (binding.name === 'value' && node.name === 'textarea') {
            const snippet = expression.node;
-           node_contents = x`${snippet} || ""`;
+           node_contents = x`@escape(${snippet} || "")`;
        } else if (binding.name === 'value' && node.name === 'select') {

Remediation Steps

  1. Check the Svelte version in package.json.

  2. Upgrade to Svelte 3.59.2 or later:

    npm install svelte@latest
    # or
    yarn upgrade svelte
  3. Verify the installed version:

    npm list svelte
  4. Rebuild and redeploy the application to ensure the compiler generates safe code.

References

Back to Blog

Related posts

Read more »

𝗗𝗲𝘀𝗶𝗴𝗻𝗲𝗱 𝗮 𝗣𝗿𝗼𝗱𝘂𝗰𝘁𝗶𝗼𝗻‑𝗥𝗲𝗮𝗱𝘆 𝗠𝘂𝗹𝘁𝗶‑𝗥𝗲𝗴𝗶𝗼𝗻 𝗔𝗪𝗦 𝗔𝗿𝗰𝗵𝗶𝘁𝗲𝗰𝘁𝘂𝗿𝗲 𝗘𝗞𝗦 | 𝗖𝗜/𝗖𝗗 | 𝗖𝗮𝗻𝗮𝗿𝘆 𝗗𝗲𝗽𝗹𝗼𝘆𝗺𝗲𝗻𝘁𝘀 | 𝗗𝗥 𝗙𝗮𝗶𝗹𝗼𝘃𝗲𝗿

!Architecture Diagramhttps://dev-to-uploads.s3.amazonaws.com/uploads/articles/p20jqk5gukphtqbsnftb.gif I designed a production‑grade multi‑region AWS architectu...