# Vite 的 `server.fs.deny` 在使用 `?import` 查询时被 `inline` 和 `raw` 绕过
## 漏洞概述
Vite是一款用于JavaScript的前端工具框架。由于特定条件下的文件加载机制,它可能会暴露非预期文件的内容。
## 影响版本
- 6.2.4 之前版本
- 6.1.3 之前版本
- 6.0.13 之前版本
- 5.4.16 之前版本
- 4.5.11 之前版本
## 细节
Vite使用`?inline&import`或`?raw?import`参数暴露非预期文件的内容。只有那些通过配置选项(例如 `--host` 或 `server.host`)使开发服务器在网络上可用的应用才会受到影响。
## 影响
如果应用通过网络对外暴露了Vite的开发服务器,且使用了受影响版本,则可能导致敏感或非预期文件内容被泄露。问题在上述指定的固定版本中得到了修复。
# | POC 描述 | 源链接 | 神龙链接 |
---|---|---|---|
1 | Vite 任意文件读取漏洞POC | https://github.com/sunhuiHi666/CVE-2025-31125 | POC详情 |
2 | Path traversal vulnerability in Vite development server's @fs endpoint allows attackers to access files outside the intended directory. When exposed to the network, attackers can exploit this via crafted URLs to access sensitive system files. | https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2025/CVE-2025-31125.yaml | POC详情 |
3 | Vite WASM Import Path Traversal 🛡️ | https://github.com/0xgh057r3c0n/CVE-2025-31125 | POC详情 |
4 | Vite is a frontend tooling framework for javascript. Vite exposes content of non-allowed files using ?inline&import or ?raw?import. Only apps explicitly exposing the Vite dev server to the network (using --host or server.host config option) are affected. This vulnerability is fixed in 6.2.4, 6.1.3, 6.0.13, 5.4.16, and 4.5.11. | https://github.com/harshgupptaa/Path-Transversal-CVE-2025-31125- | POC详情 |
5 | Vite Development Server's @fs endpoint (CVE-2025-31125) to access sensitive files like /etc/passwd and /etc/hosts via crafted URLs. | https://github.com/MuhammadWaseem29/Vitejs-exploit | POC详情 |
6 | None | https://github.com/nak000/Vitejs-exploit-CVE-2025-31125-rce | POC详情 |
标题: `server.fs.deny` bypassed for `inline` and `raw` with `?import` query · Advisory · vitejs/vite · GitHub -- 🔗来源链接
标签: x_refsource_CONFIRM
神龙速读标题: fix: fs check in transform middleware (#19761) · vitejs/vite@5967313 · GitHub -- 🔗来源链接
标签: x_refsource_MISC
神龙速读暂无评论