GHSA-m4gq-x24j-jpmf: Mermaid Prototype Pollution Vulnerability Found Vulnerability

HIGH
CVSS 7.0
CWE-1321 CWE-1395
Published
Advisory Summary

GHSA-m4gq-x24j-jpmf is a HIGH (CVSS 7.0) prototype pollution vulnerability found vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Mermaid libraries in the npm ecosystem. The issue involves prototype pollution vulnerability found in mermaid's bundled version of dompurify. Remediation is available by upgrading affected packages to version 10.9.3.

GHSA-m4gq-x24j-jpmf at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-m4gq-x24j-jpmf
Severity HIGH
CVSS v3.1 Base Score 7.0
CWE Classification CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Affected Product Mermaid
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:L).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity High (I:H)
Availability Low (A:L)

How to Fix GHSA-m4gq-x24j-jpmf

To remediate this vulnerability, upgrade all affected Mermaid dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mermaid fixed: 10.9.3
npm install mermaid@10.9.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls mermaid

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-m4gq-x24j-jpmf, inspect your project dependencies using npm:

npm ls mermaid

Analyze the terminal output to locate any version of Mermaid in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 10.9.3), your application is affected.

Note: The npm ls mermaid command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where 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. In Mermaid, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

The following bundled files within the Mermaid NPM package contain a bundled version of DOMPurify that is vulnerable to https://github.com/cure53/DOMPurify/security/advisories/GHSA-mmhx-hmjr-r674, potentially resulting in an XSS attack. This affects the built: - `dist/mermaid.min.js` - `dist/mermaid.js` - `dist/mermaid.esm.mjs` - `dist/mermaid.esm.min.mjs` This will also affect users that use the above files via a CDN link, e.g. `https://cdn.jsdelivr.net/npm/mermaid@10.9.2/dist/mermaid.min.js` **Users that use the default NPM export of `mermaid`, e.g. `import mermaid from 'mermaid'`, or the `dist/mermaid.core.mjs` file, do not use this bundled version of DOMPurify, and can easily update using their package manager with something like `npm audit fix`.** ### Patches - `develop` branch: 6c785c93166c151d27d328ddf68a13d9d65adc00 - backport to v10: 92a07ffe40aab2769dd1c3431b4eb5beac282b34

GHSA-m4gq-x24j-jpmf Affected Mermaid Versions

1 component(s)
Fixed Versions:
10.9.3
Product / Package Ecosystem Affected Versions Fixed Version
mermaid
npm
< 10.9.3
10.9.3

References

Frequently Asked Questions

What is GHSA-m4gq-x24j-jpmf?
GHSA-m4gq-x24j-jpmf is a security vulnerability in Mermaid involving Prototype pollution vulnerability found in Mermaid's bundled version of DOMPurify under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').
Which Mermaid versions are affected?
Affected versions include releases prior to 10.9.3 across affected packages: mermaid.
What version fixes GHSA-m4gq-x24j-jpmf?
Upgrading to 10.9.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mermaid affected?
Yes, mermaid is affected in releases prior to 10.9.3. Upgrade your dependency to 10.9.3 or later.
What is the CVSS score of GHSA-m4gq-x24j-jpmf?
GHSA-m4gq-x24j-jpmf has a CVSS v3.1 base score of 7.0 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:L.
What CWE is associated with GHSA-m4gq-x24j-jpmf?
GHSA-m4gq-x24j-jpmf is classified under 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 can I check npm dependencies for GHSA-m4gq-x24j-jpmf?
Run the dependency tree command: 'npm ls mermaid'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-m4gq-x24j-jpmf",
  "modified" : "2024-10-23T14:24:24Z",
  "published" : "2024-10-22T18:17:02Z",
  "aliases" : [ ],
  "summary" : "Prototype pollution vulnerability found in Mermaid's bundled version of DOMPurify",
  "details" : "The following bundled files within the Mermaid NPM package contain a bundled version of DOMPurify that is vulnerable to https://github.com/cure53/DOMPurify/security/advisories/GHSA-mmhx-hmjr-r674, potentially resulting in an XSS attack.\n\nThis affects the built:\n\n- `dist/mermaid.min.js`\n- `dist/mermaid.js`\n- `dist/mermaid.esm.mjs`\n- `dist/mermaid.esm.min.mjs`\n\nThis will also affect users that use the above files via a CDN link, e.g. `https://cdn.jsdelivr.net/npm/mermaid@10.9.2/dist/mermaid.min.js`\n\n**Users that use the default NPM export of `mermaid`, e.g. `import mermaid from 'mermaid'`, or the `dist/mermaid.core.mjs` file, do not use this bundled version of DOMPurify, and can easily update using their package manager with something like `npm audit fix`.**\n\n### Patches\n\n- `develop` branch: 6c785c93166c151d27d328ddf68a13d9d65adc00\n- backport to v10: 92a07ffe40aab2769dd1c3431b4eb5beac282b34",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "mermaid"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "10.9.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 10.9.2"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/cure53/DOMPurify/security/advisories/GHSA-mmhx-hmjr-r674"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mermaid-js/mermaid/security/advisories/GHSA-m4gq-x24j-jpmf"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mermaid-js/mermaid/commit/6c785c93166c151d27d328ddf68a13d9d65adc00"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mermaid-js/mermaid/commit/92a07ffe40aab2769dd1c3431b4eb5beac282b34"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mermaid-js/mermaid"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1321", "CWE-1395" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-10-22T18:17:02Z",
    "nvd_published_at" : null
  }
}