Skip to main content

Astro Framework EUVDEUVD-2026-49581

| CVE-2026-59727 LOW
Cross-site Scripting (XSS) (CWE-79)
2026-07-20 https://github.com/withastro/astro GHSA-7pw4-f3q4-r2p2
2.1
CVSS 4.0 · Vendor: https://github.com/withastro/astro

Severity by source

Vendor (https://github.com/withastro/astro) PRIMARY
2.1 LOW
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
vuln.today AI
4.7 MEDIUM

Network-delivered reflected XSS requiring non-default developer pattern (AC:H) and victim click (UI:R); scope changes to browser (S:C); no availability impact.

3.1 AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N
4.0 AV:N/AC:H/AT:P/PR:N/UI:P/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (https://github.com/withastro/astro).

CVSS VectorVendor: https://github.com/withastro/astro

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
A
Scope
X

Lifecycle Timeline

3
CVSS changed
Jul 27, 2026 - 20:22 NVD
2.1 (LOW)
Source Code Evidence Fetched
Jul 20, 2026 - 23:46 vuln.today
Analysis Generated
Jul 20, 2026 - 23:46 vuln.today

DescriptionCVE.org

Summary

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 <astro-island> 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).

Severity

Although a generic reflected XSS scores in the Medium range, exploitation here requires the application developer to have written a non-idiomatic pattern - passing untrusted, request-derived input directly into a transition directive. Astro applications that do not route untrusted input into these directives are unaffected. This mitigating precondition places the real-world severity at Low.

Details

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:

ts
transitionDirectivesToCopyOnIsland.forEach((name) => {
  if (typeof props[name] !== 'undefined') {
    island.props[name] = props[name]; // not escaped
  }
});

The <astro-island> element is serialized via renderElement('astro-island', island, false) with shouldEscape=false, and toAttributeString() returns the value unchanged in that mode. As a result there is no downstream re-escaping, and the raw directive value reaches the HTML response. This is the same output sink previously addressed for slot names in GHSA-8hv8-536x-4wqp.

The affected directives are:

  • data-astro-transition-scope (transition:scope)
  • data-astro-transition-persist (transition:persist)
  • data-astro-transition-persist-props (transition:persist-props)

Note that transition:persist is typed boolean | string, so passing a string value is a supported use of the API.

Proof of Concept

A component that reflects a query parameter into a transition directive:

astro
---
const persist = Astro.url.searchParams.get('persist') ?? 'default';
---
<Island client:load transition:persist={persist} />

Request:

https://example.com/?persist="><img src=x onerror=alert(document.domain)>

Rendered output (before the fix):

html
<astro-island … data-astro-transition-persist=""><img src=x onerror=alert(document.domain)>></astro-island>

The " closes the attribute and the injected <img onerror=…> executes in the victim's browser.

Impact

Reflected XSS. An attacker who can induce a victim to visit a crafted URL can execute arbitrary script in the victim's session on the origin, subject to the requirement that the target application reflects untrusted input into one of the affected transition directives.

Affected Versions

astro >= 3.10.0, < 7.0.4 (introduced in 3.10.0, PR #7861).

Patched Versions

astro >= 7.0.4. Fixed in PR #17212 by HTML-escaping transition directive values before they are rendered onto the island element.

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 astro@7.0.4 or later removes the need for manual mitigation.

Credits

Reported by @jlgore.

AnalysisAI

Reflected XSS in Astro's view transition directive rendering allows arbitrary JavaScript injection when a developer passes attacker-controlled input into transition:persist, transition:scope, or transition:persist-props directives on client-hydrated islands. Affected versions span astro 3.10.0 through 7.0.4 (exclusive), covering roughly four major version lines. A public proof-of-concept is included in the GHSA-7pw4-f3q4-r2p2 advisory; no CISA KEV listing or confirmed in-the-wild exploitation is recorded at time of analysis, and the real-world attack surface is narrowed significantly by the precondition that the application developer must have written code that reflects untrusted request input directly into one of these directives.

Technical ContextAI

Astro's server-side rendering pipeline serializes client-hydrated components as <astro-island> custom elements in generateHydrateScript() (packages/astro/src/runtime/server/hydration.ts). All island properties - attrs, props, opts - are passed through escapeHTML() before serialization, but the three view-transition directives (data-astro-transition-scope, data-astro-transition-persist, data-astro-transition-persist-props) were copied verbatim via island.props[name] = props[name] without escaping. The island is then serialized with renderElement('astro-island', island, false), where the third argument shouldEscape=false disables any downstream attribute escaping, so raw directive values reach the HTML response unmodified. CWE-79 (Improper Neutralization of Input During Web Page Generation) precisely describes this root cause: output is written to an HTML attribute context without encoding. The same output sink was previously patched for slot names in GHSA-8hv8-536x-4wqp, indicating a pattern of incomplete escaping coverage across island serialization. The fix (PR #17212) applies escapeHTML(String(props[name])) at the assignment point, consistent with the approach used for other island properties.

RemediationAI

Upgrade to astro 7.0.4 or later, which applies escapeHTML(String(props[name])) to all transition directive values in generateHydrateScript() before they are rendered onto the island element (fix committed in https://github.com/withastro/astro/commit/7ba0bb1dc7516e88caff9abd7767322af44b0294, merged via https://github.com/withastro/astro/pull/17212). For applications that cannot immediately upgrade, the primary workaround is to avoid passing untrusted or request-derived input into transition:persist, transition:scope, or transition:persist-props entirely. If dynamic directive values are functionally required, HTML-encode the value before passing it to the directive (e.g., using a server-side escapeHTML utility), or apply strict allowlist validation to ensure only known-safe strings are accepted. Note that allowlist validation may break legitimate use cases if directive values are user-controlled identifiers; HTML-encoding is the safer compensating control with no functional side effects.

Share

EUVD-2026-49581 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy