5.4medium
SvelteKit allows XSS via tracked search_params
- Severity
- 5.4medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.31% (higher than 25% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-6q87-84jw-cjhp
Description
SvelteKit is a framework for rapidly developing robust, performant web applications using Svelte. Prior to 2.20.6 , unsanitized search param names cause XSS vulnerability. You are affected if you iterate over all entries of event.url.searchParams inside a server load function. Attackers can exploit it by crafting a malicious URL and getting a user to click a link with said URL. This vulnerability is fixed in 2.20.6.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| sveltejs kit | >= 2.0.0, < 2.20.6 | CVE List |
| @sveltejs/kit (npm) | from 2.0.0 before 2.20.6 | GitHub Advisory Database |
All scores
| GitHub_M | 5.4medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N |
| GitHub | 5.4medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.
What each source says
CVE List
SvelteKit is a framework for rapidly developing robust, performant web applications using Svelte. Prior to 2.20.6 , unsanitized search param names cause XSS vulnerability. You are affected if you iterate over all entries of event.url.searchParams inside a server load function. Attackers can exploit it by crafting a malicious URL and getting a user to click a link with said URL. This vulnerability is fixed in 2.20.6.
GitHub Advisory Database
Summary
Unsanitized search param names cause XSS vulnerability. You are affected if you iterate over all entries of event.url.searchParams inside a server load function. Attackers can exploit it by crafting a malicious URL and getting a user to click a link with said URL.
Details
SvelteKit tracks which parameters in event.url.searchParams are read inside server load functions. If the application iterates over the these parameters, the uses.search_params array included in the boot script (embedded in the server-rendered HTML) will have any search param name included in unsanitized form.
packages/kit/src/runtime/server/utils.js:150 has the stringify_uses(node) function which prints these out.
Reproduction
In a +page.server.js or +layout.server.js:
/** @type {import('@sveltejs/kit').Load} */
export function load(event) {
const values = {};
for (const key of event.url.searchParams.keys()) {
values[key] = event.url.searchParams.get(key);
}
}
If a user visits the page in question via a link containing ?</script/><script>window.pwned%3D1</script/>, the </script> will be included verbatim in the payload, causing the embedded script to be executed.
It is not necessary to return the parameter value from load or render it in the page, only to read it (which causes it to be tracked as a dependency) while load is running.
Impact
Any application that iterates over all values in event.url.searchParams in a load function in +page.server.js or +layout.server.js (directly or indirectly) is vulnerable to XSS.
NVD (es)
SvelteKit es un framework para desarrollar rápidamente aplicaciones web robustas y de alto rendimiento con Svelte. Antes de la versión 2.20.6, los nombres de parámetros de búsqueda sin sanear causaban una vulnerabilidad XSS. Se ve afectado si se itera sobre todas las entradas de event.url.searchParams dentro de una función de carga del servidor. Los atacantes pueden explotar esta vulnerabilidad manipulando una URL maliciosa y haciendo que el usuario haga clic en un enlace con dicha URL. Esta vulnerabilidad se corrigió en la versión 2.20.6.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-32388 changed 2025-04-16 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-6q87-84jw-cjhp changed 2025-04-16 | CC-BY-4.0 |
| NVD | CVE-2025-32388 changed 2026-06-17 | Public domain |