Arbitrary Code Injection Affecting mermaid package, versions <10.9.6>=11.0.0-alpha.1 <11.15.0


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Arbitrary Code Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-MERMAID-16642055
  • published12 May 2026
  • disclosed11 May 2026
  • creditzsxsoft

Introduced: 11 May 2026

NewCVE-2026-41159  (opens in a new tab)
CWE-94  (opens in a new tab)

How to fix?

Upgrade mermaid to version 10.9.6, 11.15.0 or higher.

Overview

mermaid is a package for generation of diagrams and flowcharts from text in a similar manner as markdown.

Affected versions of this package are vulnerable to Arbitrary Code Injection due to improper sanitization of configuration options such as fontFamily, themeCSS, and altFontFamily. An attacker can inject arbitrary CSS that escapes diagram scoping and affects the entire page, potentially leading to page defacement or exfiltration of DOM attributes by crafting malicious configuration values.

Workaround

This vulnerability can be mitigated by setting the secure configuration value or by configuring securityLevel to sandbox.

PoC

%%{init: {"fontFamily": "x;a{b} :not(&){background:green !important} c{d}"}}%%
flowchart LR
    A --> B

CVSS Base Scores

version 4.0
version 3.1