CVE-2022-25875: Svelte vulnerable to XSS when using objects during server-side rendering
6.1
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.64758%
CWE
Published
7/13/2022
Updated
9/7/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| svelte | npm | < 3.49.0 | 3.49.0 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from two key issues in SSR attribute handling: 1) escape_attribute_value previously only escaped string values, leaving objects (including those with custom toString()) unescaped. 2) add_attribute directly used value.toString() without sufficient escaping. The patch addresses both by modifying escape_attribute_value to handle objects and changing add_attribute to use the escape function directly. The commit diff shows these functions were modified to fix improper attribute escaping, confirming their role in the vulnerability.