
Cloud Vulnerability DB
A community-led vulnerabilities database
CVE-2026-26226 is an SVG attribute injection vulnerability in the beautiful-mermaid npm package (versions prior to 0.1.3) that can lead to cross-site scripting (XSS) when rendering attacker-controlled Mermaid diagrams. User-controlled values from Mermaid style and classDef directives are interpolated into SVG attribute values without proper escaping, allowing crafted input to break out of an attribute context and inject arbitrary SVG elements or attributes. The vulnerability was disclosed and patched on February 13, 2026, with the fix merged on January 29, 2026. It carries a CVSS v4.0 base score of 5.3 (Medium) (GitHub Advisory).
The root cause is CWE-79 (Improper Neutralization of Input During Web Page Generation — Cross-site Scripting): the library directly interpolates user-supplied values from Mermaid style and classDef directives into SVG attribute strings without applying XML/HTML escaping. An attacker can craft a Mermaid diagram where a style value contains a quote character (") followed by /> to close the current SVG attribute and element, then inject arbitrary SVG markup — including event handlers or <script> elements — into the rendered output. The fix applied escapeXml() to all four inlineStyle properties (fill, stroke, stroke-width, color) before they are written into SVG output. No privileges are required and the only precondition is that the application renders attacker-controlled Mermaid diagram input (GitHub Advisory, PR #8).
When a vulnerable application embeds the generated SVG in a web page, successful exploitation results in arbitrary script execution in the context of the embedding origin, enabling session hijacking, credential theft, malware distribution, or unauthorized actions on behalf of the victim user. Both confidentiality and integrity of the vulnerable and subsequent systems are impacted at a low level, while availability is unaffected. The scope of impact is limited to users who view pages where attacker-controlled Mermaid diagrams are rendered (GitHub Advisory).
There is no public proof-of-concept exploit and no evidence of in-the-wild exploitation at this time (GitHub Advisory). The EPSS score is approximately 0.071% (0.000710), indicating a low near-term exploitation probability. The vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. No threat actor attribution has been reported.
beautiful-mermaid npm package (version < 0.1.3) and allows users to supply or influence Mermaid diagram source code that is then rendered and embedded as SVG in a web page.style directive where the style value contains a double-quote to break out of the SVG attribute context, for example:graph TD
A[Harmless] --> B[Safe]
style A fill:red"/> <script>alert(document.cookie)</script>beautiful-mermaid, the unescaped style value closes the SVG attribute and element, injecting the attacker-controlled SVG/HTML markup into the rendered output.", />, <script, onerror=, or onload= within style or classDef directive values.<script> tags, event handler attributes (e.g., onload, onerror), or unexpected <image> elements with external href values within SVG content generated by beautiful-mermaid.Upgrade beautiful-mermaid to version 0.1.3 or later, which applies escapeXml() to all inline style properties before SVG output, preventing attribute injection (GitHub Release v0.1.3). If immediate patching is not possible, implement server-side input validation and sanitization to reject or escape special characters (", <, >) in Mermaid style and classDef directive values before passing them to the library. Additionally, deploy a strict Content Security Policy (CSP) on pages that render Mermaid diagrams to limit the impact of any injected scripts.
The fix was contributed by external researcher willdollman via a pull request merged on January 29, 2026, demonstrating community-driven security improvement for the project (PR #8). The GitHub Advisory was published and reviewed on February 13, 2026, and the release attracted positive reactions from several community members (GitHub Release v0.1.3). No significant broader media coverage or notable researcher commentary beyond the advisory and patch PR has been identified.
Source: This report was generated using AI
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."