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


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.57% (44th percentile)

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-18592305
  • published8 Aug 2026
  • disclosed6 Aug 2026
  • credith3ri0s

Introduced: 6 Aug 2026

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

How to fix?

Upgrade mermaid to version 10.9.8, 11.16.1 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 via the CSS namespacing process. An attacker can manipulate the appearance or behavior of adjacent DOM elements by injecting crafted CSS selectors into diagram source content. This is only exploitable if the rendered SVG is not the only child of its parent element, such as when the SVG is manually inserted alongside other elements.

Workaround

This vulnerability can be mitigated by wrapping the SVG in a container element with no other children, or by using configuration options such as setting the securityLevel to 'sandbox' or enabling the 'secure' config value to restrict diagram modifications.

CVSS Base Scores

version 4.0
version 3.1