Junglewise Threat Intelligence

CVE-2025-54880: Mermaid improper sanitization of architecture diagram iconText leading to XSS

CVE-2025-54880 · Severity: medium · CVSS 4 · Published 2025-08-19

Executive brief

Mermaid is a JavaScript library used to render diagrams from text descriptions on websites. The architecture diagram feature fails to sanitize user-supplied text for icon labels, allowing attackers to inject malicious HTML and JavaScript code. When a website displays user-created or user-controlled diagrams without additional protections, an attacker can execute arbitrary JavaScript in visitors' browsers, potentially stealing session data, credentials, or performing actions on behalf of the victim.

Technical details

The vulnerability is a cross-site scripting (XSS) flaw introduced in Mermaid v11.1.0 and present through v11.9.0. The architecture diagram rendering code passes the `iconText` parameter directly to the d3 `html()` method via `.html(service.iconText)`, which treats the input as raw HTML rather than escaped text. No validation or sanitization occurs on this user-controlled input before insertion into the DOM. The attack is network-reachable and requires no authentication, but does require user interaction to render a malicious diagram. An attacker can craft a diagram containing JavaScript payloads in the iconText field that execute in the browser context. The vulnerability was patched in version 11.10.0.

Affected products

  • Mermaid Mermaid 11.1.0 through 11.9.0

Timeline

  • 2025-08-19: disclosed
  • 2025-08-19: patched: Fixed in version 11.10.0

References

Related threats