Executive brief
Astro is a web framework used to build and render websites. A security flaw in how it handles component properties allows attackers to inject malicious code into web pages if the site uses data from untrusted sources like web addresses or external databases. If exploited, this could allow an attacker to steal user session information, deface the website, or trick users into providing sensitive credentials.
Technical details
A Cross-Site Scripting (XSS) vulnerability exists in Astro's server-side rendering pipeline within the spreadAttributes function. The root cause is that while attribute values are escaped, the attribute keys (names) are interpolated directly into the HTML output without sanitization or escaping. An attacker can provide a malicious object where the keys contain double quotes and JavaScript event handlers (e.g., 'onmousemove'). When these keys are processed via the spread syntax {...props} on an HTML element, they break out of the attribute context to execute arbitrary JavaScript. This affects both SSR and static builds if the data source is untrusted. The issue is resolved in version 6.4.6.
Affected products
- withastro Astro < 6.4.6
Timeline
- 2026-06-12: advisory: GitHub Security Advisory published
- 2026-06-22: disclosed: NVD publication date
- 2026-06-22: patched: Fix confirmed in version 6.4.6