{"id":"CVE-2026-126362","aliases":["CVE-2026-126362","GHSA-f4j9-crrj-867q"],"related":[],"kind":"vulnerability","state":"published","title":"Astro: Reflected XSS via unescaped slot names in @astrojs/svelte","summary":"Astro is a web framework for content-driven websites. From 5.7.3 until 9.1.2, the @astrojs/svelte renderer inserted a named slot into the quoted name attribute of an astro-slot wrapper without HTML escaping. Request-controlled slot names containing a quote could terminate the attribute and inject active HTML. Exploitation required a hydrated Svelte component using a client:* directive and dynamic rendering of the attacker-chosen slot; components that did not render that slot emitted only Astro's escaped fallback content. Both server rendering and client-side hydration used the unsafe slot name. This issue is fixed in version 9.1.2.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Astro is a web framework for content-driven websites. From 5.7.3 until 9.1.2, the @astrojs/svelte renderer inserted a named slot into the quoted name attribute of an astro-slot wrapper without HTML escaping. Request-controlled slot names containing a quote could terminate the attribute and inject active HTML. Exploitation required a hydrated Svelte component using a client:* directive and dynamic rendering of the attacker-chosen slot; components that did not render that slot emitted only Astro's escaped fallback content. Both server rendering and client-side hydration used the unsafe slot name. This issue is fixed in version 9.1.2.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nThe `@astrojs/svelte` renderer wraps slotted content passed to Svelte components in an `<astro-slot>` element, and writes the slot name into its `name` attribute without HTML escaping. A slot name containing `\"` could end the attribute and inject arbitrary HTML into the page.\n\nFor example, a page that takes a slot name from the request:\n\n```astro\n---\nimport Tabs from '../components/Tabs.svelte';\nconst tab = Astro.url.searchParams.get('tab');\n---\n<Tabs client:load active={tab}><div slot={tab}>…</div></Tabs>\n```\n\nrendered with a Svelte 5 component that renders its snippets by name:\n\n```svelte\n<script>\n\tlet { active, ...snippets } = $props();\n</script>\n{@render snippets[active]?.()}\n```\n\nwould output a `tab` value such as `x\"><img src=x onerror=alert(1)>` as live HTML.\n\n## Impact\n\nReflected cross-site scripting. An attacker who gets a user to open a crafted link can run JavaScript on the site's origin, but only in applications where all of the following are true:\n\n- The page passes request-controlled input (such as a query parameter) as a slot name.\n- The Svelte component is hydrated with a `client:*` directive. For non-hydrated components the slot wrapper is removed from the output, together with its `name` attribute.\n- The Svelte component renders the attacker-chosen slot, which in practice means a Svelte 5 component that renders snippets by a dynamic name. Components that never render the slot only output Astro's already escaped fallback template.\n\nThis is the `@astrojs/svelte` counterpart of GHSA-8hv8-536x-4wqp (CVE-2026-50146), which fixed the same issue in `astro` core. The same unescaped value was also used when hydrating the component in the browser.\n\n## Affected versions\n\n`@astrojs/svelte` >= 5.7.3, <= 9.1.1.\n\n## Patches\n\nFixed in `@astrojs/svelte` 9.1.2. Slot names are now HTML-escaped in the server renderer and in the client-side hydration code.\n\n## Workarounds\n\nUpgrade to `@astrojs/svelte` 9.1.2 or later. Before upgrading, do not use request-controlled input as a slot name, or map it to a fixed set of known slot names before passing it to a component.\n\n## Credits\n\nReported by @manus-pi.","format":"markdown","source":"ghsa"}],"published":"2026-11-12T22:29:19.505Z","modified":"2026-11-17T22:17:20.177Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N","score":2.3,"rating":"LOW"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N","score":2.3,"rating":"LOW"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N","rating":"LOW"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":">= 5.7.3, < 9.1.2","status":"affected"}],"vendor":"withastro","product":"astro","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"5.7.3","status":"affected","fixed":"9.1.2"}],"ecosystem":"npm","package":"@astrojs/svelte","purl":"pkg:npm/%40astrojs/svelte","source":"ghsa"}],"references":[{"url":"https://github.com/withastro/astro/security/advisories/GHSA-f4j9-crrj-867q","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/withastro/astro/commit/5e476365378e41aa2745d003b2383d02008d7b44","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/withastro/astro/releases/tag/@astrojs/svelte@9.1.2","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/withastro/astro","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-11-13T15:28:56.006Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-126362","url":"https://www.cve.org/CVERecord?id=CVE-2026-126362","licence":"CVE Terms of Use","modified":"2026-11-13T16:03:23.174Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-f4j9-crrj-867q","url":"https://github.com/advisories/GHSA-f4j9-crrj-867q","licence":"CC-BY-4.0","modified":"2026-11-12T22:45:03.571Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-126362","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-126362","licence":"Public domain","modified":"2026-11-17T22:17:20.177Z"}],"updatedAt":"2026-11-25T22:59:50.579Z","epss":{"score":0.00403,"percentile":0.36721,"date":"2026-12-01T12:00:22.000Z"}}