NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Open WebUI

CVE-2026-54011: Open WebUI: Stored XSS in Mermaid Markdown Preview

highCVSS 3.1 8.7GHSA-v8qj-hxv7-mgvv

Open WebUI's file preview panel renders Mermaid diagrams from Markdown files in a permissive mode and inserts the SVG with innerHTML. A malicious .md file can run JavaScript in the victim's browser under the Open WebUI origin. Open WebUI 0.9.5 and earlier is affected. Upgrade to 0.9.6.

Published Jun 17, 2026 · Updated Jul 20, 2026 · Analysis Oct 26, 2026

What an attacker can do

Mermaid is initialized with securityLevel: 'loose' in src/lib/utils/index.ts. The file preview component FilePreview.svelte then sets wrapper.innerHTML = svg with the generated output. In loose mode, Mermaid allows click handlers, so a diagram can carry a javascript: link.

The proof of concept is a Markdown file with a mermaid code block holding a node and a click A href "javascript:alert(document.domain)" line. The victim opens the file in the preview panel and clicks the node. The script then runs with the page's origin.

The attacker needs a low-privilege account or any way to get a file in front of the victim, and the victim must open and click. Script in the Open WebUI origin can use the victim's session. The CVSS score is 8.7, with high confidentiality and integrity impact and a changed scope. In practice this can mean reading chats, calling the API as the victim and, for admins, acting with admin rights.

Who is affected

Open WebUI 0.9.5 and earlier, both the open-webui pip package and the Docker image. The reporter reproduced it on v0.8.12 and on main. Check:

pip show open-webui

The vulnerable path is the Markdown file preview, which the reporter reached by enabling Code Interpreter and uploading a .md file.

open-webui

Ecosystem
PyPI
Affected
<= 0.9.5
Fixed in
0.9.6
Check
pip show open-webui

How to fix it

Upgrade to Open WebUI 0.9.6:

pip install --upgrade open-webui==0.9.6

Docker users should pull an image at 0.9.6 or later. The reporter's recommended remediation is Mermaid's strict security level, which uses the built-in DOMPurify sanitizer. The advisory lists no workaround. Until you upgrade, tell users not to open Markdown files from untrusted sources in the preview panel.

How to tell if you were hit

Search uploaded or generated Markdown files for mermaid blocks that contain click directives with javascript: targets. Check for unexpected API calls made from user sessions right after a file preview, such as new tokens, settings changes or chat exports. A Content-Security-Policy that blocks inline javascript: URLs would show violations if you report them.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

Open WebUI renders Mermaid blocks from Markdown files in the file preview panel and inserts the generated SVG into the DOM using innerHTML.

Because Mermaid is configured with securityLevel: 'loose', attacker-controlled Mermaid content can be rendered unsafely in this flow. A working payload was validated through the Markdown preview path, resulting in JavaScript execution in the victim’s browser under the application origin.

This is a confirmed stored XSS vulnerability reachable through normal product functionality.

Affected Version

  • main
  • Reproduced on v0.8.12

Affected Code

Mermaid is initialized in permissive mode:

https://github.com/open-webui/open-webui/blob/9bd84258d09eefe7bf975878fb0e31a5dadfe0f8/src/lib/utils/index.ts#L1698 The file preview path renders Mermaid output and injects the returned SVG into the DOM:

https://github.com/open-webui/open-webui/blob/9bd84258d09eefe7bf975878fb0e31a5dadfe0f8/src/lib/components/chat/FileNav/FilePreview.svelte#L133

Impact

A successful exploit allows JavaScript execution in the victim’s browser under the Open WebUI origin when a malicious Markdown file is opened in the preview panel.

PoC

A malicious .md file containing the follwowing contents can be used to trigger the bug:

flowchart LR A[click me] click A href "javascript:alert(document.domain)" "x"

Steps to reproduce: 1- Create a new chat 2- Enable Code Interpreter and browse and upload the file with .md extension.

3- Clicking on the file, and clicking click me should pop an alert

Remediation

Since mermaid has DOMPurify as a built-in, it is recommended to use the strict mode instead of loose.

Credited to ixSly, Classic298.

Questions

Does this need user interaction?

Yes. The victim must open the malicious Markdown file in the preview panel and click the node in the diagram. The CVSS vector marks UI:R.

Is it stored XSS?

The advisory calls it stored XSS, since the payload lives in a file that triggers each time it is previewed. It is reached through normal file preview, not a crafted URL.

Which version fixes CVE-2026-54011?

Open WebUI 0.9.6. Versions up to and including 0.9.5 are affected.

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