Code Injection in mermaid - CVE-2026-41159
Published: May 12, 2026
mermaid
mermaid-js
Description
The vulnerability allows a remote attacker to inject CSS and modify page content outside of the Mermaid diagram.
The vulnerability exists due to improper neutralization of special elements in configuration options in Mermaid configuration handling when processing user-supplied diagram initialization settings. A remote attacker can supply crafted fontFamily, themeCSS, or altFontFamily values to inject CSS and modify page content outside of the Mermaid diagram.
User interaction is required to load or render a crafted diagram.