AgentbeamBeta
AI agent vulnerability · Open WebUI

CVE-2026-45318: Open WebUI has stored XSS via unsanitized Office/Excel/DOCX file preview rendering ({@html} without DOMPurify)

mediumCVSS 3.1 5.4GHSA-hcwp-82g6-8wxc

Open WebUI up to 0.9.2 has a stored cross-site scripting flaw in Office file preview. Excel and DOCX uploads are converted to HTML and rendered with Svelte's `{@html}` without DOMPurify, so a malicious document runs script in the browser of anyone who previews it. Fixed in 0.9.3. This is a regression of an earlier fix from 0.8.0.

Published May 14, 2026 · Updated May 19, 2026 · Analysis Nov 11, 2026

What an attacker can do

Open WebUI converts uploaded Excel output from XLSX.utils.sheet_to_html() and DOCX content to HTML and inserts it with {@html}. DOMPurify is in the codebase and used in other places, but these preview paths skip it. A crafted document carries HTML or script that executes in the victim's session when they open the preview.

The attacker needs a low-privilege account that can upload files, and the victim must open the preview. On a shared instance, one file can hit every user who previews it, including administrators. Script running in the session can read chat history and uploaded documents, steal tokens or API keys held in the page and take over the account. Open WebUI users often connect it to model keys and internal tools, so an admin takeover has wide reach.

The same root cause was fixed in 0.8.0 under GHSA-jwf8-pv5p-vhmc and came back after that. This advisory also covers the fileOfficeHtml sink in FileNav.svelte, which the earlier advisory did not.

Who is affected

Open WebUI (open-webui on PyPI) up to and including 0.9.2. The advisory says the Excel path was exploitable again as of 0.8.12. Sinks:

  • src/lib/components/chat/FileNav/FilePreview.svelte (fileOfficeHtml)
  • src/lib/components/common/FileItemModal.svelte (excelHtml, docxHtml)
  • src/lib/components/chat/FileNav.svelte (fileOfficeHtml)

Check the version:

pip show open-webui

open-webui

Ecosystem
PyPI
Affected
<= 0.9.2
Fixed in
0.9.3
Check
pip show open-webui

How to fix it

Upgrade to Open WebUI 0.9.3, which wraps each sink in DOMPurify.sanitize():

pip install --upgrade open-webui==0.9.3

For Docker, pull a 0.9.3 or newer image. The advisory lists no workaround. Until you upgrade, restrict uploads to trusted users and do not preview Office files from unknown sources; these are general precautions, not from the advisory.

How to tell if you were hit

Review uploaded .xlsx and .docx files from low-privilege accounts, looking for HTML or script content inside cells and document text. Check for unexpected API key creation or changed account settings by users who recently previewed a shared file. Browser console or proxy logs may show requests to external hosts from the Open WebUI origin after a preview.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Related advisory

This advisory tracks a regression of the original Excel-preview XSS that was publicly disclosed and patched under GHSA-jwf8-pv5p-vhmc (patched in v0.8.0). 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 as of v0.8.12 and through the version range listed above. This advisory additionally covers the related fileOfficeHtml sink in src/lib/components/chat/FileNav.svelte (lines 458 and 1285) which was not part of the jwf8 advisory's scope.

Summary

Open 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.

This is a classic defense propagation failure: the sanitization primitive exists in the codebase but is not consistently applied to all rendering surfaces.

Root Cause

The defense primitive exists: DOMPurify.sanitize() is imported and used in components like General.svelte, MarkdownInlineTokens.svelte, Banner.svelte, and SVGPanZoom.svelte.

But 3 file-preview paths skip it:

Occurrence 1: FilePreview.svelte — Office HTML

File: src/lib/components/chat/FileNav/FilePreview.svelte line 324

{:else if fileOfficeHtml !== null}
    
        {@html fileOfficeHtml}   <!-- NO DOMPurify! -->
    

fileOfficeHtml is generated from user-uploaded Office files (PPT, DOC, etc.) converted to HTML. The HTML is rendered directly without sanitization.

Occurrence 2: FileItemModal.svelte — Excel HTML

File: src/lib/components/common/FileItemModal.svelte line 560

