Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
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 applicationsLearn about Arbitrary Code Injection vulnerabilities in an interactive lesson.
Start learningUpgrade mermaid to version 10.9.6, 11.15.0 or higher.
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.
This vulnerability can be mitigated by setting the secure configuration value or by configuring securityLevel to sandbox.
%%{init: {"fontFamily": "x;a{b} :not(&){background:green !important} c{d}"}}%%
flowchart LR
A --> B