Finding XSS in a million websites (cPanel CVE-2023-29489)
A reflected cross-site scripting vulnerability existed in cPanel's handling of the /cpanelwebcall/ path, allowing an attacker to execute arbitrary JavaScript without authentication. This affected not only the cPanel management ports but also any website on ports 80 and 443 managed by cPanel, enabling session hijacking and potential web shell upload.
Published on blog.assetnote.io
cPanel is a web hosting control panel software that is deployed widely across the internet. To be exact, there are about ~1.4 million installations of cPanel exposed on the external internet at the time of writing this blog post.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The message_html variable in the error page handler was not HTML-encoded before being reflected back to the user.
Impact
An attacker could execute arbitrary JavaScript pre-authentication on almost every port of a cPanel server, potentially hijacking a user's cPanel session and uploading a web shell to gain command execution.
What the attacker needed
Victim clicks a crafted link; cPanel version before the patch
The fix
The vulnerability was fixed by HTML-encoding the message_html variable using a safe encoding function.
How it was found
- Send a request to the /cpanelwebcall/ path with a crafted value after the directory name.
- The request is routed to the webcall handler, which extracts an ID and fails validation.
- The error message containing the unsanitised input is reflected in the response, executing the script.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Cross-site scripting (XSS) is a flaw where a website inserts untrusted input into its pages without cleaning it, so an attacker can run their own JavaScript in a victim's browser. Here, cPanel failed to sanitise part of a URL, letting an attacker run code that could steal a logged-in user's session and take over their hosting account.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.