GHSA-98hj-9722-w3j8: XSS

Published Oct 22, 2026
·
Updated

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.

Affected Software

1 affected componentFixes available
npm/astro<7.3.2
7.3.2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/astro to a version that resolves this vulnerability.

    Fixed in 7.3.2
  2. Upgrade

    Upgrade astro to a version that resolves this vulnerability.

    Fixed in 7.3.2
  3. Compensating control

    If upgrading is not possible, validate and contextually encode attacker-controlled values before rendering, and do not interpolate untrusted dynamic values directly into <script> or <style> element children.

Event History

Oct 22, 2026
Advisory Published
via GitHub·04:30 PM
Data Sourced
via GitHub·04:30 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which applications are exposed to this issue?

Applications are exposed if they render attacker-controlled data as a JSX expression child of a <script> or <style> element through Astro's astro:jsx renderer. This includes affected MDX components; other JSX expression contexts automatically escape dynamic strings.

2

What must an attacker control to exploit it?

An attacker must be able to supply a value that is interpolated directly into a <script> or <style> element, such as through a query parameter or CMS field. A value containing a closing tag such as </script> can terminate the element and inject HTML and JavaScript.

3

How can we identify potentially vulnerable code?

Review Astro JSX and MDX components for expressions such as <script>{value}</script> or <style>{value}</style>. Trace whether those values can originate from untrusted inputs, including request parameters or content-management fields.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203