Skip to content

GHSA-c4c3-pg64-4m4v CVE-2026-71438

Mermaid configuration APIs allow prototype pollution

Low npm
Severity
2.4 / 10
Low · CVSS 4.0
Exploit chance (EPSS)
0.35%
Chance of exploitation in the next 30 days. Higher than 29.02% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-1321 Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Fix
11.16.1
Upgrade mermaid to this version or later

Description

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 points, which is outside their documented usage.

User-controlled configuration (e.g. configuration in diagram code using %%{init: {}}%% or YAML frontmatter) are already protected from prototype pollution.

Patches

This has been patched in https://github.com/mermaid-js/mermaid/commit/2cd6dcf735533b323507e3e889ffdea870540b43 and released in Mermaid v11.16.1.

A backport has been made for the v10 branch in c34b07a0815842327e70794d69b0c8c5a1e2a956 and was released in Mermaid v10.9.8

Impact

Mermaid believes it's unlikely that anybody is impacted, as these functions are configuration entry points expected to receive trusted, developer-controlled values as they can modify other security-relevant configuration.

Workarounds

Don't pass user-controlled data to the mermaid.initialize, mermaidAPI.setConfig, and mermaidAPI.updateSiteConfig functions. Instead, users can use %%{init: {}}%% or YAML frontmatter in diagrams.

Reporters

Affected versions

npm

PackageVulnerableFixed in
mermaid
>= 11.0.0-alpha.1, < 11.16.1
11.16.1
mermaid
< 10.9.8
10.9.8
mermaid
>= 11.0.0-alpha.1, < 11.16.1
11.16.1
mermaid
< 10.9.8
10.9.8

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

mermaid npm → 11.16.1

npm
npm install mermaid@11.16.1
yarn
yarn add mermaid@11.16.1
pnpm
pnpm add mermaid@11.16.1

Severity breakdown

CVSS 4.0 2.4

CVSS:4.0/AV:L/AC:L/AT:P/PR:H/UI:A/VC:N/VI:L/VA:L/SC:H/SI:H/SA:H

Attack vector
Local
Attack complexity
Low
Attack requirements
Present
Privileges required
High
User interaction
Active
Confidentiality (vulnerable system)
None
Integrity (vulnerable system)
Low
Availability (vulnerable system)
Low
Confidentiality (subsequent systems)
High
Integrity (subsequent systems)
High
Availability (subsequent systems)
High

Weakness

CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')

The product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.

How to prevent it
  • Implementation: By freezing the object prototype first (for example, Object.freeze(Object.prototype)), modification of the prototype becomes impossible.
  • Architecture and Design: By blocking modifications of attributes that resolve to object prototype, such as proto or prototype, this weakness can be mitigated.
  • Implementation: When handling untrusted objects, validating using a schema can be used.
  • Implementation: By using an object without prototypes (via Object.create(null) ), adding object prototype attributes by accessing the prototype via the special attributes becomes impossible, mitigating this weakness.
  • Implementation: Map can be used instead of objects in most cases. If Map methods are used instead of object attributes, it is not possible to access the object prototype or modify it.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-rhh3-jpg6-66xh
Mermaid radar diagrams are vulnerable to DoS
Medium Also affects mermaid
GHSA-6x64-9x62-f2gx
Mermaid allows CSS injection applying to sibling elements of the diagram
Medium Also affects mermaid
GHSA-3rrr-jr9j-h3q3
Mermaid Architecture diagrams are vulnerable to prototype pollution
Medium Also affects mermaid
GHSA-2v8p-3f2j-5mp7
Mermaid XY Charts are vulnerable to an infinite loop DoS
Medium Also affects mermaid
GHSA-87f9-hvmw-gh4p
Mermaid: Improper sanitization of configuration leads to CSS injection
Medium Also affects mermaid
GHSA-6m6c-36f7-fhxh
Mermaid Gantt Charts are vulnerable to an Infinite Loop DoS
Medium Also affects mermaid
GHSA-ghcm-xqfw-q4vr
Mermaid: Improper sanitization of `classDef` in state diagrams leads to HTML injection
Medium Also affects mermaid
GHSA-xcj9-5m2h-648r
Mermaid: Improper sanitization of `classDefs` in diagrams leads to CSS injection
Medium Also affects mermaid

Credits: 7thParkk, Str1ckl4nd, Zyy0530, aloisklink, mauriceng98

Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor