ghsa-xf8x-j4p2-f749
Vulnerability from github
Summary
In affected versions of astro
, the image optimization endpoint in projects deployed with on-demand rendering allows images from unauthorized third-party domains to be served.
Details
On-demand rendered sites built with Astro include an /_image
endpoint which returns optimized versions of images.
The /_image
endpoint is restricted to processing local images bundled with the site and also supports remote images from domains the site developer has manually authorized (using the image.domains
or image.remotePatterns
options).
However, a bug in impacted versions of astro
allows an attacker to bypass the third-party domain restrictions by using a protocol-relative URL as the image source, e.g. /_image?href=//example.com/image.png
.
Proof of Concept
-
Create a new minimal Astro project (
astro@5.13.0
). -
Configure it to use the Node adapter (
@astrojs/node@9.1.0
— newer versions are not impacted):
```js // astro.config.mjs import { defineConfig } from 'astro/config'; import node from '@astrojs/node';
export default defineConfig({ adapter: node({ mode: 'standalone' }), }); ```
-
Build the site by running
astro build
. -
Run the server, e.g. with
astro preview
. -
Append
/_image?href=//placehold.co/600x400
to the preview URL, e.g. http://localhost:4321/_image?href=//placehold.co/600x400 -
The site will serve the image from the unauthorized
placehold.co
origin.
Impact
Allows a non-authorized third-party to create URLs on an impacted site’s origin that serve unauthorized image content. In the case of SVG images, this could include the risk of cross-site scripting (XSS) if a user followed a link to a maliciously crafted SVG.
{ "affected": [ { "database_specific": { "last_known_affected_version_range": "\u003c= 5.13.0" }, "package": { "ecosystem": "npm", "name": "astro" }, "ranges": [ { "events": [ { "introduced": "5.0.0-alpha.0" }, { "fixed": "5.13.2" } ], "type": "ECOSYSTEM" } ] }, { "database_specific": { "last_known_affected_version_range": "\u003c= 9.1.0" }, "package": { "ecosystem": "npm", "name": "@astrojs/node" }, "ranges": [ { "events": [ { "introduced": "0" }, { "fixed": "9.1.1" } ], "type": "ECOSYSTEM" } ] }, { "database_specific": { "last_known_affected_version_range": "\u003c= 4.16.18" }, "package": { "ecosystem": "npm", "name": "astro" }, "ranges": [ { "events": [ { "introduced": "0" }, { "fixed": "4.16.19" } ], "type": "ECOSYSTEM" } ] } ], "aliases": [ "CVE-2025-55303" ], "database_specific": { "cwe_ids": [ "CWE-79" ], "github_reviewed": true, "github_reviewed_at": "2025-08-19T15:40:31Z", "nvd_published_at": "2025-08-19T19:15:36Z", "severity": "MODERATE" }, "details": "### Summary\n\nIn affected versions of `astro`, the image optimization endpoint in projects deployed with on-demand rendering allows images from unauthorized third-party domains to be served.\n\n### Details\n\nOn-demand rendered sites built with Astro include an `/_image` endpoint which returns optimized versions of images.\n\nThe `/_image` endpoint is restricted to processing local images bundled with the site and also supports remote images from domains the site developer has manually authorized (using the [`image.domains`](https://docs.astro.build/en/reference/configuration-reference/#imagedomains) or [`image.remotePatterns`](https://docs.astro.build/en/reference/configuration-reference/#imageremotepatterns) options).\n\nHowever, a bug in impacted versions of `astro` allows an attacker to bypass the third-party domain restrictions by using a protocol-relative URL as the image source, e.g. `/_image?href=//example.com/image.png`.\n\n### Proof of Concept\n\n1. Create a new minimal Astro project (`astro@5.13.0`).\n\n2. Configure it to use the Node adapter (`@astrojs/node@9.1.0` \u2014 newer versions are not impacted):\n\n ```js\n // astro.config.mjs\n import { defineConfig } from \u0027astro/config\u0027;\n import node from \u0027@astrojs/node\u0027;\n\n export default defineConfig({\n \tadapter: node({ mode: \u0027standalone\u0027 }),\n });\n ```\n\n3. Build the site by running `astro build`.\n\n4. Run the server, e.g. with `astro preview`.\n\n5. Append `/_image?href=//placehold.co/600x400` to the preview URL, e.g. \u003chttp://localhost:4321/_image?href=//placehold.co/600x400\u003e\n\n6. The site will serve the image from the unauthorized `placehold.co` origin.\n\n### Impact\n\nAllows a non-authorized third-party to create URLs on an impacted site\u2019s origin that serve unauthorized image content.\nIn the case of SVG images, this could include the risk of cross-site scripting (XSS) if a user followed a link to a maliciously crafted SVG.", "id": "GHSA-xf8x-j4p2-f749", "modified": "2025-08-19T21:41:46Z", "published": "2025-08-19T15:40:31Z", "references": [ { "type": "WEB", "url": "https://github.com/withastro/astro/security/advisories/GHSA-xf8x-j4p2-f749" }, { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-55303" }, { "type": "WEB", "url": "https://github.com/withastro/astro/commit/4d16de7f95db5d1ec1ce88610d2a95e606e83820" }, { "type": "PACKAGE", "url": "https://github.com/withastro/astro" } ], "schema_version": "1.4.0", "severity": [ { "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:H/SI:H/SA:N", "type": "CVSS_V4" } ], "summary": "Astro allows unauthorized third-party images in _image endpoint" }
Sightings
Author | Source | Type | Date |
---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.