Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. mermaid
  4. ›
  5. CVE-2026-50159

CVE-2026-50159: Mermaid allows CSS injection applying to sibling elements of the diagram

August 6, 2026

Mermaid does not fully restrict CSS to the rendered SVG subtree. Although selectors are prefixed with #mermaid-X, sibling (~ and +) combinators can still escape the Mermaid container and inject styles to DOM elements adjacent to the diagram <svg>.

Most users of mermaid would not be affected by this, as mermaid adds its <svg> as an only child of it’s parent element. However, you may be affected if you manually insert the <svg> (or other elements) into the DOM yourself.

References

  • github.com/advisories/GHSA-6x64-9x62-f2gx
  • github.com/mermaid-js/mermaid/commit/12d472c9ed43f94814b110da8d7a9ae6dd5266ed
  • github.com/mermaid-js/mermaid/commit/7e83f1533318b307764d961906a73377266f4c5e
  • github.com/mermaid-js/mermaid/pull/8022
  • github.com/mermaid-js/mermaid/releases/tag/mermaid@11.16.1
  • github.com/mermaid-js/mermaid/releases/tag/v10.9.8
  • github.com/mermaid-js/mermaid/security/advisories/GHSA-6x64-9x62-f2gx
  • nvd.nist.gov/vuln/detail/CVE-2026-50159

Code Behaviors & Features

Detect and mitigate CVE-2026-50159 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 10.9.8, all versions starting from 11.0.0-alpha.1 before 11.16.1

Fixed versions

  • 10.9.8
  • 11.16.1

Solution

Upgrade to versions 10.9.8, 11.16.1 or above.

Impact 7.1 HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L

Learn more about CVSS

Weakness

  • CWE-94: Improper Control of Generation of Code ('Code Injection')

Source file

npm/mermaid/CVE-2026-50159.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sat, 08 Aug 2026 00:18:00 +0000.