/

CVE-2026-54011

Severity:

HIGH RISK

(8.7)

Stored XSS (CWE-79) via Mermaid SVG in Open WebUI

CVE-2026-54011

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Client-Side Code Execution / Session Compromise

Severity:

HIGH RISK

(8.7)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Open WebUI's Markdown preview feature renders Mermaid diagrams with a loose security level and injects the resulting SVG into the DOM using innerHTML.

If an attacker can supply crafted Mermaid content in Markdown files, this can lead to JavaScript execution in the victim's browser under the Open WebUI origin.

Affected context

This vulnerability appears in Open WebUI instances that:

  • Allow users to upload, store, or edit Markdown content
  • Render Mermaid diagram blocks in the file preview panel
  • Use Mermaid with securityLevel: 'loose' and insert generated SVG via innerHTML

It is relevant wherever Markdown content can be influenced by untrusted or semi-trusted users and is later previewed by other users in the web interface.

Exploit preconditions

  • Attack surface: Web UI file preview panel that displays Markdown with Mermaid blocks.
  • Required access: Ability to create or modify Markdown files rendered by Open WebUI (e.g., upload, sync, or edit documents).
  • Trigger point: A victim opens the Markdown file in the preview panel, causing Mermaid to render the attacker-controlled diagram.
  • Why exploitation is possible: Mermaid is configured with securityLevel: 'loose', and the resulting SVG is injected via innerHTML without sufficient sanitization, allowing script-capable markup to execute in the victim's browser.

Why this happens

The underlying issue is a cross-site scripting pattern where untrusted content is rendered into the browser and inserted into the DOM using APIs that interpret HTML.

By configuring Mermaid with a loose security level and combining it with innerHTML, the application treats attacker-controlled diagram definitions as trusted markup.

This maps to CWE-79 (Improper Neutralization of Input During Web Page Generation), where failure to correctly sanitize or encode user-supplied content allows script execution in the client.

Potential impact

  • Attacker-controlled JavaScript may execute in the victim's browser.
  • Session data and authentication tokens could be accessed or exfiltrated.
  • User actions within Open WebUI can be hijacked or performed on the user's behalf.
  • Malicious scripts may alter displayed content, conduct phishing, or pivot into broader browser-based attacks.

General mitigation guidance

Effective mitigation focuses on reducing trust in rendered content and hardening the rendering pipeline:

  • Use stricter security settings for diagram-rendering libraries (e.g., disallow script-capable constructs).
  • Avoid inserting library output into the DOM via innerHTML or similar APIs; prefer safe DOM construction that treats content as data, not HTML.
  • Apply robust HTML and SVG sanitization to any content derived from user-controlled sources before rendering.
  • Limit who can author or upload Markdown that will be previewed by others, and apply least-privilege controls around content features that can affect rendering.

How teams detect issues like this

Organizations can detect similar vulnerabilities by:

  • Running static analysis or linters that flag innerHTML, outerHTML, and other sink APIs when used with untrusted data.
  • Reviewing code paths that integrate Markdown, diagram libraries, or other rich text renderers for unsafe configurations and missing sanitization.
  • Establishing security review policies for UI features that transform user content into HTML, SVG, or scriptable markup.
  • Using automated application security testing tools to probe Markdown and diagram-rendering features for XSS behaviors.

Sources

SourceLink
github.comgithub.com/open-webui/open-webui/security/advisories/GHSA-v8qj-hxv7-mgvv

Frequently asked

questions

Yes. If Open WebUI is exposed to users over a network, an attacker who can supply Markdown content can cause victims to execute malicious JavaScript when they preview the affected file.

The attacker needs the ability to create, upload, or modify Markdown files that are later opened in the preview panel. No special server-side privileges are required beyond content authoring or sharing.

Harden the rendering pipeline by using strict security settings in Mermaid, avoiding innerHTML for untrusted content, and applying robust sanitization and encoding before any user-controlled data reaches the DOM.

Treat all user-controlled content as untrusted, systematically avoid dangerous DOM insertion APIs, enforce secure defaults in third-party libraries, and include XSS-focused checks in code review and automated testing for new UI features.

Find out what's already
exploitable in your codebase.