{"url":"http://public2.vulnerablecode.io/api/vulnerabilities/29027?format=json","vulnerability_id":"VCID-dmks-9n4b-vkh6","summary":"Mermaid does not properly sanitize architecture diagram iconText leading to XSS\n### Summary\nIn the default configuration of mermaid 11.9.0, user supplied input for architecture diagram icons is passed to the d3 `html()` method, creating a sink for cross site scripting.\n\n### Details\nArchitecture diagram service `iconText` values are passed to the d3 `html()` method, allowing malicious users to inject arbitrary HTML and cause XSS when mermaid-js is used in it's default configuration. \n\nThe vulnerability lies here:\n\n```ts\nexport const drawServices = async function (\n  db: ArchitectureDB,\n  elem: D3Element,\n  services: ArchitectureService[]\n): Promise<number> {\n  for (const service of services) {\n    /** ... **/\n    } else if (service.iconText) {\n      bkgElem.html(\n        `<g>${await getIconSVG('blank', { height: iconSize, width: iconSize, fallbackPrefix: architectureIcons.prefix })}</g>`\n      );\n      const textElemContainer = bkgElem.append('g');\n      const fo = textElemContainer\n        .append('foreignObject')\n        .attr('width', iconSize)\n        .attr('height', iconSize);\n      const divElem = fo\n        .append('div')\n        .attr('class', 'node-icon-text')\n        .attr('style', `height: ${iconSize}px;`)\n        .append('div')\n        .html(service.iconText); // <- iconText passed into innerHTML\n       /** ... **/\n};\n};\n```\n\nThis issue was introduced with 734bde38777c9190a5a72e96421c83424442d4e4, around 15 months ago, which was released in [v11.1.0](https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.1.0).\n\n### PoC\nRender the following diagram and observe the modified DOM.\n\n```\narchitecture-beta\n    group api(cloud)[API]\n    service db \"<img src=x onerror=\\\"document.write(`xss on ${document.domain}`)\\\">\" [Database] in api\n```\n\nHere is a PoC on mermaid.live: https://mermaid.live/edit#pako:eNo9T8FOwzAM_ZXI4rBJpWrpRtuIISF24caZZdKyxOsiLUnlJjCo-u9kQ8wX-_n5-dkjKK8ROEhSRxNQhUh4v8cghWMpOvKxZ7I3M3XyUc83L-9v2z9qQPo0CpneMwFPxnZsILU6M--QyNNKCAHaq2jRhfyL0vLZ7jwMiWd3443Q3krjpt38Mv4sgG3WMsi9HHDLjLs4CwcZdGQ08EARM7BISZMgjJdLBIQjWhTAU6nxIOMpCBBuSrJeug_v7b8yPdMdgR_kaUgo9loGXBvZkbS3LqHTSK8-ugC8LMrrEuAjnIEvlnlVL9q6rZu6Lh-rRQbfwKuyyZuybcvqIaWiqKcMfq6uRd7Uy-kXhYFzcA\n\n### Impact\nXSS on all sites that use mermaid and render user supplied diagrams without further sanitization.\n\n### Remediation\nSanitize the value of `iconText` before passing it to `html()`.","aliases":[{"alias":"CVE-2025-54880"},{"alias":"GHSA-8gwm-58g9-j8pw"}],"fixed_packages":[{"url":"http://public2.vulnerablecode.io/api/packages/932402?format=json","purl":"pkg:deb/debian/node-mermaid@0?distro=bullseye","is_vulnerable":false,"affected_by_vulnerabilities":[],"resource_url":"http://public2.vulnerablecode.io/packages/pkg:deb/debian/node-mermaid@0%3Fdistro=bullseye"},{"url":"http://public2.vulnerablecode.io/api/packages/932399?format=json","purl":"pkg:deb/debian/node-mermaid@8.7.0%2Bds%2B~cs27.17.17-3%2Bdeb11u2?distro=bullseye","is_vulnerable":false,"affected_by_vulnerabilities":[],"resource_url":"http://public2.vulnerablecode.io/packages/pkg:deb/debian/node-mermaid@8.7.0%252Bds%252B~cs27.17.17-3%252Bdeb11u2%3Fdistro=bullseye"},{"url":"http://public2.vulnerablecode.io/api/packages/69629?format=json","purl":"pkg:npm/mermaid@11.10.0","is_vulnerable":false,"affected_by_vulnerabilities":[],"resource_url":"http://public2.vulnerablecode.io/packages/pkg:npm/mermaid@11.10.0"}],"affected_packages":[{"url":"http://public2.vulnerablecode.io/api/packages/570771?format=json","purl":"pkg:npm/mermaid@11.1.0","is_vulnerable":true,"affected_by_vulnerabilities":[{"vulnerability":"VCID-dmks-9n4b-vkh6"},{"vulnerability":"VCID-q79q-8yzx-p3f6"}],"resource_url":"http://public2.vulnerablecode.io/packages/pkg:npm/mermaid@11.1.0"},{"url":"http://public2.vulnerablecode.io/api/packages/791358?format=json","purl":"pkg:npm/mermaid@11.1.1","is_vulnerable":true,"affected_by_vulnerabilities":[{"vulnerability":"VCID-dmks-9n4b-vkh6"},{"vulnerability":"VCID-q79q-8yzx-p3f6"}],"resource_url":"http://public2.vulnerablecode.io/packages/pkg:npm/mermaid@11.1.1"},{"url":"http://public2.vulnerablecode.io/api/packages/791359?format=json","purl":"pkg:npm/mermaid@11.2.0","is_vulnerable":true,"affected_by_vulnerabilities":[{"vulnerability":"VCID-dmks-9n4b-vkh6"},{"vulnerability":"VCID-q79q-8yzx-p3f6"}],"resource_url":"http://public2.vulnerablecode.io/packages/pkg:npm/mermaid@11.2.0"},{"url":"http://public2.vulnerablecode.io/api/packages/791360?format=json","purl":"pkg:npm/mermaid@11.2.1","is_vulnerable":true,"affected_by_vulnerabilities":[{"vulnerability":"VCID-dmks-9n4b-vkh6"},{"vulnerability":"VCID-q79q-8yzx-p3f6"}],"resource_url":"http://public2.vulnerablecode.io/packages/pkg:npm/mermaid@11.2.1"},{"url":"http://public2.vulnerablecode.io/api/packages/791361?format=json","purl":"pkg:npm/mermaid@11.3.0","is_vulnerable":true,"affected_by_vulnerabilities":[{"vulnerability":"VCID-dmks-9n4b-vkh6"},{"vulnerability":"VCID-q79q-8yzx-p3f6"}],"resource_url":"http://public2.vulnerablecode.io/packages/pkg:npm/mermaid@11.3.0"},{"url":"http://public2.vulnerablecode.io/api/packages/791362?format=json","purl":"pkg:npm/mermaid@11.4.0","is_vulnerable":true,"affected_by_vulnerabilities":[{"vulnerability":"VCID-dmks-9n4b-vkh6"},{"vulnerability":"VCID-q79q-8yzx-p3f6"}],"resource_url":"http://public2.vulnerablecode.io/packages/pkg:npm/mermaid@11.4.0"},{"url":"http://public2.vulnerablecode.io/api/packages/791363?format=json","purl":"pkg:npm/mermaid@11.4.1","is_vulnerable":true,"affected_by_vulnerabilities":[{"vulnerability":"VCID-dmks-9n4b-vkh6"},{"vulnerability":"VCID-q79q-8yzx-p3f6"}],"resource_url":"http://public2.vulnerablecode.io/packages/pkg:npm/mermaid@11.4.1"},{"url":"http://public2.vulnerablecode.io/api/packages/791364?format=json","purl":"pkg:npm/mermaid@11.5.0","is_vulnerable":true,"affected_by_vulnerabilities":[{"vulnerability":"VCID-dmks-9n4b-vkh6"},{"vulnerability":"VCID-q79q-8yzx-p3f6"}],"resource_url":"http://public2.vulnerablecode.io/packages/pkg:npm/mermaid@11.5.0"},{"url":"http://public2.vulnerablecode.io/api/packages/791365?format=json","purl":"pkg:npm/mermaid@11.6.0","is_vulnerable":true,"affected_by_vulnerabilities":[{"vulnerability":"VCID-dmks-9n4b-vkh6"},{"vulnerability":"VCID-q79q-8yzx-p3f6"}],"resource_url":"http://public2.vulnerablecode.io/packages/pkg:npm/mermaid@11.6.0"},{"url":"http://public2.vulnerablecode.io/api/packages/791366?format=json","purl":"pkg:npm/mermaid@11.7.0","is_vulnerable":true,"affected_by_vulnerabilities":[{"vulnerability":"VCID-dmks-9n4b-vkh6"},{"vulnerability":"VCID-q79q-8yzx-p3f6"}],"resource_url":"http://public2.vulnerablecode.io/packages/pkg:npm/mermaid@11.7.0"},{"url":"http://public2.vulnerablecode.io/api/packages/791367?format=json","purl":"pkg:npm/mermaid@11.8.0","is_vulnerable":true,"affected_by_vulnerabilities":[{"vulnerability":"VCID-dmks-9n4b-vkh6"},{"vulnerability":"VCID-q79q-8yzx-p3f6"}],"resource_url":"http://public2.vulnerablecode.io/packages/pkg:npm/mermaid@11.8.0"},{"url":"http://public2.vulnerablecode.io/api/packages/791368?format=json","purl":"pkg:npm/mermaid@11.8.1","is_vulnerable":true,"affected_by_vulnerabilities":[{"vulnerability":"VCID-dmks-9n4b-vkh6"},{"vulnerability":"VCID-q79q-8yzx-p3f6"}],"resource_url":"http://public2.vulnerablecode.io/packages/pkg:npm/mermaid@11.8.1"},{"url":"http://public2.vulnerablecode.io/api/packages/791369?format=json","purl":"pkg:npm/mermaid@11.9.0","is_vulnerable":true,"affected_by_vulnerabilities":[{"vulnerability":"VCID-dmks-9n4b-vkh6"},{"vulnerability":"VCID-q79q-8yzx-p3f6"}],"resource_url":"http://public2.vulnerablecode.io/packages/pkg:npm/mermaid@11.9.0"}],"references":[{"reference_url":"https://api.first.org/data/v1/epss?cve=CVE-2025-54880","reference_id":"","reference_type":"","scores":[{"value":"0.00013","scoring_system":"epss","scoring_elements":"0.02318","published_at":"2026-05-05T12:55:00Z"},{"value":"0.00013","scoring_system":"epss","scoring_elements":"0.02352","published_at":"2026-05-12T12:55:00Z"},{"value":"0.00013","scoring_system":"epss","scoring_elements":"0.02356","published_at":"2026-05-11T12:55:00Z"},{"value":"0.00013","scoring_system":"epss","scoring_elements":"0.0236","published_at":"2026-05-09T12:55:00Z"},{"value":"0.00013","scoring_system":"epss","scoring_elements":"0.02322","published_at":"2026-05-07T12:55:00Z"},{"value":"8e-05","scoring_system":"epss","scoring_elements":"0.00761","published_at":"2026-04-09T12:55:00Z"},{"value":"8e-05","scoring_system":"epss","scoring_elements":"0.00753","published_at":"2026-04-16T12:55:00Z"},{"value":"8e-05","scoring_system":"epss","scoring_elements":"0.00751","published_at":"2026-04-12T12:55:00Z"},{"value":"8e-05","scoring_system":"epss","scoring_elements":"0.0077","published_at":"2026-04-07T12:55:00Z"},{"value":"8e-05","scoring_system":"epss","scoring_elements":"0.00757","published_at":"2026-04-18T12:55:00Z"},{"value":"8e-05","scoring_system":"epss","scoring_elements":"0.00769","published_at":"2026-04-08T12:55:00Z"},{"value":"8e-05","scoring_system":"epss","scoring_elements":"0.00771","published_at":"2026-04-02T12:55:00Z"},{"value":"8e-05","scoring_system":"epss","scoring_elements":"0.00802","published_at":"2026-04-21T12:55:00Z"},{"value":"9e-05","scoring_system":"epss","scoring_elements":"0.00917","published_at":"2026-04-29T12:55:00Z"},{"value":"9e-05","scoring_system":"epss","scoring_elements":"0.00923","published_at":"2026-04-26T12:55:00Z"},{"value":"9e-05","scoring_system":"epss","scoring_elements":"0.00918","published_at":"2026-04-24T12:55:00Z"}],"url":"https://api.first.org/data/v1/epss?cve=CVE-2025-54880"},{"reference_url":"https://github.com/mermaid-js/mermaid","reference_id":"","reference_type":"","scores":[{"value":"5.1","scoring_system":"cvssv4","scoring_elements":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"},{"value":"MODERATE","scoring_system":"generic_textual","scoring_elements":""}],"url":"https://github.com/mermaid-js/mermaid"},{"reference_url":"https://github.com/mermaid-js/mermaid/commit/2aa83302795183ea5c65caec3da1edd6cb4791fc","reference_id":"","reference_type":"","scores":[{"value":"5.1","scoring_system":"cvssv4","scoring_elements":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"},{"value":"MODERATE","scoring_system":"generic_textual","scoring_elements":""},{"value":"Track","scoring_system":"ssvc","scoring_elements":"SSVCv2/E:P/A:N/T:P/P:M/B:A/M:M/D:T/2025-08-19T17:09:29Z/"}],"url":"https://github.com/mermaid-js/mermaid/commit/2aa83302795183ea5c65caec3da1edd6cb4791fc"},{"reference_url":"https://github.com/mermaid-js/mermaid/commit/734bde38777c9190a5a72e96421c83424442d4e4","reference_id":"","reference_type":"","scores":[{"value":"5.1","scoring_system":"cvssv4","scoring_elements":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"},{"value":"MODERATE","scoring_system":"generic_textual","scoring_elements":""},{"value":"Track","scoring_system":"ssvc","scoring_elements":"SSVCv2/E:P/A:N/T:P/P:M/B:A/M:M/D:T/2025-08-19T17:09:29Z/"}],"url":"https://github.com/mermaid-js/mermaid/commit/734bde38777c9190a5a72e96421c83424442d4e4"},{"reference_url":"https://github.com/mermaid-js/mermaid/security/advisories/GHSA-8gwm-58g9-j8pw","reference_id":"","reference_type":"","scores":[{"value":"MODERATE","scoring_system":"cvssv3.1_qr","scoring_elements":""},{"value":"5.1","scoring_system":"cvssv4","scoring_elements":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"},{"value":"MODERATE","scoring_system":"generic_textual","scoring_elements":""},{"value":"Track","scoring_system":"ssvc","scoring_elements":"SSVCv2/E:P/A:N/T:P/P:M/B:A/M:M/D:T/2025-08-19T17:09:29Z/"}],"url":"https://github.com/mermaid-js/mermaid/security/advisories/GHSA-8gwm-58g9-j8pw"},{"reference_url":"https://nvd.nist.gov/vuln/detail/CVE-2025-54880","reference_id":"","reference_type":"","scores":[{"value":"5.1","scoring_system":"cvssv4","scoring_elements":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"},{"value":"MODERATE","scoring_system":"generic_textual","scoring_elements":""}],"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-54880"},{"reference_url":"https://github.com/advisories/GHSA-8gwm-58g9-j8pw","reference_id":"GHSA-8gwm-58g9-j8pw","reference_type":"","scores":[{"value":"MODERATE","scoring_system":"cvssv3.1_qr","scoring_elements":""}],"url":"https://github.com/advisories/GHSA-8gwm-58g9-j8pw"}],"weaknesses":[{"cwe_id":79,"name":"Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')","description":"The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users."},{"cwe_id":937,"name":"OWASP Top Ten 2013 Category A9 - Using Components with Known Vulnerabilities","description":"Weaknesses in this category are related to the A9 category in the OWASP Top Ten 2013."},{"cwe_id":1035,"name":"OWASP Top Ten 2017 Category A9 - Using Components with Known Vulnerabilities","description":"Weaknesses in this category are related to the A9 category in the OWASP Top Ten 2017."}],"exploits":[],"severity_range_score":"4.0 - 6.9","exploitability":"0.5","weighted_severity":"6.2","risk_score":3.1,"resource_url":"http://public2.vulnerablecode.io/vulnerabilities/VCID-dmks-9n4b-vkh6"}