mermaid

Ecosystem: npm

Downloads:

Vulnerabilities from the last (months)
  • 0CriticalAffects 0 versions
  • 3HighAffects 3 versions
  • 0MediumAffects 0 versions
  • 12ModerateAffects 19 versions
  • 1LowAffects 2 versions
Severity distribution (all time)
16vulnerabilities
  • Critical0 (0.0%)
  • High3 (18.8%)
  • Medium0 (0.0%)
  • Moderate12 (75.0%)
  • Low1 (6.3%)

Monthly breakdown

  • Critical
  • High
  • Medium
  • Moderate
  • Low
  • 5 vulnerabilities
    • Critical: 0
    • High: 0
    • Medium: 0
    • Moderate: 4
    • Low: 1
  • 4 vulnerabilities
    • Critical: 0
    • High: 0
    • Medium: 0
    • Moderate: 4
    • Low: 0
  • 2 vulnerabilities
    • Critical: 0
    • High: 0
    • Medium: 0
    • Moderate: 2
    • Low: 0
  • 1 vulnerabilities
    • Critical: 0
    • High: 1
    • Medium: 0
    • Moderate: 0
    • Low: 0
  • 1 vulnerabilities
    • Critical: 0
    • High: 0
    • Medium: 0
    • Moderate: 1
    • Low: 0
  • 1 vulnerabilities
    • Critical: 0
    • High: 1
    • Medium: 0
    • Moderate: 0
    • Low: 0
  • 1 vulnerabilities
    • Critical: 0
    • High: 0
    • Medium: 0
    • Moderate: 1
    • Low: 0
  • 1 vulnerabilities
    • Critical: 0
    • High: 1
    • Medium: 0
    • Moderate: 0
    • Low: 0

Vulnerabilities (16)

Known vulnerabilities affecting mermaid, based on data from OSV.

Vulnerabilities affecting mermaid
IDSeveritySummaryAffected versionsPublishedSource
GHSA-2v8p-3f2j-5mp7ModerateMermaid XY Charts are vulnerable to an infinite loop DoS### Impact Mermaid XY Charts are vulnerable to an infinite loop DoS attack in the `setXAxisRangeData()`, when configuring an X-Axis with invalid parameters. As each loop appends an element to an array, this would generally only cause an `RangeError: Invalid array length` to appear after a few seconds, but may cause the page/JavaScript process to crash due to memory exhaustion, depending on the environment. #### Proof-of-concept ```txt xychart x-axis 1 --> 1 line [1, 2] ``` ### Patches This has been patched in https://github.com/mermaid-js/mermaid/commit/630aa7e5dd417e1f56bff2a1ce8df2
  • >= 10.6.0, < 10.9.8
  • >= 11.0.0-alpha.1, < 11.16.1
GitHub (opens in a new tab)
GHSA-3rrr-jr9j-h3q3ModerateMermaid Architecture diagrams are vulnerable to prototype pollutionRendering an untrusted `architecture-beta` diagram lets the diagram author write an arbitrary property with the value `horizontal` or `vertical` onto `Object.prototype`. A group id of `__proto__` is accepted as a valid parent. ### Impact Any code in the same realm that reads a property of that name from an arbitrary object, or enumerates an object with bare `for...in`, observes the injected value (which can only be the string `horizontal` or `vertical`. This may mean corrupted option/config defaults, bypassed truthiness checks, causing denial of service or logic corruption in the embedding
  • >= 11.5.0, < 11.16.1
GitHub (opens in a new tab)
GHSA-6x64-9x62-f2gxModerateMermaid allows CSS injection applying to sibling elements of the diagram### Summary 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. ### Details Mermaid namespaces CSS through with a middleware intended to scope all rules to the
  • >= 11.0.0-alpha.1, < 11.16.1
  • < 10.9.8
GitHub (opens in a new tab)
GHSA-c4c3-pg64-4m4vLowMermaid configuration APIs allow prototype pollution### Summary Mermaid's configuration setters (`mermaid.initialize`, `mermaidAPI.setConfig`, and `mermaidAPI.updateSiteConfig`) merge the caller-supplied configuration object into Mermaid's internal config using the `assignWithDepth` deep-merge helper that is vulnerable to prototype pollution. Because these APIs are intended to receive **trusted** configuration supplied by the application integrating Mermaid, Mermaid assesses the practical risk as **low**. The vulnerability is only reachable if an application forwards attacker-controlled data directly into one of these configuration entry poin
  • >= 11.0.0-alpha.1, < 11.16.1
  • < 10.9.8
