安全研究

CVE-2025-32395 Vite Dev Server 路径遍历:URL 中 # 字符绕过的 server.fs.deny

#漏洞分析#代码审计#Web安全
CVE-2025-32395 Vite Dev Server 路径遍历:URL 中 # 字符绕过的 server.fs.deny

Vite Dev Server 的 server.fs.deny 中间件用正则匹配 URL 拒绝访问项目目录外的文件——但 # 字符在 RFC 9112/9113 标准中只能作为 URL fragment,而 Node.js 默认允许 # 出现在 path 中。攻击者利用这个差异,构造 /src/safe.txt#/../../../unsafe.txt,让 fs.deny 看到的是 /src/safe.txt(在白名单内),但文件系统实际访问 unsafe.txt(在白名单外)。

Unlock to view this content.