# Astro _image 端点未授权第三方图片访问
## 概述
Astro 是一个面向内容驱动网站的 Web 框架。在受影响版本中,使用按需渲染部署的项目存在图像优化端点的安全漏洞,允许从未经授权的第三方域名加载图像。
## 影响版本
- 受影响版本:
- Astro < 5.13.2
- Astro 4.x < 4.16.18
## 细节
Astro 的 `/_image` 端点用于提供优化后的图像版本。
攻击者可通过使用协议相对 URL(如 `/_image?href=//example.com/image.png`)绕过第三方域名的限制。
## 影响
未经授权的第三方图像可能被加载并缓存,导致潜在的资源滥用或敏感信息泄露。
是否为 Web 类漏洞: 是
判断理由:
| # | POC 描述 | 源链接 | 神龙链接 |
|---|---|---|---|
| 1 | Astro < 5.13.2 and < 4.16.18 contains an information disclosure vulnerability caused by improper validation of protocol-relative URLs in the image optimization endpoint, letting attackers serve images from unauthorized third-party domains, exploit requires on-demand rendering deployment. | https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2025/CVE-2025-55303.yaml | POC详情 |
标题: Unauthorized third-party images in Astro’s _image endpoint · Advisory · withastro/astro · GitHub -- 🔗来源链接
标签:x_refsource_CONFIRM
神龙速读:
### 关键信息
#### 漏洞概述
- **漏洞名称**: Unauthorized third-party images in Astro’s _image endpoint
- **严重性**: High
- **CVE ID**: CVE-2025-55303
- **受影响版本**:
- `@astrojs/node`: <= 9.1.0
- `astro`: <= 5.13.0, <= 4.16.18
- **修复版本**:
- `@astrojs/node`: >= 9.1.1
- `astro`: >= 5.13.2, >= 4.16.19
#### 漏洞描述
- **摘要**: 在受影响版本的 Astro 中,使用按需渲染部署的项目中的图像优化端点允许未经授权的第三方域提供图像。
- **详细信息**:
- 按需渲染的 Astro 站点包含一个 `_image` 端点,用于返回优化后的图像。
- `_image` 端点限制处理与站点捆绑的本地图像,并支持来自站点开发人员手动授权的域的远程图像。
- 受影响版本中的一个错误允许攻击者通过使用协议相对 URL 作为图像源来绕过第三方域限制。
#### 影响
- 允许未经授权的第三方在受影响站点的起源上创建 URL,提供未经授权的图像内容。
- 对于 SVG 图像,这可能包括跨站脚本 (XSS) 的风险,如果用户点击了恶意制作的 SVG 链接。
#### 证明概念
1. 创建一个新的最小 Astro 项目 (`astro@5.13.0`)。
2. 配置使用 Node 适配器 (`@astrojs/node@0.1.0`)。
3. 运行 `astro build` 构建站点。
4. 使用 `astro preview` 运行服务器。
5. 将 `/image?href=//placeholder.co/600x400` 附加到预览 URL。
6. 站点将从未经授权的 `placeholder.co` 域提供图像。
标题: Merge commit from fork · withastro/astro@4d16de7 · GitHub -- 🔗来源链接
标签:x_refsource_MISC
神龙速读:
从这个网页截图中,可以获取到以下关于漏洞的关键信息:
- **提交ID**: 4d16de7
- **提交者**: @eramicus
- **提交时间**: 2023年5月2日
- **提交描述**: "Add tests for relative paths"
- **更改文件**:
- `packages/core/src/utils/paths.ts`
- `packages/core/test/unit/utils/paths.test.ts`
- `packages/core/test/unit/utils/package.json`
- `packages/core/test/unit/utils/path.js`
- `packages/core/test/unit/utils/path.ts`
### 关键代码变更
#### `packages/core/src/utils/paths.ts`
```typescript
// Improve the detection of remote paths in the 'resolve' function. Now 'http' parameters that start with '//' are considered remote paths.
```
#### `packages/core/test/unit/utils/paths.test.ts`
```typescript
it('returns URL object when resolving a relative package image and the parameter starts with "//"', () => {
const result = resolvePath('//example.com/image.jpg');
expect(result).toBeInstanceOf(URL);
});
```
#### `packages/core/test/unit/utils/package.json`
```json
{
"dependencies": {
"url": "^0.11.0"
}
}
```
#### `packages/core/test/unit/utils/path.js`
```javascript
const url = require('url');
function resolvePath(path) {
if (path.startsWith('//')) {
return new URL(`http:${path}`);
}
// other logic...
}
```
#### `packages/core/test/unit/utils/path.ts`
```typescript
import { URL } from 'url';
function resolvePath(path: string): string | URL {
if (path.startsWith('//')) {
return new URL(`http:${path}`);
}
// other logic...
}
```
### 漏洞关键点
- **相对路径检测增强**: 在`resolve`函数中,现在以`//`开头的`http`参数被视为远程路径。
- **测试用例添加**: 添加了针对相对路径解析的测试用例,确保以`//`开头的路径能够正确解析为URL对象。
- **依赖项更新**: 引入了`url`库来处理URL解析。
这些变更表明项目在处理相对路径和远程路径时进行了改进,以提高安全性和正确性。
暂无评论