GitHub (opens in a new tab)
GHSA-rhh3-jpg6-66xhModerateMermaid radar diagrams are vulnerable to DoS### Impact Mermaid radar diagrams allow arbitrary large values for `ticks`, which can cause high CPU usage, freezing the webpage/JavaScript process for long periods of time, until the process is eventually killed due to OOM/running out of memory. #### Proof-of-concept ```txt radar-beta axis a, b curve c {1, 1} ticks 1000000000 ``` ### Patches _Has the problem been patched? What versions should users upgrade to?_ This problem has been patched by https://github.com/mermaid-js/mermaid/commit/59b22fad2b3bb04f87a476c84a8a2b24679e607e, which was released in [Mermaid v11.16.1](https://git
  • >= 11.6.0, < 11.16.1
GitHub (opens in a new tab)
GHSA-6m6c-36f7-fhxhModerateMermaid Gantt Charts are vulnerable to an Infinite Loop DoS### Impact Mermaid v11.14.0 and earlier are vulnerable to a denial-of-service attack when rendering gantt charts, if they use the [`excludes` attribute](https://mermaid.js.org/syntax/gantt.html?#excludes) to exclude all dates. Example: ``` gantt excludes monday,tuesday,wednesday,thursday,friday,saturday,sunday DoS :2025-01-01, 1d ``` `mermaid.parse` is unaffected, unless you then call the `ganttDb.getTasks()` (which is called when rendering a diagram). ### Patches This has been patched in: - [v11.15.0](https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0) (see [faafb
  • >= 11.0.0-alpha.1, < 11.15.0
  • < 10.9.6
GitHub (opens in a new tab)
GHSA-87f9-hvmw-gh4pModerateMermaid: Improper sanitization of configuration leads to CSS injection### Impact Mermaid's default configuration allows injecting CSS that applies outside of the Mermaid diagram via the `fontFamily`, `themeCSS`, and `altFontFamily` configuration options. Live demo: [mermaid.live](https://mermaid.live/edit#pako:eNpNjktLxDAUhf9KvFBR6JS-60QQfODKlUvJ5k6TtsEmKTHFGUP-u-mI6Nmdy3fOPR56wwVQSBIvtXSUeAaD0e4ZlZxPDChhcLxFfwiEauOuLq_9Afv30ZpVczpaITS5kGox1qF2gfSeBwYhJAnThAyz-ewntI68vG5-0z3Z7e7IA9OQwmglB-rsKlJQwircLPgNZeAmocTPAi4GXGfHgOkQYwvqN2PUbzJuGSegA84f0a0LRyeeJI4W_xChubCPcbQD2pwbgHo4Aq2aKmvbqq3zoiu7pizqFE6RybN9VFfFY1HWXRVS-Dr_zLObrt7_V_gGGXZlGg) Example code: ``` %%{i
  • >= 11.0.0-alpha.1, < 11.15.0
  • < 10.9.6
GitHub (opens in a new tab)
GHSA-ghcm-xqfw-q4vrModerateMermaid: Improper sanitization of `classDef` in state diagrams leads to HTML injection### Impact Under the default configuration, Mermaid state diagram's `classDef` allow DOM injection that escapes the SVG, although `<script>` tags are removed, preventing XSS. #### Proof-of-concept ``` stateDiagram-v2 classDef xss fill:red</style></svg><style>*{x:x;y:y;overflow:visible!important;contain:none!important;transform:none!important;filter:none!important;clip-path:none!important}</style><div style="x:x;y:y;color:red;font:5em/1 monospace;display:grid;place-items:center;z-index:2147483647;width:100vw;height:100vh;position:fixed;top:0;left:0;background:black">HACKED</div><svg><style
  • >= 11.0.0-alpha.1, < 11.15.0
  • < 10.9.6
GitHub (opens in a new tab)
GHSA-xcj9-5m2h-648rModerateMermaid: Improper sanitization of `classDefs` in diagrams leads to CSS injection### Details The state diagram and any other diagram type that routes user-controlled style strings through createCssStyles parser for Mermaid v11.14.0 and earlier captures `classDef` values with an unrestricted regex: ```jison // packages/mermaid/src/diagrams/state/parser/stateDiagram.jison:83 <CLASSDEFID>[^\n]* { this.popState(); return 'CLASSDEF_STYLEOPTS' } ``` The value passes unsanitized through `addStyleClass()` -> `createCssStyles()` -> `style.innerHTML` (mermaidAPI.ts:418). A `}` in the value closes the generated CSS selector, and everything after becomes a new CSS rule on the pag
  • >= 11.0.0-alpha.1, < 11.15.0
  • < 10.9.6
