Executive brief
Astro is a web framework that supports animated page transitions. The framework generates inline CSS for these transitions without properly escaping animation property values. An attacker who can inject values into animation properties (such as duration via URL query parameters) can break out of the CSS style element and inject malicious JavaScript that executes in users' browsers. This affects applications that pass user-supplied data directly to Astro's transition animation APIs.
Technical details
This is a reflected XSS vulnerability in Astro's View Transition CSS generation logic (packages/astro/src/runtime/server/transition.ts). The vulnerability occurs because animation property values are added to a stylesheet without context-appropriate escaping and then wrapped in an HTML style element marked as safe. The toTimeValue() function returns string inputs unchanged, allowing a value like `</style><script>alert(1)</script><!--` to terminate the style element and inject arbitrary HTML or JavaScript. The vulnerability affects server-rendered routes (output: "server") and on-demand rendered pages. Successful exploitation allows arbitrary JavaScript execution with the privileges of the authenticated user. The vulnerability was patched in version 7.1.0 by adding CSS escaping for animation properties before embedding them in the generated stylesheet.
Affected products
- Astro Astro >=2.9.0, <=7.0.9
Timeline
- 2026-07-20: disclosed: GHSA-4g3v-8h47-v7g6 published
- 2026-07-15: patched: Fix merged in PR #17393
- 2026-07-16: other: Patch released in version 7.1.0