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·34 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

•2 days ago•CVE-2026-58254
6.5

CVE-2026-58254: Authorization Bypass in NATS Server Message Tracing for Leaf Node Connections

NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.

Alon Barad
Alon Barad
11 views•10 min read
•2 days ago•CVE-2026-63341
7.5

CVE-2026-63341: Unauthenticated Denial of Service via Unbounded Topic Depth in Aedes MQTT Broker

CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.

Alon Barad
Alon Barad
16 views•12 min read
•2 days ago•CVE-2026-61725
6.1

CVE-2026-61725: Path Traversal and Arbitrary File Overwrite in sevenz-rust2

CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.

Alon Barad
Alon Barad
6 views•12 min read
•2 days ago•CVE-2026-77309
8.8

CVE-2026-77309: Unauthenticated Remote Code Execution in NASA-AMMOS AIT-GUI via Incomplete File Cleanup and Path Traversal

CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.

Amit Schendel
Amit Schendel
16 views•10 min read
•2 days ago•CVE-2026-77332
2.3

CVE-2026-77332: Surfaced-Memory Envelope Injection and Stored Prompt Injection in memtomem-stm

A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.

Alon Barad
Alon Barad
19 views•10 min read
•2 days ago•CVE-2026-77331
2.0

CVE-2026-77331: Race Condition and Session State Corruption in memtomem-stm

CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.

Amit Schendel
Amit Schendel
8 views•9 min read