All vulnerabilities

Servers and applications

GHSA-c335-jqf9-8wmc

Reflected XSS via data URIs with an allow-listed host in the image endpoint

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
Cross-site scripting (CWE-79)
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's /_image endpoint only loads remote images whose URL is allowed by image.domains or image.remotePatterns. Data URIs are meant to be allowed only by an explicit remotePatterns: [{ protocol: 'data' }] entry. That check could be bypassed by writing the data URI with a host: data is not a special URL scheme, so the URL parser reads cdn.example.com as the hostname of data://cdn.example.com/,. Any image.domains entry for that host, and any remotePatterns entry without a protocol that matched it, therefore allowed the data URI.

For example, with this configuration:

a link to /_image?href=data://cdn.example.com/, returned the attacker's SVG unchanged as image/svg+xml from the site's own origin, and the script ran when the link was opened.

Reflected cross-site scripting on on-demand rendered sites that use Astro's /_image endpoint and allow a remote host through image.domains, or through an image.remotePatterns entry without a protocol.

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

Workarounds

Upgrade to astro 7.4.14 or later. Before upgrading, replace image.domains entries and image.remotePatterns entries that have no protocol with remotePatterns entries that set protocol: 'https':

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