PT-2026-68752 · Mermaid · Mermaid

CVE-2026-50159

·

Published

2026-08-06

·

Updated

2026-08-07

CVSS v4.0

5.3

Medium

VectorAV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:L/SI:L/SA:L/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Name of the Vulnerable Software and Affected Versions Mermaid versions prior to 10.9.8 Mermaid versions prior to 11.16.1
Description Mermaid is vulnerable to CSS injection through sibling combinator selectors generated from class or id names provided in the diagram text. The software fails to fully restrict CSS to the rendered SVG subtree, allowing selectors using ~ or + combinators to escape the Mermaid container and apply styles to DOM elements adjacent to the diagram <svg>. This occurs because CSS nesting expands these combinators to select all sibling elements following the SVG in the DOM, outside the diagram boundary. An attacker providing diagram source can use this to perform UI redressing, hide content, conduct conditional CSS-based probing, or execute phishing-style visual manipulation. This issue primarily affects users who manually insert the <svg> into the DOM rather than using the default rendering method.
Recommendations Update to version 10.9.8 or later. Update to version 11.16.1 or later. Wrap the <svg> in an element with no other children, such as a <div>, or use mermaid.run() or mermaid.initialize() to handle insertion. Set the securityLevel configuration to sandbox. Set the secure configuration value to prevent diagrams from modifying fontFamily, themeCSS, altFontFamily, and themeVariables.

Exploit

Fix

Code Injection

Found an issue in the description? Have something to add? Feel free to write us 👾

Weakness Enumeration

Related Identifiers

CVE-2026-50159
GHSA-6X64-9X62-F2GX

Affected Products

Mermaid