CVE-2026-59727
JavaScript vulnerability analysis and mitigation

Overview

CVE-2026-59727 is a reflected cross-site scripting (XSS) vulnerability in the Astro web framework (npm package astro) caused by unescaped transition:* directive values on client-hydrated island components. When a developer reflects attacker-controlled input into a transition:persist, transition:scope, or transition:persist-props directive, Astro copies the raw value onto the rendered <astro-island> element without HTML-escaping, allowing injection of arbitrary HTML/JavaScript into the server-rendered response. The vulnerability affects astro versions >= 3.10.0 and < 7.0.4 (introduced in v3.10.0 via PR #7861). It was reported by @jlgore, published as a security advisory on July 17, 2026, and added to the GitHub Advisory Database on July 20, 2026. The CVSS v4.0 base score is 2.1 (Low) (GitHub Advisory, Astro Security Advisory).

Technical details

The root cause is improper output encoding (CWE-116, CWE-79, CWE-83) in generateHydrateScript() within packages/astro/src/runtime/server/hydration.ts. While attrs, props, and opts island properties are all passed through escapeHTML() before serialization, the 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 element is then serialized with renderElement('astro-island', island, false) where shouldEscape=false, meaning toAttributeString() returns the value unchanged, and the raw attacker-controlled string reaches the HTML response. Exploitation requires the application developer to have written a non-idiomatic pattern — directly reflecting untrusted, request-derived input (e.g., a URL query parameter) into one of these transition directives. This is the same output sink class previously addressed for slot names in GHSA-8hv8-536x-4wqp (GitHub Advisory, Fix Commit).

Impact

Successful exploitation results in reflected XSS, allowing an attacker who induces a victim to visit a crafted URL to execute arbitrary JavaScript in the victim's browser session on the affected origin. This can lead to session token theft, credential harvesting, defacement of page content, or redirection to malicious sites. The impact is limited to the subsequent system (browser context) — the vulnerable server system itself has no direct confidentiality or integrity impact — and availability is unaffected. Exploitation is constrained to applications where developers have passed untrusted input directly into a transition directive, limiting the real-world attack surface (Astro Security Advisory).

Exploitation steps

  1. Identify a vulnerable target: Find an Astro application running astro >= 3.10.0 and < 7.0.4 that uses a client:* hydrated component with a transition:persist, transition:scope, or transition:persist-props directive whose value is derived from attacker-controlled input (e.g., a URL query parameter).
  2. Craft a malicious URL: Construct a URL that injects an XSS payload into the relevant query parameter. For example, if the application reflects Astro.url.searchParams.get('persist') into transition:persist, craft: https://example.com/?persist="><img src=x onerror=alert(1)>
  3. Deliver the URL to a victim: Use phishing, social engineering, or another delivery mechanism to induce the victim to visit the crafted URL.
  4. Payload executes: The server renders the <astro-island> element with the unescaped attribute value, breaking out of the attribute context. The injected <img src=x onerror=alert(1)> (or equivalent payload) executes in the victim's browser on the target origin, enabling session theft, credential harvesting, or further attacks (Astro Security Advisory, GitHub Advisory).

Indicators of compromise

  • Network: HTTP requests to Astro application pages containing URL-encoded HTML injection sequences (e.g., %22%3E%3Cscript, "><img, "><svg) in query parameters that correspond to transition:persist, transition:scope, or transition:persist-props directive values.
  • Logs: Web server or application access logs showing requests with suspicious query parameter values containing quote characters, angle brackets, or JavaScript event handler strings (e.g., onerror=, onload=, alert() in parameters reflected into transition directives.
  • Response Content: Server-rendered HTML responses containing unescaped <script>, <img>, or <svg> tags within <astro-island> element attributes (data-astro-transition-persist, data-astro-transition-scope, data-astro-transition-persist-props) — indicative of a vulnerable and actively exploited instance.

Mitigation and workarounds

Upgrade to astro@7.0.4 or later, which fixes the issue by applying escapeHTML(String(props[name])) to transition directive values before rendering them onto the island element (PR #17212, commit 7ba0bb1) (Astro Release, Fix Commit). As a workaround for teams unable to upgrade immediately, do not pass untrusted or request-derived input into transition:persist, transition:scope, or transition:persist-props directives. If dynamic values are required, HTML-escape or strictly allowlist-validate the input before passing it to the directive (Astro Security Advisory).

Community reactions

The vulnerability was published by Astro maintainer @matthewp as a low-severity security advisory on July 17, 2026, with the fix merged on June 29, 2026 ahead of public disclosure. The advisory notes this is the same output sink class previously addressed for slot names (GHSA-8hv8-536x-4wqp), suggesting a pattern of incremental hardening in Astro's island rendering pipeline. No significant broader media coverage or notable community controversy has been observed (Astro Security Advisory).

Additional resources


SourceThis report was generated using AI

Related JavaScript vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-53668MEDIUM6.9
  • JavaScript logoJavaScript
  • react-router
NoYesJul 27, 2026
CVE-2026-59729MEDIUM5.1
  • JavaScript logoJavaScript
  • astro
NoYesJul 27, 2026
CVE-2026-59728MEDIUM4.3
  • JavaScript logoJavaScript
  • @astrojs/rss
NoYesJul 27, 2026
CVE-2026-59730LOW2.1
  • JavaScript logoJavaScript
  • @astrojs/node
NoYesJul 27, 2026
CVE-2026-59727LOW2.1
  • JavaScript logoJavaScript
  • astro
NoYesJul 27, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management