---
id: "CVE-2026-114128"
kind: "vulnerability"
aliases: ["CVE-2026-114128", "GHSA-98hj-9722-w3j8"]
title: "Astro: Reflected/Stored XSS via unescaped <script>/<style> tag content in JSX/MDX rendering"
severity: "medium"
cvss: 6.5
epss: 0.002630000002682209
exploited: false
status: "open"
category: "package"
products: [{"name": "astro", "fixed": ["7.3.2"], "affected": "< 7.3.2", "ecosystem": "npm"}]
ecosystems: ["npm"]
tags: ["astro", "cwe-79", "mdx", "npm", "package", "self-hosted"]
not_affected_if: ["no-dynamic-script-or-style-children", "static-content-only", "version-7.3.2-or-later"]
published_at: "2026-10-21T18:17:25+00:00"
first_seen_at: "2026-10-23T19:11:31+00:00"
updated_at: "2026-10-23T21:57:29+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-98hj-9722-w3j8", "first_seen_at": "2026-10-23T19:11:31+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-114128", "first_seen_at": "2026-10-23T21:57:29+00:00"}]
---

# Astro: Reflected/Stored XSS via unescaped <script>/<style> tag content in JSX/MDX rendering

Astro's JSX and MDX renderer did not escape dynamic string values placed inside <script> or <style> elements. An attacker-controlled value containing a closing </script> or </style> tag can inject HTML and JavaScript that runs under the application's origin.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- npm:astro affected < 7.3.2 fixed 7.3.2

## How to check

Run npm ls astro and confirm the resolved version is below 7.3.2.
Search .astro, .jsx, .tsx and .mdx files for <script>{ or <style>{ with dynamic expressions fed by request data or CMS fields.

## Fix

Upgrade astro to 7.3.2 or later.
Until upgraded, do not interpolate untrusted values into <script> or <style> children; encode them first.

## Timeline

- 2026-10-23T19:11:31+00:00 ghsa https://github.com/advisories/GHSA-98hj-9722-w3j8
- 2026-10-23T21:57:29+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-114128

## From the sources

## Summary

Astro's JSX and MDX rendering pipeline treated string children of `<script>` and `<style>` elements as trusted HTML. When a dynamic value was passed through a JSX expression, such as `<script>{value}</script>`, an attacker-controlled value containing `</script>` or `</style>` could terminate the element and inject arbitrary HTML and JavaScript.

Other JSX expression contexts escaped dynamic strings automatically. This behavior was limited to `<script>` and `<style>` children rendered through Astro's `astro:jsx` renderer, including MDX components.

## Details

The affected rendering paths marked all string children of `<script>` and `<style>` elements as safe HTML, without distinguishing literal content generated by the compiler from dynamic expression values. An application was vulnerable when attacker-controlled data, such as a query parameter or CMS field, was interpolated directly into one of these elements.

For example, a value containing `</script><script>alert(1)</script>` passed to `<script>{value}</script>` was emitted without escaping. The browser interpreted the first closing tag as markup and executed the injected script.

The fix preserves raw rendering for literal script and style content while escaping dynamic string children like other JSX expression values.

## Impact

Affected applications could be vulnerable to reflected or stored cross-site scripting. Exploitation required an application to pass attacker-controlled data directly as a dynamic child of a `<script>` or `<style>` element in MDX or through the `astro:jsx` runtime. Successful exploitation allowed arbitrary JavaScript execution in the victim's browser under the application's origin.

## Patches

This issue is patched in `astro@7.3.2`.

## Workarounds

Do not interpolate untrusted dynamic values directly into `<script>` or `<style>` element children. Applications that cannot upgrade should validate and contextually encode these values before rendering them.

## Credit

Reported by [@RKasai127](https://github.com/RKasai127).

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
