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

- Severity: High 7.2 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.94%, higher than 61% of CVEs (2026-12-01)
- Published: 2021-12-30T13:40:11.000Z
- Modified: 2026-07-08T06:28:14.087Z
- Also known as: GHSA-p3rp-vmj9-gv6v
- Weaknesses: CWE-20, CWE-79
- Assigned by: GitHub_M

## 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.

(As written by CVE List.)

## Affected

- mermaid-js mermaid: < 8.13.8
- mermaid (npm): before 8.13.8
- mermaid_project mermaid: before 8.13.8

## Every score

- GitHub_M: CVSS:3.1 7.2 High `CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H`
- GitHub: CVSS:3.1 7.2 High `CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:3.1 5.4 Medium `CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N`
- NVD: CVSS:2.0 3.5 Low `AV:N/AC:M/Au:S/C:N/I:P/A:N`

## References

- <https://github.com/mermaid-js/mermaid/security/advisories/GHSA-p3rp-vmj9-gv6v> (third-party-advisory, web)
- <https://github.com/mermaid-js/mermaid/commit/066b7a0d0bda274d94a2f2d21e4323dab5776d83> (patch, third-party-advisory, web)
- <https://github.com/mermaid-js/mermaid/releases/tag/8.13.8> (release-notes, third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2021-43861> (advisory)
- <https://github.com/mermaid-js/mermaid> (package)

## Sources

- CVE List: [CVE-2021-43861](https://www.cve.org/CVERecord?id=CVE-2021-43861), CVE Terms of Use, modified 2024-08-04
- GitHub Advisory Database: [GHSA-p3rp-vmj9-gv6v](https://github.com/advisories/GHSA-p3rp-vmj9-gv6v), CC-BY-4.0, modified 2026-07-08
- NVD: [CVE-2021-43861](https://nvd.nist.gov/vuln/detail/CVE-2021-43861), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2021-43861 · Whole record: https://cve.day/CVE-2021-43861.json · Rebuilt by cve.day 2026-11-25T22:24:36.412Z
