# CVE-2026-59727: Astro: Cross-site scripting via unescaped transition:* directive values on hydrated islands

> Attackers can inject arbitrary JavaScript via unescaped transition directives in Astro if developers pass untrusted input to them.

- **Severity:** Low 2.1 (`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`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 27 Jul 2026
- **Updated:** 28 Jul 2026
- **Also known as:** GHSA-7pw4-f3q4-r2p2

## What is CVE-2026-59727?

CVE-2026-59727 is a low-severity cross-site scripting vulnerability in withastro astro, published on 27 Jul 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Astro is a web framework for content-driven websites. In versions 3.10.0 through 7.0.3, 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). Exploitation 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 issue has been fixed in version 7.0.4.

Weakness: CWE-83 (Improper Neutralization of Script in Attributes in a Web Page), CWE-79 (Improper Neutralization of Input During Web Page Generation), CWE-116 (Improper Encoding or Escaping of Output)

## Which versions are affected by CVE-2026-59727?

2 open source packages ship an affected version, including astro.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `astro` | npm | From 3.10.0 | 7.0.4 |
| `astro` | npm | From 3.10.0 | 7.0.4 |

## How do I fix CVE-2026-59727?

Upgrade astro to 7.0.4 or later.

## Is CVE-2026-59727 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-59727 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-59727 and fix it if it is affected.

What it is: CVE-2026-59727 is a low-severity cross-site scripting vulnerability in withastro astro, published on 27 Jul 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-59727 exists.

Affected packages and fixed versions:
- astro (npm): affected from 3.10.0; fixed in 7.0.4
- astro (npm): affected from 3.10.0; fixed in 7.0.4

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-59727/ (Markdown: https://insights.sbomify.com/CVE-2026-59727/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-59727
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-59727
- OSV: https://osv.dev/vulnerability/CVE-2026-59727

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-59727/
Summaries are generated and may contain mistakes; the official description above is the record.
