Executive brief
Svelte is a popular JavaScript framework used to build web applications. A vulnerability in how it handles data keys when rendering pages on the server allows attackers to inject malicious code that runs in users' browsers, potentially stealing sessions, hijacking accounts, or performing unauthorized actions.
Technical details
A cross-site scripting (XSS) vulnerability exists in Svelte 5.46.0 through 5.46.3 in the hydratable function, which is used for server-side rendering with client-side hydration. The vulnerability occurs because keys passed as the first argument to hydratable are embedded directly into a <script> block in the server-rendered HTML without proper escaping of unsafe characters. An attacker who can control the key parameter (by supplying untrusted user input) can break out of the script context and inject arbitrary JavaScript into the HTML response. This requires the experimental.async flag to be enabled and affects only applications that use hydratable with user-controlled keys. The vulnerability is remotely exploitable in a single HTTP request with no special privileges required, though passive user interaction (loading the page) is needed.
Affected products
- Svelte Svelte 5.46.0 to 5.46.3
Timeline
- 2026-01-15: disclosed
- 2026-01-15: patched: Fixed in version 5.46.4