{@html excelHtml}   <!-- NO DOMPurify! -->

excelHtml is generated from user-uploaded Excel files converted to HTML tables. No sanitization applied.

Occurrence 3: FileItemModal.svelte — DOCX HTML

File: src/lib/components/common/FileItemModal.svelte line 590

{@html docxHtml}   <!-- NO DOMPurify! -->

docxHtml is generated from user-uploaded DOCX files converted to HTML. No sanitization applied.

Contrast with Sanitized Paths

For comparison, the same codebase correctly sanitizes in other locations:

<!-- MarkdownInlineTokens.svelte:130 — SAFE -->
{@html DOMPurify.sanitize(token.text, { ADD_ATTR: ['target'] })}

<!-- General.svelte:276 — SAFE -->
{@html DOMPurify.sanitize($config?.license_metadata?.html)}

<!-- Banner.svelte:103 — SAFE -->
{@html DOMPurify.sanitize(marked.parse(...))}

Defense Propagation Gap

| Metric | Value |
| Total `{@html}` usages | 23 |
| With DOMPurify | 9 (39%) |
| **Without DOMPurify** | **14 (61%)** |
| Confirmed exploitable (file preview) | **3** |

The 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.

Tested Version

  • Open WebUI v0.8.12 (commit 9bd8425, tag v0.8.12)

Steps to Reproduce

PoC 1: Malicious Excel File

  1. Create a .xlsx file with a cell containing: ```
   (Using a library like openpyxl to inject raw HTML into cell values)

2. Upload the file to Open WebUI via the chat file upload

3. When any user previews the file → `excelHtml` renders the injected HTML → **XSS fires**

### PoC 2: Malicious DOCX File

1. Create a `.docx` file with embedded HTML:

<![CDATA[]]>


2. Upload to Open WebUI

3. File preview renders `docxHtml` → **XSS fires**

### PoC 3: Verify Rendering Path

// In browser devtools on Open WebUI, after uploading a file: // The file preview component renders: // FileItemModal → {@html excelHtml} // no DOMPurify // FileItemModal → {@html docxHtml} // no DOMPurify // FilePreview → {@html fileOfficeHtml} // no DOMPurify

// Compare with safe path: // NotebookView → {@html DOMPurify.sanitize(toStr(output.data['text/html']))} // sanitized!


## Impact

- **Stored XSS** — malicious file is stored server-side, XSS fires for every user who previews it
- **Session hijacking** via `document.cookie` theft
- **Account takeover** — attacker can perform actions as the victim user
- **Data exfiltration** — read chat history, API keys, uploaded documents
- **Multi-user environments** — shared Open WebUI instances are especially vulnerable (one malicious upload affects all viewers)
- **Defense propagation failure** — DOMPurify is available and used elsewhere, but not applied to file preview paths

## Suggested Remediation

Apply DOMPurify to all three file preview paths:

<!-- FilePreview.svelte:324 — FIX --> {@html DOMPurify.sanitize(fileOfficeHtml)}

<!-- FileItemModal.svelte:560 — FIX --> {@html DOMPurify.sanitize(excelHtml)}

<!-- FileItemModal.svelte:590 — FIX --> {@html DOMPurify.sanitize(docxHtml)}


Alternatively, adopt a **defense-by-default pattern**: create a wrapper component that always applies DOMPurify, making unsanitized `{@html}` usage a code review flag.

## References

- CWE-79: Improper Neutralization of Input During Web Page Generation (XSS)
- OWASP XSS Prevention Cheat Sheet
- GHSA-x75g-rp99-qqpx: Previous Open WebUI report (DNS rebinding TOCTOU, different vulnerability class)

Credited to foodlook, Classic298.

Questions

Is Open WebUI 0.9.2 affected by CVE-2026-45318?

Yes. All versions through 0.9.2 are affected. 0.9.3 is the fixed release.

Does the victim need to click anything?

Yes. They must open the file preview. The attacker also needs an account that can upload files.

Why is this a regression?

The same Excel preview flaw was patched in 0.8.0 under GHSA-jwf8-pv5p-vhmc and was reintroduced in a later release.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Open WebUI vulnerabilities

All Open WebUI entries