CVE-2026-54298
Summary
The spreadAttributes function in Astro's server-side rendering pipeline iterates over object keys and passes them directly to addAttribute, which interpolates the key into the HTML output without escaping. When a developer uses the spread syntax {...props} on an HTML element and the object keys come from an untrusted source (API, CMS, URL parameters), an attacker can inject arbitrary HTML attributes including event handlers like onmousemove, onclick, or break out of the attribute context entirely to inject new elements.
Details
The vulnerable function is addAttribute at packages/astro/src/runtime/server/render/util.ts:81-141:
export function addAttribute(value: any, key: string, shouldEscape = true, tagName = '') {
if (value == null) {
return '';
}
return markHTMLString( ${key}="${toAttributeString(value, shouldEscape)}"); // key interpolated not escaped
}
This function is called from spreadAttributes at packages/astro/src/runtime/server/index.ts:91-92:
for (const [key, value] of Object.entries(values)) {
output += addAttribute(value, key, true, _name);
}
The toAttributeString function escapes the attribute value, but the attribute name key is never validated or escaped. An attacker can craft a JSON object with a key containing " characters to break out of the attribute context and inject event handlers.
Execution flow: User controlled object keys (from API, CMS, URL params) are spread onto element via {...props}. The compiler generates spreadAttributes(props) which iterates with Object.entries() and calls addAttribute(value, key). The key is interpolated as ${key}="${escapedValue}" . A malicious key breaks attribute context, resulting in XSS.
POC
Create an SSR Astro page (src/pages/index.astro):
const props = JSON.parse(Astro.url.searchParams.get('props') || '{}');
<html>
<body>
<h1>Hello</h1>
<div {...props}>Move mouse here</div>
</body>
</html>
Enable SSR in astro.config.mjs (for URL based demo):
export default defineConfig({
output: 'serve
⚡ Watch CVE-2026-54298
Get an email if CVE-2026-54298 is added to CISA KEV, gains public exploit code, or a new advisory cites it — max one per day, one-click unsubscribe.
Exploitation outlook
- Low exploitation risk0.23% 30-day exploitation probability — currently an unlikely target, but scores change as exploit code circulates. Riskier than 14% of all EPSS-scored CVEs.
Advisory coverage (1)
- mediumGHSA-jrpj-wcv7-9fh9: Astro: XSS via Unescaped Attribute Names in Spread Propsghsa · 2026-06-16
External references
Embed the live status
— this badge updates automatically when the KEV or exploit status changes. How to embed it →
[](https://www.csirts.com/cve/CVE-2026-54298)