
This Python script identifies hosts vulnerable to CVE-2025-29927, an improper authorization vulnerability in the Next.js middleware that may allow authentication bypass. The script checks for Next.js usage, identifies the version, detects the x-middleware-subrequest header, and tests for potential authentication bypasses on specified routes.
WARNING: This script is for educational purposes and authorized security audits only. Unauthorized use on systems without explicit permission is illegal and unethical.
Clone or download this repository: git clone <REPOSITORY_URL> cd cve-2025-29927-scanner
Create and activate a virtual environment (optional, but recommended): python -m venv venv source venv/bin/activate # Linux/Mac venv\Scripts\activate # Windows
Install the dependencies: pip install -r requirements.txt
Prepare a hosts.txt file with a list of hosts (one per line). Example: example.com subdomain.example.com another-site.com
(Optional) Prepare a routes.txt file with routes to test (one per line). Example: api/auth dashboard admin If not provided, the script will automatically create a routes.txt with default routes.
Run the script:
Arguments: -f, --file: File with the list of hosts (required). -r, --routes: File with the list of routes (optional; uses routes.txt if not specified). -t, --threads: Maximum number of threads (default: 10).
Check the results in the terminal output.
Example Output
File routes.txt created with default routes.
Starting scan on 3 hosts with 3 routes...
Scan results:
------------------------------------------------------------
Host: https://example.com
Next.js detected: True
Version: 13.5.6
x-middleware-subrequest header: True
Vulnerable (version): True
Authentication bypass possible: True
Status: VULNERABLE
------------------------------------------------------------
The dependencies are listed in requirements.txt:
Contributions are welcome