CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-F3CJ-J4F6-WQ85

GHSA-f3cj-j4f6-wq85: Server-Side Rendering Cross-Site Scripting in Svelte hydratable Promises

Alon Barad
Alon Barad
Software Engineer

May 15, 2026·6 min read·13 visits

Executive Summary (TL;DR)

Svelte versions prior to 5.55.7 contain an XSS vulnerability in the `hydratable` SSR feature. Attackers can leverage the '$' replacement token in promise values to execute arbitrary JavaScript in the victim's browser.

A critical Cross-Site Scripting (XSS) vulnerability exists in the Server-Side Rendering (SSR) engine of the Svelte framework. The vulnerability occurs due to insecure promise serialization within the experimental `hydratable` feature. Attackers controlling the output of a resolved promise can inject JavaScript string replacement tokens, causing the SSR engine to duplicate template strings into executable script blocks.

Vulnerability Overview

The Svelte framework provides server-side rendering (SSR) capabilities to pre-render applications into HTML strings. A recent experimental feature, hydratable, allows developers to serialize promises during SSR and resolve them on the client side. This vulnerability (GHSA-f3cj-j4f6-wq85) resides specifically within the serialization logic of this feature.

The flaw requires developers to pass attacker-controlled input into a promise evaluated by the hydratable function. If the attacker supplies input containing specific JavaScript string replacement tokens, the Svelte rendering engine misinterprets the data. This behavior allows the attacker to break out of the intended string literal context and inject arbitrary JavaScript payloads into the generated HTML document.

According to CVSS v4.0 metrics, the vulnerability carries a base score of 9.1. The attack vector is network-based, requires low privileges, and mandates specific usage conditions within the target application. Once exploited, the vulnerability results in high impact to the confidentiality and integrity of the subsequent system, defined in this context as the end user's web browser.

Applications not utilizing the experimental hydratable feature remain unaffected. Organizations employing Svelte must assess their codebases for calls to this specific function that process untrusted data.

Root Cause Analysis

The core vulnerability stems from the insecure usage of the String.prototype.replace() method within Svelte's hydratable serialization pipeline. The vulnerable module, located at packages/svelte/src/internal/server/hydratable.js, manages the insertion of resolved promise values into a pre-computed HTML template string. The engine utilizes the uneval function from the devalue library to serialize the output safely.

When String.prototype.replace() receives a string as its second argument, the JavaScript runtime evaluates specific character sequences starting with a dollar sign ($) as special replacement patterns. For example, the token $' instructs the runtime to insert the portion of the source string that follows the matched substring. Other tokens, such as $& (matched substring) and $n (captured groups), exhibit similar dynamic behavior.

The Svelte SSR engine constructs the final template by calling .replace(placeholder, string) where the replacement string contains the attacker-controlled, serialized promise value. The devalue library correctly escapes standard HTML injection characters such as < and /. However, it does not escape the $ character, as it is a valid literal character within standard JavaScript string literals.

By supplying the $' token, an attacker forces the replace function to copy the trailing portion of the pre-computed template string and insert it directly into the serialized output. This mechanism breaks the syntax of the generated JavaScript execution block. The injected trailing string closes the intended variable assignment and allows subsequent payload bytes to execute as arbitrary code in the browser context.

Code Analysis

The original implementation of packages/svelte/src/internal/server/hydratable.js evaluated the serialization using a string literal as the replacement parameter. The code dynamically constructed a function call r() containing the output of uneval().

// Vulnerable implementation
entry.serialized = entry.serialized.replace(placeholder, `r(${uneval(v)})`);

If the attacker controls v and sets it to $', uneval(v) returns the literal string "$'". The replacement string becomes r("'"). When evaluated by String.prototype.replace(), the $' sequence is processed as a replacement token rather than a literal string, duplicating the template suffix.

The patch addresses this structural flaw by utilizing the functional form of String.prototype.replace(). When the second argument is a callback function, the JavaScript engine treats the function's return value as a strictly literal replacement string. The engine bypasses the evaluation of $ replacement tokens entirely.

