
Webmin 2.670 - High 8.0 - Remote - Stored XSS - anonymous mail; detach.cgi serves unclosed script as text/html
Webmin already treated SVG mail as a script problem. HTML attachments still go through a filter that only strips a <script> when the closing tag is sitting there too. A stranger who can send mail plants an unclosed script. The admin who clicks View loads it as text/html on the Webmin origin they are already logged into. The session cookie is HttpOnly, so document.cookie is empty. Same-origin requests still carry it.
Class: Stored XSS Reach: Remote (anonymous mail sender; victim opens View)
Webmin 2.670 (3a2b2b86) - Webmin
I planted a mailbox file, logged in as root, opened the message, and fetched the View URL. detach.cgi answered 200 text/html, no CSP, witness still in the body, no </script>. That is the leftover. Not CVE-2026-49102.
| ID | no CVE yet |
| Class | Stored XSS |
| Reach | Remote (anonymous mail sender; victim opens View) |
| CWE | CWE-79 |
| CVSS | High: 8.0 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N |
| Product | Webmin |
| Affected | 2.670 tag 2.670 (3a2b2b8671c0669c129f5275b3dd1853106ae02b) |
| Auth | none on Webmin. Attacker sends mail. Victim is a mailboxes user who clicks View |
| License | GNU Affero GPL v3.0 |
| Lab | loopback 127.0.0.1:18410. Compose webminh07. |
Needs a mailbox Webmin will read and one click on View. In ordinary words: the sender never logs into Webmin. The person who opens the attachment is running the sender's script as themselves on the admin site.
| Privilege | Method / sink | Recon / integrity / availability | Lab-proven or inferred |
|---|---|---|---|
Plant an unclosed <script> as a text/html attachment | mailbox file with Content-Disposition: attachment | Integrity (stored markup) | Lab-proven. /var/mail/root |
| Keep the part out of the sandboxed body iframe | find_body skips Content-Disposition: attachment | Recon | Lab-proven. Attachment table on view_mail.cgi |
| Serve that part as HTML on the Webmin origin | GET /mailboxes/detach.cgi/... View link | Integrity (origin) | Lab-proven. content-type=text/html |
Keep the script after filter_javascript | unclosed <script> (no </script>) | Integrity | Lab-proven. script=1 close=0 witness=1 |
| Skip CSP on that response | detach.cgi never calls header() | Integrity | Lab-proven. csp=0 |
| Act as the victim on same-origin Webmin CGIs | browser script, sid cookie still sent | Integrity of whatever that session can touch | Inferred. Lab is HTTP, not a browser. Cookie is HttpOnly |
Stays closed on this leftover
| Axis | Method / sink | Why it is closed |
|---|---|---|
| Integrity | SVG attachment | CVE-2026-49102. Forced text/plain at detach.cgi:76-83 |
| Integrity | HTML message body | iframe sandbox without allow-scripts |
| Recon | document.cookie | sid is HttpOnly by default |
| Integrity | save=1 download | Content-Disposition: Attachment; not the View link |
| Integrity | Unauthenticated detach.cgi | miniserv session still required |
| Integrity | Overwrite on detach | CVE-2026-49103. Different bug |
The default CSP in header() would have allowed 'unsafe-inline' anyway. Calling header() is still the missing hook. The filter is the actual hole.
Mailboxes is a core module. Root has it on a default install. I went looking for the sibling of the SVG mail XSS that 2.670 already closed.
mailboxes/detach.cgi prints Content-type from the part and, for text/html, runs safe_urls(filter_javascript()). filter_javascript deletes a script element only when both tags are present:
$rv =~ s/<\s*script[^>]*>([\000-\377]*?)<\s*\/script\s*>//gi;
An unclosed script never matches. View is a same-origin GET from view_mail.cgi, so the referer check passes.
Wrong turns: treating this as CVE-2026-49102; treating the sandboxed body iframe as the sink; treating HttpOnly as a stop; using the type= override that skips the filter. The View link does not set type=. The leftover is the filtered path.
python3 webmin-detach-xss-Abraxas-Labs.py
or:
cd lab
./run.sh
Clones webmin/webmin tag 2.670 (3a2b2b8671c0669c129f5275b3dd1853106ae02b) into lab/src and reuses webmin-lab:2.670 when present. Loopback only. Docker, git, python3.
IOC planted-mbox /var/mail/root unclosed-script
IOC detach status=200 content-type=text/html csp=0 script=1 close=0 witness=1
SUCCESS WEBMIN-H07-DETACH-XSS detach.cgi text/html unclosed-script WEBMIN-H07-XSS-WITNESS
Make filter_javascript strip an unclosed <script> as well as a matched pair, or always serve attachments as text/plain / download. Call header() from detach.cgi so the response actually gets a CSP. 'unsafe-inline' in that CSP is still a problem for this class.
3a2b2b8671c0669c129f5275b3dd1853106ae02b)mailboxes/detach.cgifilter_javascript in web-lib-funcs.pltext/plain; CVE-2026-49103 detach overwriteGNU Affero GPL v3.0. See LICENSE. Loopback lab only. No warranty.
Abraxas Labs [email protected]