# CVE-2026-40322: SiYuan: Mermaid `javascript:` Link Injection Leads to Stored XSS and Electron RCE

- Severity: Critical 9.1 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/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.31%, higher than 25% of CVEs (2026-12-02)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-04-16T23:00:07.719Z
- Modified: 2026-06-17T10:45:01.690Z
- Weaknesses: CWE-79, CWE-94
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total
- Assigned by: GitHub_M

## Description

SiYuan is an open-source personal knowledge management system. In versions 3.6.3 and below, Mermaid diagrams are rendered with securityLevel set to "loose", and the resulting SVG is injected into the DOM via innerHTML. This allows attacker-controlled javascript: URLs in Mermaid code blocks to survive into the rendered output. On desktop builds using Electron, windows are created with nodeIntegration enabled and contextIsolation disabled, escalating the stored XSS to arbitrary code execution when a victim opens a note containing a malicious Mermaid block and clicks the rendered diagram node. This issue has been fixed in version 3.6.4.

(As written by CVE List.)

## Affected

- siyuan-note siyuan: < 3.6.4
- b3log siyuan: before 3.6.4

## References

- <https://github.com/siyuan-note/siyuan/security/advisories/GHSA-x63q-3rcj-hhp5> (exploit, third-party-advisory)
- <https://github.com/siyuan-note/siyuan/releases/tag/v3.6.4> (release-notes)

## Sources

- CVE List: [CVE-2026-40322](https://www.cve.org/CVERecord?id=CVE-2026-40322), CVE Terms of Use, modified 2026-04-17
- NVD: [CVE-2026-40322](https://nvd.nist.gov/vuln/detail/CVE-2026-40322), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2026-40322 · Whole record: https://cve.day/CVE-2026-40322.json · Rebuilt by cve.day 2026-11-25T22:59:18.924Z
