Astro: Reflected/Stored XSS via unescaped <script>/<style> tag content in JSX/MDX rendering
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.
Software afectado
Haz clic en una tecnología para ver todas sus vulnerabilidades.
| Plataforma | Paquete | Versiones vulnerables | Corregida en |
|---|---|---|---|
| Paquete de npm | astro | < 7.3.2 | 7.3.2 |
Referencias
- https://github.com/withastro/astro/security/advisories/GHSA-98hj-9722-w3j8
- https://nvd.nist.gov/vuln/detail/CVE-2026-114128
- https://github.com/withastro/astro/pull/17896
- https://github.com/withastro/astro/commit/a548223607b9bb146d5d90ddda495343f9a2a739
- https://github.com/withastro/astro
- https://github.com/withastro/astro/releases/tag/astro@7.3.2
- Vector CVSS
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N- Debilidad (CWE)
CWE-79- Plataforma
- npm
- Paquete
astro- Publicada
- 22.10.2026
- Actualizado
- 22.10.2026 20:17
Fuentes y licencias
OSV / GitHub Advisory Database - GHSA-98hj-9722-w3j8 - CC BY 4.0
Historial de vulnerabilidades: astro
Todas las vulnerabilidades publicadas de este paquete (Paquete de npm), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.
- Entradas en total
- 29
- Primera → última
- 10.2024 10.2026
- Sin corrección
- 0
- Explotada en ataques
- 0
Distribución por gravedad
- Crítica 1
- Alta 6
- Media 16
- Baja 6
Divulgaciones por año
- 2024: 3
- 2025: 11
- 2026: 15
-
Astro: Reflected/Stored XSS via unescaped <script>/<style> tag content in JSX/MDX rendering esta entrada
Identifica las vulnerabilidades de tu aplicación
Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.