
PowerShell script to test if a web app is vulnerable to CVE-2025-29927
This PowerShell script is designed to help security researchers and system administrators test for CVE-2025-29927 vulnerabilities in Next.js applications. It checks whether a target application is vulnerable to the middleware bypass issue by verifying the Next.js version and testing for potential security risks with middleware implementation.
(x-powered-by: Next.js).Run from an administrative PowerShell window:
.\test-cve-2025-29927.ps1 -TargetUrl <url>
# Example:
.\test-cve-2025-29927.ps1 -TargetUrl "http://localhost:3000"
The script checks if Next.js is being used via the x-powered-by header. If Next.js is detected, it attempts to extract the version from common static assets like framework.js and main.js looking for vulnerable version info related to CVE-2025-29927.
The script then sends a request with the x-middleware-subrequest header and checks if the response is HTTP 200, which would indicate that the vulnerability is present.
This script is intended for testing of assets that you have permission and are authorized to against CVE-2025-29927 only.
Usage of this script does not provided a guarantee that an application is / is not vulnerable, only that the items the script looks for are or are not present. The author of this script does not take responsibility for any consequences arising from its use.
By using this script, you agree to take full responsibility for your actions. Ensure you have explicit permission before testing any system that does not belong to you.