{"id":"CVE-2026-73422","aliases":["CVE-2026-73422","GHSA-4g3v-8h47-v7g6"],"related":[],"kind":"vulnerability","state":"published","title":"Astro: Reflected XSS via unescaped View Transition animation properties","summary":"Astro is a web framework for content-driven websites. From 2.9.0 until 7.1.0, Astro's server-side View Transition CSS generator interpolates animation properties into an inline style element without escaping them for CSS and HTML contexts. An attacker-controlled View Transition animation value such as duration can terminate the generated style element and inject arbitrary HTML or JavaScript. The affected code is packages/astro/src/runtime/server/transition.ts; renderTransition passes sheet.toString() into markHTMLString(), while addAnimationProperty serializes duration through toTimeValue() and also handles easing, direction, delay, fillMode, and name. Exploitation requires an on-demand or server-rendered route to pass attacker-controlled data into a View Transition animation definition and can execute arbitrary JavaScript in the affected application's origin, allowing access to sensitive page data and authenticated actions available to the victim. This issue is fixed in version 7.1.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Astro is a web framework for content-driven websites. From 2.9.0 until 7.1.0, Astro's server-side View Transition CSS generator interpolates animation properties into an inline style element without escaping them for CSS and HTML contexts. An attacker-controlled View Transition animation value such as duration can terminate the generated style element and inject arbitrary HTML or JavaScript. The affected code is packages/astro/src/runtime/server/transition.ts; renderTransition passes sheet.toString() into markHTMLString(), while addAnimationProperty serializes duration through toTimeValue() and also handles easing, direction, delay, fillMode, and name. Exploitation requires an on-demand or server-rendered route to pass attacker-controlled data into a View Transition animation definition and can execute arbitrary JavaScript in the affected application's origin, allowing access to sensitive page data and authenticated actions available to the victim. This issue is fixed in version 7.1.0.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nAstro's server-side View Transition CSS generator interpolates animation properties into an inline `<style>` element without escaping them for the CSS and HTML contexts.\n\nAn attacker-controlled value passed to an animation property such as `duration` can contain a `</style>` sequence, terminate the generated style element, and inject arbitrary HTML or JavaScript.\n\nThis is similar to GHSA-8hv8-536x-4wqp, but exploits a different injection point: unescaped View Transition animation values in a server-generated `<style>` element rather than an unescaped slot name in a hydration template.\n\nLike GHSA-8hv8-536x-4wqp, exploitation requires an application to pass attacker-controlled data to an Astro API. However, the value is subsequently inserted into the HTML response without context-appropriate escaping by Astro.\n\n\n## Details\n\n\n`packages/astro/src/runtime/server/transition.ts`\n\nThe generated stylesheet is wrapped in a `<style>` element and marked as HTML-safe:\n\n```ts\nconst css = sheet.toString();\nresult._metadata.extraHead.push(markHTMLString(`<style>${css}</style>`));\n```\n\nAnimation properties are added to the stylesheet without escaping:\n\n```ts\nif (anim.duration) {\n  addAnimationProperty(builder, 'animation-duration', toTimeValue(anim.duration));\n}\n```\n\nFor string values, `toTimeValue()` returns the input unchanged:\n\n```ts\nexport function toTimeValue(num: number | string) {\n  return typeof num === 'number' ? num + 'ms' : num;\n}\n```\n\nAs a result, a `duration` value containing `</style>` can escape from the generated style element.\n\nOther `TransitionAnimation` properties, including `easing`, `direction`, `delay`, `fillMode`, and `name`, are serialized by the same animation builder. The following PoC only relies on the official `fade()` helper and its `duration` option.\n\n\n## PoC\n\nUsing:\n\n- `astro@7.0.9`\n- `@astrojs/node@11.0.2`\n\n### `astro.config.mjs`\n\n```js\nimport node from '@astrojs/node';\nimport { defineConfig } from 'astro/config';\n\nexport default defineConfig({\n  output: 'server',\n  adapter: node({ mode: 'standalone' }),\n});\n```\n\n### `src/pages/index.astro`\n\n```astro\n---\nimport { fade } from 'astro:transitions';\n\nconst duration = Astro.url.searchParams.get('duration') ?? '300ms';\n---\n\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <title>PoC</title>\n  </head>\n  <body>\n    <div transition:animate={fade({ duration })}>\n      Animated content\n    </div>\n  </body>\n</html>\n```\n\n### Payload:\n\nopen:\n\n```text\nhttp://localhost:4321/?duration=%3C%2Fstyle%3E%3Cscript%3Ealert(1)%3C%2Fscript%3E%3C!--\n```\n\nThe browser interprets `</style>` as the end of the generated style element and executes the injected script. An alert dialog is displayed when the page is opened.\n\n<img width=\"1307\" height=\"681\" alt=\"image\" src=\"https://github.com/user-attachments/assets/0834236d-008f-415f-9f23-db509ab6f8f6\" />\n\n## Impact\n\nAn attacker who can control a View Transition animation value can execute arbitrary JavaScript in the origin of the affected Astro application.\n\nThe query-based reflected XSS scenario affects on-demand/server-rendered routes, such as:\n\n- projects configured with `output: \"server\"`;\n- pages using `export const prerender = false`;\n- other server-side data flows that pass attacker-controlled values into a View Transition animation definition.\n\nSuccessful exploitation may allow access to sensitive page data and authenticated actions available to the victim.\n\n## Suggested Fix\n\nAnimation values should be serialized using context-appropriate CSS escaping or validation before being added to the generated stylesheet.\n\nAdditionally, content inserted into a raw `<style>` element must not be able to contain an HTML end-tag sequence such as `</style>`. The final generated CSS should be made safe for the HTML raw-text context before it is passed to `markHTMLString()`.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Astro es un framework web para sitios web basados en contenido. Desde la versión 2.9.0 hasta la 7.1.0, el generador CSS de View Transition del lado del servidor de Astro interpola propiedades de animación en un elemento de estilo en línea sin escaparlas para contextos CSS y HTML. Un valor de animación de View Transition controlado por el atacante, como la duración, puede terminar el elemento de estilo generado e inyectar HTML o JavaScript arbitrario. El código afectado es packages/astro/src/runtime/server/transition.ts; renderTransition pasa sheet.toString() a markHTMLString(), mientras que addAnimationProperty serializa la duración a través de toTimeValue() y también maneja easing, direction, delay, fillMode y name. La explotación requiere que una ruta bajo demya o renderizada por el servidor pase datos controlados por el atacante a una definición de animación de View Transition y puede ejecutar JavaScript arbitrario en el origen de la aplicación afectada, permitiendo el acceso a datos sensibles de la página y acciones autenticadas disponibles para la víctima. Este problema está solucionado en la versión 7.1.0.","source":"nvd"}],"published":"2026-07-20T21:08:16.000Z","modified":"2026-10-24T15:10:00.190Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","score":5.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":">= 2.9.0, < 7.1.0","status":"affected"}],"vendor":"withastro","product":"astro","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"2.9.0","status":"affected","fixed":"7.1.0"}],"ecosystem":"npm","package":"astro","purl":"pkg:npm/astro","source":"ghsa"}],"references":[{"url":"https://github.com/withastro/astro/security/advisories/GHSA-4g3v-8h47-v7g6","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/withastro/astro/pull/17393","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/withastro/astro/commit/092da560eea77ee63a3e2c583c80d8238544e42b","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/withastro/astro/releases/tag/astro@7.1.0","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":"poc","automatable":"no","technicalImpact":"partial","date":"2026-08-14T22:12:08.649Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-73422","url":"https://www.cve.org/CVERecord?id=CVE-2026-73422","licence":"CVE Terms of Use","modified":"2026-08-14T22:12:40.307Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-4g3v-8h47-v7g6","url":"https://github.com/advisories/GHSA-4g3v-8h47-v7g6","licence":"CC-BY-4.0","modified":"2026-08-12T20:56:01.810Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-73422","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-73422","licence":"Public domain","modified":"2026-10-24T15:10:00.190Z"}],"updatedAt":"2026-11-25T22:59:32.659Z","epss":{"score":0.00465,"percentile":0.41948,"date":"2026-12-01T12:00:22.000Z"}}