// Patched implementation (commit a16ebc67bbcf8f708360195687e1b2719463e1a4)
entry.serialized = entry.serialized.replace(
    placeholder,
    () => `r(${uneval(v)})`
);

This simple architectural change neutralizes the vulnerability class. The return string is injected exactly as constructed, ensuring that the JavaScript literal context remains bounded. The patch was uniformly applied across the core SSR module and corresponding playground components (ssr-dev.js and ssr-prod.js).

Exploitation

Exploitation of this vulnerability requires the target application to accept user input and pass it directly into the resolution of a hydratable promise. The attacker does not require direct access to the server infrastructure; the injection vector operates entirely through the standard application input channels.

The attacker crafts a specific string payload containing the $' token. In a standard attack, the payload combines the replacement token with standard JavaScript syntax designed to escape the current scope and execute arbitrary commands. A theoretical payload might look like $'};alert(document.domain);//.

The provided test case from the Svelte codebase demonstrates the exact mechanical failure. When the SSR engine evaluates hydratable('key', () => Promise.resolve($')), the generated HTML output is corrupted. The script tag containing the serialized state receives a duplicated section of the page template.

// Exploitation Proof of Concept
test('treats replacement tokens in hydratable promise values as literals', async () => {
    const component = (renderer: Renderer) => {
        hydratable('key', () => Promise.resolve(`$'`));
        // ... render logic ...
    };
    const { head } = await Renderer.render(component as unknown as Component);
    // The resulting head string contains the XSS payload
});

When a victim visits the pre-rendered page, the browser parses the HTML document. The malformed <script> block, containing the attacker's payload, is executed synchronously during document parsing. This allows the attacker to execute code within the origin of the vulnerable application.

Impact Assessment

The primary impact of this vulnerability is arbitrary JavaScript execution within the context of the user's browser session. Cross-Site Scripting allows attackers to bypass the Same-Origin Policy (SOP). The severity is reflected in the CVSS v4.0 vector CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:N.

Attackers successfully exploiting this flaw gain full read and write access to the DOM of the affected application. They can exfiltrate sensitive data, including session tokens, CSRF tokens, and local storage contents. The attacker can also perform unauthorized actions on behalf of the victim by issuing authenticated API requests.

While the consequences of the XSS are severe, the attack surface is constrained by the application's architecture. The vulnerable code path strictly requires the usage of the experimental hydratable feature. Applications relying solely on standard Svelte state management or non-hydrated SSR pipelines are fundamentally immune to this vector.

Remediation

The definitive remediation for this vulnerability is upgrading the svelte package to version 5.55.7 or later. The patch modifies the internal serialization logic to properly handle replacement tokens, ensuring that user input cannot alter the structural integrity of the generated HTML template.

Developers must audit their application codebases for instances of the hydratable function. If immediate patching is not feasible, implement strict input validation on all data passed into hydrated promises. Specifically, block or sanitize the dollar sign character ($) in data intended for SSR serialization.

Organizations should also enforce a strict Content Security Policy (CSP). Implementing CSP directives such as script-src with nonces or strict hash requirements significantly mitigates the impact of XSS vulnerabilities. While a CSP does not patch the underlying engine flaw, it prevents the execution of unauthorized inline scripts and external payloads.

Official Patches

SvelteFix commit in Svelte repository
SvelteOfficial GitHub Security Advisory

Fix Analysis (1)

Technical Appendix

CVSS Score
9.1/ 10
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:N

Affected Systems

Svelte SSR EngineSvelte applications utilizing the experimental `hydratable` feature with untrusted data

Affected Versions Detail

Product
Affected Versions
Fixed Version
svelte
Svelte
>= 5.46.0, < 5.55.75.55.7
AttributeDetail
CWE IDCWE-79
Attack VectorNetwork
CVSS v4.09.1 (Critical)
ImpactHigh Confidentiality, High Integrity (Subsequent System)
Exploit StatusPoC Available
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1059.007Command and Scripting Interpreter: JavaScript
Execution
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The software 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.

Vulnerability Timeline

Security advisory GHSA-f3cj-j4f6-wq85 published on GitHub and OSV.
2026-05-14
Fix commit a16ebc67bbcf8f708360195687e1b2719463e1a4 merged.
2026-05-14
Svelte version 5.55.7 released addressing the vulnerability.
2026-05-14

References & Sources

  • [1]GitHub Security Advisory GHSA-f3cj-j4f6-wq85
  • [2]Svelte Patch Commit
  • [3]Svelte 5.55.7 Release Notes
  • [4]OSV Vulnerability Record
  • [5]MDN Documentation: String.prototype.replace()

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•1 day ago•CVE-2026-55699
6.5

CVE-2026-55699: Arbitrary Directory Deletion via Path Traversal in pnpm globalBinDir Resolver

CVE-2026-55699 (also identified as GHSA-4gxm-v5v7-fqc4) is a critical path traversal and arbitrary directory deletion vulnerability in the pnpm package manager. The issue exists because the manifest validation process fails to prevent relative path segments within the package 'bin' keys. When a malicious package containing structured path traversal markers is globally installed and later manipulated, pnpm resolves the target paths through path.join() and passes the resolved paths to a recursive deletion function, resulting in arbitrary directory removal.

Amit Schendel
Amit Schendel
9 views•6 min read
•1 day ago•CVE-2026-55700
7.1

CVE-2026-55700: Path Traversal and Arbitrary File Write in pnpm stage download

A path traversal vulnerability in pnpm stage download allows malicious registries or compromised package manifests to overwrite arbitrary files on the victim's filesystem via unvalidated package name and version fields.

Alon Barad
Alon Barad
9 views•4 min read
•1 day ago•GHSA-WW5P-J6CJ-6MQQ
5.5

GHSA-WW5P-J6CJ-6MQQ: Credential Exposure in Nezha Dashboard DDNS and Notification APIs

GHSA-WW5P-J6CJ-6MQQ is a technical credential exposure vulnerability in Nezha Dashboard prior to version 2.2.5. The vulnerability allows authenticated administrative users or actors possessing scoped read-only Personal Access Tokens (PATs) to exfiltrate plaintext third-party API credentials, secret keys, and webhook authorization headers due to a lack of data redaction during API object serialization.

Amit Schendel
Amit Schendel
9 views•7 min read
•1 day ago•GHSA-FR4H-3CPH-29XV
7.1

GHSA-FR4H-3CPH-29XV: Path Traversal and Directory Hijacking in pnpm and pacquet Dependency Resolution

GHSA-FR4H-3CPH-29XV is a high-severity path traversal vulnerability in pnpm and its Rust-based port pacquet. The flaw manifests when using the hoisted node-linker configuration, allowing an attacker to manipulate the lockfile to resolve relative traversal sequences or target reserved subdirectories, leading to arbitrary file write or execution hijacking.

Amit Schendel
Amit Schendel
7 views•8 min read
•2 days ago•GHSA-72R4-9C5J-MJ57
7.1

GHSA-72R4-9C5J-MJ57: Arbitrary File Deletion via Path Traversal in pnpm patch-remove

A path traversal vulnerability in the pnpm package manager's 'patch-remove' command allows an attacker to delete arbitrary files outside the patches directory. By manipulating configuration files like package.json, an attacker can specify a traversal path that the application deletes recursively without validating the path's containment.

Alon Barad
Alon Barad
6 views•5 min read
•2 days ago•GHSA-QRV3-253H-G69C
8.3

GHSA-QRV3-253H-G69C: Path Traversal and Arbitrary Symlink Creation via configDependencies in pnpm

A high-severity path traversal vulnerability exists in the pnpm package manager. By crafting a malicious lockfile (pnpm-lock.yaml) with path traversal characters in the configDependencies block, an attacker can create arbitrary directories and symlinks outside the project's node_modules/.pnpm-config directory. This exploitation happens automatically during pnpm installation, even when executing with scripts disabled via the --ignore-scripts flag.

Amit Schendel
Amit Schendel
7 views•7 min read