GHSA-m4gq-x24j-jpmf: Mermaid Prototype Pollution Vulnerability Found Vulnerability
HIGHGHSA-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
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).
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.
npm install mermaid@10.9.3
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
GHSA-m4gq-x24j-jpmf Affected Mermaid Versions
1 component(s)| 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?
Which Mermaid versions are affected?
What version fixes GHSA-m4gq-x24j-jpmf?
Is mermaid affected?
What is the CVSS score of GHSA-m4gq-x24j-jpmf?
What CWE is associated with GHSA-m4gq-x24j-jpmf?
How can I check npm dependencies for GHSA-m4gq-x24j-jpmf?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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
}
}