Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessIdentify Astro app reflecting input into transition directive
-
DeliveryCraft URL with attribute-breaking XSS payload
-
ExploitDeliver crafted URL to victim via phishing
-
ExecutionVictim browser requests page
-
PersistServer renders unescaped directive value into HTML
-
ImpactInjected script executes in victim's browser origin
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding, context-aware escaping
MITRE ATT&CK
2 techniques across 2 tactics: Initial Access, Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires two simultaneous conditions: first, the target Astro application must use at least one client-hydrated component (client:load, client:idle, client:visible, or similar) with one of the three affected directives (transition:persist, transition:scope, or transition:persist-props); second, the application developer must have written code that reflects untrusted, request-derived input - such as a URL query parameter, HTTP header value, or form field - directly into that directive without prior HTML-encoding or strict validation. Astro applications that do not route untrusted input into these directives are entirely unaffected regardless of version. Exploitation is further limited by the need for victim user interaction: the attacker must induce the victim to visit a crafted URL, meaning this cannot be exploited silently against authenticated sessions without social engineering. No special network position, authentication, or elevated privilege is required of the attacker once an exploitable application endpoint is identified. |
| Impact | Real-world risk is significantly lower than a typical reflected XSS because exploitation carries a hard developer-side precondition: the target application must contain code that routes untrusted, request-derived input into one of the three transition directives - a non-idiomatic pattern the advisory itself characterizes as unusual. No CVSS vector was assigned by NVD or the reporter, so severity metrics are inferred here rather than confirmed. No EPSS score is available. No KEV listing exists, and no reports of active exploitation in the wild have been identified at time of analysis. A proof-of-concept is embedded in the GHSA advisory, lowering the bar for reproduction once an exploitable application is found. The vulnerability is network-delivered and requires victim interaction (visiting a crafted URL) but no attacker authentication. The population of exploitable deployments is constrained to Astro applications that both use client-hydrated islands with transition directives AND unsafely reflect request parameters into those directives - making this a low-prevalence exploitable condition despite affecting a broad version range (3.10.0-7.0.4). The advisory authors assess real-world severity as Low based on this precondition. |
| Exploit ScenarioDerived | An attacker targets an Astro application that reads the persist query parameter from the URL and passes it directly into a transition:persist directive on a client:load island. The attacker crafts a URL such as https://example.com/?persist="><img src=x onerror=alert(document.cookie)> and sends it to a victim via phishing. When the victim's browser loads the page, the server renders the unescaped payload into the data-astro-transition-persist attribute, breaking out of the attribute and executing the injected script in the victim's browser origin context. A working proof-of-concept demonstrating this exact scenario is included in the GHSA-7pw4-f3q4-r2p2 advisory. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Jul 20, 2026
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.
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.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in npm
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
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.
Know when the next one hits your stack
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
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
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.
Primary rating from Vendor (https://github.com/withastro/astro).
CVSS VectorVendor: https://github.com/withastro/astro
Lifecycle Timeline
1DescriptionCVE.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:
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:
---
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):
<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.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.
EUVD-2026-49581
GHSA-7pw4-f3q4-r2p2
NVD
CVE.org
EPSS
VulDB
Exploit-DB