Code Injection in mermaid - CVE-2026-50159
Published: August 4, 2026
Vulnerability details
The vulnerability allows a remote attacker to manipulate the user interface of adjacent page elements.
The vulnerability exists due to improper control of generated stylesheet content in the CSS scoping middleware when processing attacker-supplied diagram source. A remote attacker can supply crafted CSS selectors using sibling combinators to manipulate the user interface of adjacent page elements.
This affects cases where the rendered SVG is inserted into the DOM alongside sibling elements rather than being the only child of its parent.