All vulnerabilities

Servers and applications

GHSA-r7x2-725f-h4m9

XSS via unescaped object values in JSX and MDX elements

Severity
Medium 6.1
Published
2 Dec 2026
Last changed
2 Dec 2026
Added to UpHeron
2 Dec 2026
Fixed in
7.4.14
Weakness
CWE-87
Attack
Over the network · No login needed · Needs someone to click or open something
Attacker can
Read some data · Change some data
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Sources
Project advisories (GitHub)

Description

Astro escapes dynamic values in templates before rendering them as HTML, but only when the value was a string. Other values that turn into text, such as an Error, a String object, a Node.js Buffer, or any object with a custom toString(), were converted to a string and rendered without escaping.

This affected .astro templates, JSX and MDX. In JSX and MDX it also affected set:text, which is documented to escape its value.

For example:

rendered `

Error: Post "

" not found

as live HTML. In JSX and MDX, {new String(value)}, {Buffer.from(value)} and

` were rendered unescaped in the same way.

Reflected or stored cross-site scripting, but only in applications that render untrusted input inside a non-string value, such as an error message built from a request parameter or a buffer read from user-supplied content. String values were always escaped.

From withastro/astro's security advisory. Shortened; the full text is there.

Workarounds

Upgrade to astro 7.4.14 or later. Before upgrading, convert values to strings before rendering them, for example {String(error)} or {error.message}, so that Astro escapes them.

Workarounds as given by withastro/astro's security advisory.

Affected software

SoftwareAffected versions
AstroServers and applications · github:withastro/astro
  • Every version before 7.4.14

About Astro

The web framework for content-driven websites.

From its GitHub repository.
Developers who used it in the past year
4.5%Stack Overflow Developer Survey 2025, 2025
Weekly downloads (npm)
12,020,872npm, 29 Nov 2026
GitHub stars
64,305GitHub, 29 Nov 2026
Forks
3,943GitHub, 29 Nov 2026
Latest release
@astrojs/[email protected]GitHub, 29 Nov 2026
Released
18 Nov 2026GitHub
First published on GitHub
15 Mar 2021GitHub

References