{"id":"CVE-2025-54880","aliases":["EUVD-2025-25190","GHSA-8gwm-58g9-j8pw","UBUNTU-CVE-2025-54880"],"status":"published","title":"Mermaid does not properly sanitize architecture diagram iconText leading to XSS","description":"Mermaid is a JavaScript based diagramming and charting tool that uses Markdown-inspired text definitions and a renderer to create and modify complex diagrams. In the default configuration of mermaid 11.9.0 and earlier, user supplied input for architecture diagram icons is passed to the d3 html() method, creating a sink for cross site scripting. This vulnerability is fixed in 11.10.0.","severity":{"version":"4.0","score":5.1,"vector":"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","level":"medium","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-10","score":0.00435,"percentile":0.38058,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-79"],"published":"2025-08-19T16:58:41Z","modified":"2026-10-28T02:31:05Z","fixes":[{"ecosystem":"npm","package":"mermaid","fixed_in":["11.10.0"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"mermaid","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"11.1.0"},{"fixed":"11.10.0"}]}]},{"source":"osv","ecosystem":"npm","package":"mermaid","ranges":[{"type":"SEMVER","events":[{"introduced":"11.1.0"},{"fixed":"11.10.0"}]}]},{"source":"osv","ecosystem":"Ubuntu:22.04:LTS","package":"node-mermaid","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["8.7.0+ds+~cs27.17.17-3","8.13.3+ds+~cs26.13.21-1","8.13.3+ds+~cs26.13.21-2","8.13.8+~cs10.4.16-1"]},{"source":"osv","ecosystem":"Ubuntu:26.10","package":"node-mermaid","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["9.2.2+~2.0.0-1","9.2.2+~2.0.0-2"]}],"products":[{"vendor":"mermaid-js","product":"mermaid"},{"vendor":"mermaid_project","product":"mermaid"}],"references":[{"url":"https://github.com/mermaid-js/mermaid/security/advisories/GHSA-8gwm-58g9-j8pw","tags":["x_refsource_CONFIRM","exploit","Exploit","Patch","Vendor Advisory","advisory","web","report"]},{"url":"https://github.com/mermaid-js/mermaid/commit/2aa83302795183ea5c65caec3da1edd6cb4791fc","tags":["x_refsource_MISC","Patch","fix","web","report"]},{"url":"https://github.com/mermaid-js/mermaid/commit/734bde38777c9190a5a72e96421c83424442d4e4","tags":["x_refsource_MISC","Product","fix","web","report"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-54880","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-8gwm-58g9-j8pw"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/54xxx/CVE-2025-54880.json","tags":["advisory"]},{"url":"https://github.com/mermaid-js/mermaid","tags":["package"]},{"url":"https://ubuntu.com/security/CVE-2025-54880","tags":["report"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2025-54880","tags":["report"]}],"sources":{"cve":[{"id":"CVE-2025-54880","title":"Mermaid does not properly sanitize architecture diagram iconText leading to XSS","description":"Mermaid is a JavaScript based diagramming and charting tool that uses Markdown-inspired text definitions and a renderer to create and modify complex diagrams. In the default configuration of mermaid 11.9.0 and earlier, user supplied input for architecture diagram icons is passed to the d3 html() method, creating a sink for cross site scripting. This vulnerability is fixed in 11.10.0.","status":"published","published":"2025-08-19T16:58:41.12Z","modified":"2025-08-19T17:09:32.759Z","cvss":[{"version":"4.0","score":5.1,"vector":"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","level":"medium","assessor":"cna"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:32:27.603809Z"}],"euvd":[{"id":"EUVD-2025-25190","description":"Mermaid is a JavaScript based diagramming and charting tool that uses Markdown-inspired text definitions and a renderer to create and modify complex diagrams. In the default configuration of mermaid 11.9.0 and earlier, user supplied input for architecture diagram icons is passed to the d3 html() method, creating a sink for cross site scripting. This vulnerability is fixed in 11.10.0.","status":"published","published":"2025-08-19T16:58:41Z","modified":"2025-08-19T17:09:32Z","cvss":[{"version":"4.0","score":5.1,"vector":"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","level":"medium"}],"updated_at":"2026-11-02T20:31:55.90596Z"}],"ghsa":[{"id":"GHSA-8gwm-58g9-j8pw","title":"Mermaid does not properly sanitize architecture diagram iconText leading to XSS","description":"### 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\u003cnumber\u003e {\n  for (const service of services) {\n    /** ... **/\n    } else if (service.iconText) {\n      bkgElem.html(\n        `\u003cg\u003e${await getIconSVG('blank', { height: iconSize, width: iconSize, fallbackPrefix: architectureIcons.prefix })}\u003c/g\u003e`\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); // \u003c- 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 \"\u003cimg src=x onerror=\\\"document.write(`xss on ${document.domain}`)\\\"\u003e\" [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()`.","status":"published","published":"2025-08-19T20:16:45Z","modified":"2025-08-20T19:13:28Z","cvss":[{"version":"4.0","score":5.1,"vector":"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","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:38:54.795089Z"}],"nvd":[{"id":"CVE-2025-54880","description":"Mermaid is a JavaScript based diagramming and charting tool that uses Markdown-inspired text definitions and a renderer to create and modify complex diagrams. In the default configuration of mermaid 11.9.0 and earlier, user supplied input for architecture diagram icons is passed to the d3 html() method, creating a sink for cross site scripting. This vulnerability is fixed in 11.10.0.","status":"published","published":"2025-08-19T17:15:41.06Z","modified":"2026-06-17T09:40:51.44Z","cvss":[{"version":"4.0","score":5.1,"vector":"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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","level":"medium","assessor":"secondary"},{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"primary"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:11:24.730342Z"}],"osv":[{"id":"CVE-2025-54880","title":"Mermaid does not properly sanitize architecture diagram iconText leading to XSS","description":"Mermaid is a JavaScript based diagramming and charting tool that uses Markdown-inspired text definitions and a renderer to create and modify complex diagrams. In the default configuration of mermaid 11.9.0 and earlier, user supplied input for architecture diagram icons is passed to the d3 html() method, creating a sink for cross site scripting. This vulnerability is fixed in 11.10.0.","status":"published","published":"2025-08-19T16:58:41.12Z","modified":"2026-10-28T02:31:05.92808723Z","cvss":[{"version":"4.0","score":5.1,"vector":"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","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T15:44:50.863921Z"},{"id":"GHSA-8gwm-58g9-j8pw","title":"Mermaid does not properly sanitize architecture diagram iconText leading to XSS","description":"### 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\u003cnumber\u003e {\n  for (const service of services) {\n    /** ... **/\n    } else if (service.iconText) {\n      bkgElem.html(\n        `\u003cg\u003e${await getIconSVG('blank', { height: iconSize, width: iconSize, fallbackPrefix: architectureIcons.prefix })}\u003c/g\u003e`\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); // \u003c- 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 \"\u003cimg src=x onerror=\\\"document.write(`xss on ${document.domain}`)\\\"\u003e\" [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()`.","status":"published","published":"2025-08-19T20:16:45Z","modified":"2026-08-07T08:12:20.025979274Z","cvss":[{"version":"4.0","score":5.1,"vector":"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","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T15:46:42.437513Z"},{"id":"UBUNTU-CVE-2025-54880","description":"Mermaid is a JavaScript based diagramming and charting tool that uses Markdown-inspired text definitions and a renderer to create and modify complex diagrams. In the default configuration of mermaid 11.9.0 and earlier, user supplied input for architecture diagram icons is passed to the d3 html() method, creating a sink for cross site scripting. This vulnerability is fixed in 11.10.0.","status":"published","published":"2025-08-19T17:15:00Z","modified":"2026-10-17T12:57:08.391924084Z","cvss":[{"version":"4.0","score":5.1,"vector":"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","level":"medium"},{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"updated_at":"2026-11-02T16:55:50.817402Z"}]}}
