All vulnerabilities

Servers and applications

CVE-2026-59727

Cross-site scripting via unescaped transition:* directive values on hydrated islands

Severity
Low
Published
17 Jul 2026
Last changed
17 Jul 2026
Added to UpHeron
3 Nov 2026
Fixed in
7.0.4
Exploit chance
0.4% in the next 30 daysHigher than 34% of CVEs. EPSS by FIRST, 19 Nov 2026
Weakness
Cross-site scripting (CWE-79)CWE-83Improper output encoding (CWE-116)
Also known as
GHSA-7pw4-f3q4-r2p2
Sources
Project advisories (GitHub)

Description

When a transition:persist, transition:scope, or transition:persist-props directive is applied to a client-hydrated (client:*) component, Astro copied the directive value onto the rendered element without HTML-escaping it. If a developer reflects attacker-controlled input into one of these directives, an attacker can break out of the attribute and inject arbitrary HTML/JavaScript into the server-rendered output, resulting in reflected cross-site scripting (XSS).

In generateHydrateScript() (packages/astro/src/runtime/server/hydration.ts), every island property is HTML-escaped before serialization — the attrs, props, and opts assignments all pass through escapeHTML(). The transition directives, however, were copied verbatim:

The element is serialized via renderElement('astro-island', island, false) with shouldEscape=false, and toAttributeString()` returns the value unchanged in that mode.

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

Workarounds

Do not pass untrusted or request-derived input into transition:persist, transition:scope, or transition:persist-props. If such input is required, HTML-escape or strictly validate it before passing it to the directive. Upgrading to [email protected] or later removes the need for manual mitigation.

Workarounds as given by withastro/astro's security advisory.

Affected software

SoftwareAffected versions
AstroServers and applications · github:withastro/astro
  • From 3.10.0 before 7.0.4

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