Media

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

  • Publicada: 22.10.2026
  • Actualizado: 22.10.2026 20:17

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.

PlataformaPaqueteVersiones vulnerablesCorregida en
Paquete de npm astro < 7.3.2 7.3.2

Referencias

Puntuación CVSS 6.5/10
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.

Todas (29) en el archivo
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

  1. 2024: 3
  2. 2025: 11
  3. 2026: 15
Gravedad:
  1. Astro: Reflected/Stored XSS via unescaped <script>/<style> tag content in JSX/MDX rendering esta entrada
    Media · 6.5 CVE-2026-114128 < 7.3.2 7.3.2
  2. Crítica · 9.8 ghsa-26w7-cxv4-gfx2 < 7.2.8 7.2.8
  3. Alta · 7.5 CVE-2026-54299 < 6.4.6 6.4.6
  4. Alta · 7.1 CVE-2026-50146 < 6.3.3 6.3.3
  5. Alta · 7.1 CVE-2025-64764 < 5.15.8 5.15.8
  6. Alta · 7.2 CVE-2025-59837 >= 5.13.4, < 5.13.10 5.13.10
  7. Alta CVE-2024-56159 >= 5.0.0-alpha.0, < 5.0.8, < 4.16.18 5.0.8, 4.16.18

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.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.