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
# CVE-2025-29927 – Next.js Middleware Authorization Bypass

This repository contains a functional exploit for CVE-2025-29927, a critical authorization bypass vulnerability in Next.js. The flaw allows attackers to bypass middleware-based authentication and authorization checks, granting unauthorized access to protected routes.​

## Description

CVE-2025-29927 is a critical vulnerability in Next.js middleware that allows attackers to bypass authentication and authorization checks by sending a specially crafted HTTP request containing the internal header x-middleware-subrequest. This header is intended or internal use to prevent infinite recursion during middleware execution. However, its improper handling allows attackers to exploit this mechanism to skip middleware checks, potentially exposing sensitive administrative routes and protected content.​

The vulnerability affects Next.js versions prior to:​

- 15.2.3
- 14.2.25
- 13.5.9
- 12.3.5

Applications using middleware for critical tasks, such as authentication or security checks, and running on affected versions are vulnerable to this exploit. Notably, deployments hosted on Vercel are automatically protected against this vulnerability.

## Installation Instructions

1. Create a Virtual Environment (Optional but Recommended):

```bash
python3 -m venv .venv
source .venv/bin/activate
```

2. Install Dependencies:

```bash
pip install -r requirements.txt
```

## Requirements

- Python 3.7+
  - requests library
  - colorama library
  - beautifulsoup4 library

- Vulnerable Next.js application with middleware-based access control

## Usage

```bash
python3 exploit.py --host <IP> --port <PORT> --path <PATH> --method <METHOD>
```
File Snapshot

[4.0K] /data/pocs/f52b7f6cbd86477dff59ebacf78030f820d760d0 ├── [4.7K] exploit.py ├── [1.7K] README.md └── [ 55] requirements.txt 0 directories, 3 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 →