mailcow: Stored XSS From Domain Admin to Super Admin

A domain admin sets the Full name of a mailbox to HTML; the Mailboxes list of the admin UI inserts it unfiltered and runs JavaScript in the session of the super admin, who controls the entire instance.

Advisory ID: TP-2026-128
Product: mailcow (self-hosted, Docker-based mail server suite)
Vulnerability type: Stored cross-site scripting (CWE-79)
CVE: requested on 5 August 2026 (GitHub CNA), assignment pending
CVSS 3.1: 8.1 (High) · CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:N
Affected versions: < 2026-07a
Vendor advisory: GHSA-76cm-26jx-jmhr
Fixed in: 2026-07a
Reported: 12 June 2026

Summary

The mailcow admin UI shows the Full name (name) of a mailbox in the Mailboxes list through a DataTables column that inserts the value as HTML without escaping. A domain admin sets the Full name of a mailbox in a domain it manages; the value is stored without HTML encoding and executed in the super admin's browser. A domain admin is a delegated role confined to its own domains, while the super admin controls every domain, every mailbox and all server configuration. The administrator of a single domain therefore takes over the entire instance and every hosted tenant.

Root Cause

The Mailboxes table defines the column with data: 'name' and no render callback, and DataTables 1.13.1 writes cell data into the DOM as HTML (data/web/js/site/mailbox.js:1062). The dataSrc preprocessor escapes item.username and item.tags but not item.name (mailbox.js:993, :998), although the same file escapes the field for the resources table (mailbox.js:1461). On write the server applies only ltrim(rtrim($_data['name'], '>'), '<'), which removes one leading < and one trailing > and encodes nothing, so !<img src=x onerror=...>! survives unchanged (data/web/inc/functions.mailbox.inc.php:1073, :3143). A domain admin reaches this write path for mailboxes in its own domain (functions.mailbox.inc.php:3180), and GET /api/v1/get/mailbox/all returns the value unescaped. The shipped nginx configuration sets no Content-Security-Policy (data/conf/nginx/templates/sites-default.conf.j2:15-21).

Proof of Concept

POST /api/v1/add/mailbox        (domain admin session)
Content-Type: application/json

{"local_part":"xssvictim","domain":"xsstest.example",
 "name":"!<img src=x onerror=alert(document.domain)>!",
 "password":"<pw>","password2":"<pw>","quota":"100","active":"1"}

=> [{"type":"success","msg":["mailbox_added","[email protected]"]}]

GET /api/v1/get/mailbox/all     (super admin session)

=> {"username":"[email protected]",
    "name":"!<img src=x onerror=alert(document.domain)>!", ...}

When the super admin then opens the Mailboxes list (/admin/mailbox), DataTables inserts name as HTML and the onerror handler runs in that session. Verified on mailcow-dockerized 2026-05c in the default configuration with one super admin and one domain admin confined to xsstest.example.

Impact

  • Arbitrary JavaScript in the super admin session, for example to create another super admin or a read-write API key that outlives the fix.
  • Reading, resetting and exfiltrating every mailbox across all domains, not only in the attacker's tenant.
  • Access to settings reserved for the super admin: relayhosts, transports, global DKIM, container restart, global sieve.
  • The attacker needs a domain admin account; the super admin only has to open the Mailboxes list. Instances without a separate domain admin are not affected.

References

Is Something Like This in Your Software?

Our team found this vulnerability in the course of its work. Have your applications tested by the same specialists, with a penetration test from turingpoint.