GitHub (opens in a new tab)
GHSA-7rqq-prvp-x9jhModerateMermaid improperly sanitizes sequence diagram labels leading to XSS### Summary In the default configuration of mermaid 11.9.0, user supplied input for sequence diagram labels is passed to `innerHTML` during calculation of element size, causing XSS. ### Details Sequence diagram node labels with KaTeX delimiters are passed through `calculateMathMLDimensions`. This method passes the full label to `innerHTML` which allows allows malicious users to inject arbitrary HTML and cause XSS when mermaid-js is used in it's default configuration (with KaTeX support enabled). The vulnerability lies here: ```ts export const calculateMathMLDimensions = async (text: string
  • >= 11.0.0-alpha.1, < 11.10.0
  • >= 10.9.0-rc.1, < 10.9.4
GitHub (opens in a new tab)
  • GHSA-2v8p-3f2j-5mp7Moderate
    Mermaid XY Charts are vulnerable to an infinite loop DoS
    • >= 10.6.0, < 10.9.8
    • >= 11.0.0-alpha.1, < 11.16.1

    ### Impact Mermaid XY Charts are vulnerable to an infinite loop DoS attack in the `setXAxisRangeData()`, when configuring an X-Axis with invalid parameters. As each loop appends an element to an array, this would generally only cause an `RangeError: Invalid array length` to appear after a few seconds, but may cause the page/JavaScript process to crash due to memory exhaustion, depending on the environment. #### Proof-of-concept ```txt xychart x-axis 1 --> 1 line [1, 2] ``` ### Patches This has been patched in https://github.com/mermaid-js/mermaid/commit/630aa7e5dd417e1f56bff2a1ce8df2

    CVE: CVE-2026-71436

  • GHSA-3rrr-jr9j-h3q3Moderate
    Mermaid Architecture diagrams are vulnerable to prototype pollution
    • >= 11.5.0, < 11.16.1

    Rendering an untrusted `architecture-beta` diagram lets the diagram author write an arbitrary property with the value `horizontal` or `vertical` onto `Object.prototype`. A group id of `__proto__` is accepted as a valid parent. ### Impact Any code in the same realm that reads a property of that name from an arbitrary object, or enumerates an object with bare `for...in`, observes the injected value (which can only be the string `horizontal` or `vertical`. This may mean corrupted option/config defaults, bypassed truthiness checks, causing denial of service or logic corruption in the embedding

    CVE: CVE-2026-71437

  • GHSA-6x64-9x62-f2gxModerate
    Mermaid allows CSS injection applying to sibling elements of the diagram
    • >= 11.0.0-alpha.1, < 11.16.1
    • < 10.9.8

    ### Summary 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. ### Details Mermaid namespaces CSS through with a middleware intended to scope all rules to the

    CVE: CVE-2026-50159

  • GHSA-c4c3-pg64-4m4vLow
    Mermaid configuration APIs allow prototype pollution
    • >= 11.0.0-alpha.1, < 11.16.1
    • < 10.9.8

    ### Summary Mermaid's configuration setters (`mermaid.initialize`, `mermaidAPI.setConfig`, and `mermaidAPI.updateSiteConfig`) merge the caller-supplied configuration object into Mermaid's internal config using the `assignWithDepth` deep-merge helper that is vulnerable to prototype pollution. Because these APIs are intended to receive **trusted** configuration supplied by the application integrating Mermaid, Mermaid assesses the practical risk as **low**. The vulnerability is only reachable if an application forwards attacker-controlled data directly into one of these configuration entry poin

    CVE: CVE-2026-71438

  • GHSA-rhh3-jpg6-66xhModerate
    Mermaid radar diagrams are vulnerable to DoS
    • >= 11.6.0, < 11.16.1

    ### Impact Mermaid radar diagrams allow arbitrary large values for `ticks`, which can cause high CPU usage, freezing the webpage/JavaScript process for long periods of time, until the process is eventually killed due to OOM/running out of memory. #### Proof-of-concept ```txt radar-beta axis a, b curve c {1, 1} ticks 1000000000 ``` ### Patches _Has the problem been patched? What versions should users upgrade to?_ This problem has been patched by https://github.com/mermaid-js/mermaid/commit/59b22fad2b3bb04f87a476c84a8a2b24679e607e, which was released in [Mermaid v11.16.1](https://git

    CVE: CVE-2026-71439

  • GHSA-6m6c-36f7-fhxhModerate
    Mermaid Gantt Charts are vulnerable to an Infinite Loop DoS
    • >= 11.0.0-alpha.1, < 11.15.0
    • < 10.9.6

    ### Impact Mermaid v11.14.0 and earlier are vulnerable to a denial-of-service attack when rendering gantt charts, if they use the [`excludes` attribute](https://mermaid.js.org/syntax/gantt.html?#excludes) to exclude all dates. Example: ``` gantt excludes monday,tuesday,wednesday,thursday,friday,saturday,sunday DoS :2025-01-01, 1d ``` `mermaid.parse` is unaffected, unless you then call the `ganttDb.getTasks()` (which is called when rendering a diagram). ### Patches This has been patched in: - [v11.15.0](https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0) (see [faafb

    CVE: CVE-2026-41150

  • GHSA-87f9-hvmw-gh4pModerate
    Mermaid: Improper sanitization of configuration leads to CSS injection
    • >= 11.0.0-alpha.1, < 11.15.0
    • < 10.9.6

    ### Impact Mermaid's default configuration allows injecting CSS that applies outside of the Mermaid diagram via the `fontFamily`, `themeCSS`, and `altFontFamily` configuration options. Live demo: [mermaid.live](https://mermaid.live/edit#pako:eNpNjktLxDAUhf9KvFBR6JS-60QQfODKlUvJ5k6TtsEmKTHFGUP-u-mI6Nmdy3fOPR56wwVQSBIvtXSUeAaD0e4ZlZxPDChhcLxFfwiEauOuLq_9Afv30ZpVczpaITS5kGox1qF2gfSeBwYhJAnThAyz-ewntI68vG5-0z3Z7e7IA9OQwmglB-rsKlJQwircLPgNZeAmocTPAi4GXGfHgOkQYwvqN2PUbzJuGSegA84f0a0LRyeeJI4W_xChubCPcbQD2pwbgHo4Aq2aKmvbqq3zoiu7pizqFE6RybN9VFfFY1HWXRVS-Dr_zLObrt7_V_gGGXZlGg) Example code: ``` %%{i

    CVE: CVE-2026-41159

  • GHSA-ghcm-xqfw-q4vrModerate
    Mermaid: Improper sanitization of `classDef` in state diagrams leads to HTML injection
    • >= 11.0.0-alpha.1, < 11.15.0
    • < 10.9.6

    ### Impact Under the default configuration, Mermaid state diagram's `classDef` allow DOM injection that escapes the SVG, although `<script>` tags are removed, preventing XSS. #### Proof-of-concept ``` stateDiagram-v2 classDef xss fill:red</style></svg><style>*{x:x;y:y;overflow:visible!important;contain:none!important;transform:none!important;filter:none!important;clip-path:none!important}</style><div style="x:x;y:y;color:red;font:5em/1 monospace;display:grid;place-items:center;z-index:2147483647;width:100vw;height:100vh;position:fixed;top:0;left:0;background:black">HACKED</div><svg><style

    CVE: CVE-2026-41149

  • GHSA-xcj9-5m2h-648rModerate
    Mermaid: Improper sanitization of `classDefs` in diagrams leads to CSS injection
    • >= 11.0.0-alpha.1, < 11.15.0
    • < 10.9.6

    ### Details The state diagram and any other diagram type that routes user-controlled style strings through createCssStyles parser for Mermaid v11.14.0 and earlier captures `classDef` values with an unrestricted regex: ```jison // packages/mermaid/src/diagrams/state/parser/stateDiagram.jison:83 <CLASSDEFID>[^\n]* { this.popState(); return 'CLASSDEF_STYLEOPTS' } ``` The value passes unsanitized through `addStyleClass()` -> `createCssStyles()` -> `style.innerHTML` (mermaidAPI.ts:418). A `}` in the value closes the generated CSS selector, and everything after becomes a new CSS rule on the pag

    CVE: CVE-2026-41148

  • GHSA-7rqq-prvp-x9jhModerate
    Mermaid improperly sanitizes sequence diagram labels leading to XSS
    • >= 11.0.0-alpha.1, < 11.10.0
    • >= 10.9.0-rc.1, < 10.9.4

    ### Summary In the default configuration of mermaid 11.9.0, user supplied input for sequence diagram labels is passed to `innerHTML` during calculation of element size, causing XSS. ### Details Sequence diagram node labels with KaTeX delimiters are passed through `calculateMathMLDimensions`. This method passes the full label to `innerHTML` which allows allows malicious users to inject arbitrary HTML and cause XSS when mermaid-js is used in it's default configuration (with KaTeX support enabled). The vulnerability lies here: ```ts export const calculateMathMLDimensions = async (text: string

    CVE: CVE-2025-54881

Showing 1-10 of 16 vulnerabilities