Skip to content
KitploitKITPLOIT
ToolsBlog
Log in
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-41940-analysis — Technical analysis of the cPanel/WHM auth bypass | Kitploit
Tools/GitHubGitHub/oguz-kagan-akar/cve-2026-41940-analysis
Authentication & AuthorizationVulnerability AnalysisExploitationWeb SecurityThreat IntelligencePapers & ResearchLearning & EducationIncident Response

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share
GitHub
oguz-kagan-akar/cve-2026-41940-analysis

CVE-2026-41940-analysis

Technical analysis of the cPanel/WHM auth bypass

View Repository
302 months agoNot yet reviewed

CVE-2026-41940 — cPanel & WHM Pre-Authentication Root Bypass via Session-File CRLF Injection

A Defender-Focused Technical Deep Dive


1. Executive Summary

FieldValue
CVE IDCVE-2026-41940
CVSS v3.19.8 (Critical) — Network / Low Complexity / No Privileges / No User Interaction
Vulnerability classPre-authentication CRLF injection → session-file poisoning → authentication bypass
CWECWE-93 (Improper Neutralization of CRLF Sequences), arguably closer to CWE-117 (Improper Output Neutralization for Logs/Files), since the injected CRLF lands in an on-disk session file rather than an HTTP response header
Affected productscPanel, WHM (WebHost Manager), WP Squared
ImpactUnauthenticated, remote acquisition of a fully privileged root administrative session in WHM
Disclosure dateApril 28, 2026 (cPanel security advisory)
CVE assignmentApril 29, 2026
In-the-wild exploitationObserved as early as February 23, 2026, per hosting provider KnownHost — roughly two months before the patch shipped
CISA KEVAdded shortly after disclosure
Estimated exposure~1.5 million internet-facing cPanel instances (Shodan telemetry cited by Rapid7); cPanel holds an estimated 94% share of the web control-panel market (W3Techs)
WorkaroundNone — patching is the only complete remediation

cPanel & WHM is the dominant control-panel software for shared and reseller web hosting. cPanel is the customer-facing account interface; WHM is the root-level administrative interface used by hosting providers and server owners. Both are served by the same Perl daemon, cpsrvd, listening on paired ports for each surface (cPanel: 2082/2083, WHM: 2086/2087, Webmail: 2095/2096).

CVE-2026-41940 allows an attacker with no credentials whatsoever to manipulate on-disk session state before authentication occurs, causing cpsrvd to later reinterpret attacker-supplied data as legitimate, fully-authenticated, root-privileged session attributes. The result is complete compromise of the management plane for every website and account hosted on the box — not a single-tenant issue, but a host-wide, provider-wide, and in aggregate, industry-wide one, given cPanel's market concentration.


2. Why This Vulnerability Matters Beyond Its CVSS Score

A 9.8 CVSS score is common enough that it can become numbing to read. Three structural factors make CVE-2026-41940 unusually severe in practice:

  1. Blast radius is the entire server, not an account. WHM compromise is root compromise. Every customer account, every database, every TLS private key, every backup, and every DNS zone on that server is immediately in scope.

  2. It was a true zero-day for roughly two months. KnownHost's telemetry places initial exploitation around February 23, 2026, well before the April 28 patch. Any organization that was internet-exposed during that window should assume compromise is possible, not merely theoretical, and should conduct a retrospective compromise assessment rather than relying on "we patched, so we're fine."

  3. Most affected organizations cannot patch this themselves. cPanel is typically deployed by hosting providers on behalf of tenants. End customers have no code-level control over the fix and are entirely dependent on their provider's patch cadence — which is exactly why several major hosts (Namecheap, KnownHost, HostPapa, InMotion) chose to pre-emptively block inbound traffic to the affected ports rather than wait for every tenant to update.

This third point is worth dwelling on. cPanel controls an estimated 94% of the control-panel market. A single logic flaw in one vendor's session-handling code became, for a period of weeks, a de facto industry-wide root-access vulnerability. That concentration risk is a recurring theme worth internalizing independent of this specific CVE.


3. Architectural Background

3.1 cpsrvd and the port model

cpsrvd is a long-running Perl daemon that serves all three cPanel product surfaces from the same binary and, critically, the same session-handling code path:

Port pairSurfaceAudience
2082 / 2083cPanelEnd customers (per-account)
2086 / 2087WHMRoot/reseller administrators
2095 / 2096WebmailEmail users

Because all three surfaces share the vulnerable session logic, exposure of any one of these six ports is sufficient for exploitation — there is no meaningfully "less exposed" surface among them. In well-segmented environments, none of these ports should be directly internet-reachable in the first place; in practice, management convenience, hybrid hosting arrangements, and firewall drift mean many were.

3.2 The dual session representation

cPanel sessions are persisted in two parallel on-disk representations, apparently for performance reasons:

  1. Raw session file (/var/cpanel/sessions/raw/<session-id>) — a line-oriented, plain-text key=value format, one attribute per line.
  2. JSON cache (/var/cpanel/sessions/cache/<session-id>, conceptually) — a structured JSON document, read preferentially by the normal request path because it's cheaper to parse.

Under ordinary operation, the JSON cache is authoritative and the raw file is a durability backstop. The vulnerability exists precisely because there are circumstances under which the raw file is re-parsed and used to regenerate the JSON cache, and the two formats disagree about what an embedded newline character means.


4. Root Cause: Four Independent Failures That Chain Together

CVE-2026-41940 is not a single mistake. It is the product of four separate weaknesses, each individually plausible as an isolated design decision, that align to produce a full authentication bypass. This "Swiss cheese" structure is instructive for defenders and code reviewers well beyond this specific product.

4.1 Layer 1 — Sanitization enforced by convention, not by the write path itself

cPanel's session subsystem already had a sanitizing routine responsible for stripping dangerous characters — carriage returns, line feeds, and = — from session values before they were persisted. The problem is where that routine was invoked from: it lived inside the higher-level wrapper functions (the session "create"/"modify" API), and it was the caller's responsibility to route through those wrappers rather than write session data directly.

The HTTP Basic Authentication handler inside cpsrvd — the code path that accepts credentials directly from the Authorization HTTP header — persisted the submitted password into the pre-authentication session file through a lower-level save routine that bypassed the sanitizing wrapper entirely. Because sanitization was opt-in rather than mandatory at the point of writing to disk, this one caller silently skipped it.

This is the textbook failure mode of "validate at the source, not the sink": as long as a security control can be bypassed by simply calling a different function, it eventually will be, whether through oversight, refactoring, or a code path nobody thought to audit against this specific control. The permanent fix cPanel shipped moves the sanitization call inside the save function itself, so it can no longer be skipped by any caller, present or future.

4.2 Layer 2 — Encryption that attacker-controlled input could disable

The session writer encrypts sensitive fields (notably the password field) using a per-session symmetric key. That key is derived from a component embedded in the session cookie the client presents. In the vulnerable code, if that key component was absent from the request — something entirely within an attacker's control, since they choose what cookie to send — the encryption step was silently skipped rather than the write being refused.

Download Tool