sveltejs/svelte · Security
svelte is vulnerable to XSS with textarea bind:value
- GHSA ID
- GHSA-gw32-9rmw-qwww
- Severity
- high
- Published
- Updated
- CVSS v4
- 8.4 · 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
Description
Summary
A server-side rendered <textarea> with two-way bound value does not have its value correctly escaped in the rendered HTML.
Details
In SSR, <textarea bind:value={...}> does not have its value escaped when it is rendered into the HTML as <textarea>...</textarea>.
PoC
Put this in a server-side-rendered Svelte component:
<script>
let value = `test'"></textarea><script` + `>alert('BIM');</sc` + `ript>`;
</script>
<textarea bind:value />
Impact
- Only affects SSR
- Needs a
<textarea bind:value>filled by user content via two-way binding
CWEs
- CWE-79 · Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')