All vulnerabilities

Servers and applications

CVE-2026-54298

XSS via Unescaped Attribute Names in Spread Props

Severity
Medium 4.2
Published
12 Jun 2026
Last changed
12 Jun 2026
Added to UpHeron
3 Nov 2026
Fixed in
6.4.6
Exploit chance
0.2% in the next 30 daysHigher than 13% of CVEs. EPSS by FIRST, 19 Nov 2026
Weakness
Cross-site scripting (CWE-79)
Attack
Over the network · Only under certain conditions · No login needed · Needs someone to click or open something
Attacker can
Read some data · Change some data
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N
Also known as
GHSA-jrpj-wcv7-9fh9
Sources
Project advisories (GitHub)

Description

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.

The vulnerable function is addAttribute at packages/astro/src/runtime/server/render/util.ts:81-141:

This function is called from spreadAttributes at packages/astro/src/runtime/server/index.ts:91-92:

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.

From withastro/astro's security advisory. Shortened; the full text is there.

Affected software

SoftwareAffected versions
AstroServers and applications · github:withastro/astro
  • Every version before 6.4.6

About Astro

The web framework for content-driven websites.

From its GitHub repository.
Developers who used it in the past year
4.5%Stack Overflow Developer Survey 2025, 2025
Weekly downloads (npm)
11,910,147npm, 15 Nov 2026
GitHub stars
63,954GitHub, 15 Nov 2026
Forks
3,922GitHub, 15 Nov 2026
Latest release
@astrojs/[email protected]GitHub, 15 Nov 2026
Released
13 Nov 2026GitHub
First published on GitHub
15 Mar 2021GitHub

References