该 Python 脚本用于识别存在 CVE-2025-29927 漏洞的主机,该漏洞是 Next.js 中间件中的授权不当漏洞,可能导致认证绕过。脚本会检查是否使用了 Next.js、识别版本、检测 x-middleware-subrequest 头部,并在指定路由上测试潜在的认证绕过。
警告: 本脚本仅用于教育目的和授权的安全审计。未经明确许可在系统上擅自使用是非法的且不道德。
routes.txt 文件,会自动创建包含默认路由的文件。requirements.txt 中列出的依赖项克隆或下载此仓库:
git clone <REPOSITORY_URL>
cd cve-2025-29927-scanner
创建并激活虚拟环境(可选但推荐):
python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows
安装依赖:
pip install -r requirements.txt
准备一个 hosts.txt 文件,包含主机列表(每行一个)。例如:
example.com
subdomain.example.com
another-site.com
(可选)准备一个 routes.txt 文件,包含要测试的路由(每行一个)。例如:
api/auth
dashboard
admin
如果未提供,脚本将自动创建包含默认路由的 routes.txt 文件。
运行脚本:
python cve_2025_29927_scanner.py -f hosts.txt -t 10
python cve_2025_29927_scanner.py -f hosts.txt -r custom_routes.txt -t 10
参数说明:
-f, --file:包含主机列表的文件(必需)。-r, --routes:包含路由列表的文件(可选;若未指定则使用 routes.txt)。示例输出
python
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
------------------------------------------------------------
依赖项列在 requirements.txt 中:
requests>=2.31.0urllib3>=1.26.18欢迎贡献!
-t, --threads:最大线程数(默认:10)。在终端输出中查看结果。