CVE-2026-40322: SiYuan: Mermaid `javascript:` Link Injection Leads to Stored XSS and Electron RCE
Vulnerability summary
CVE-2026-40322 is a critical (CVSS 9.1) vulnerability in b3log siyuan. EPSS estimates a 0.32% chance of exploitation in the next 30 days, higher than 26.7% of scored vulnerabilities.
Severe, CVSS 9.1 (CVE.org); no exploitation reported by the 5 checked sources; EPSS 0% (FIRST, 04-12-2026)
Source freshness unavailable
How is this decided?Timeline
- 16-04-2026PublishedVulnerability first disclosed.
- 17-04-2026Last modifiedVulnerability information updated.
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.
CVSS metrics
2 scores · 2 sources · 1 version- NVDNIST9.0CriticalCVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:HDiffers
EPSS trend
Probability
0.32%
Chance of exploitation in the next 30 days
Percentile
27%
Versus all other CVEs
30-day change
Increase +0.01 pp
From 0.31% on 04-11-2026
Known exploited
Compare KEV catalogsNot in the CISA KEV catalog.
Not in the ENISA CNW catalog.
Not in the CIRCL catalog.
Public exploits
0 foundNo public exploits indexed.
Weaknesses
CWE · root cause- CWE-79Improper Neutralization of Input During Web Page GenerationThe 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-94Improper Control of Generation of CodeThe product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
Affected systems
Known conditions: network-reachable, low-privilege account, user interaction (CVSS vector). Other conditions: not stated in public data.
B3log1 product
- siyuan< 3.6.4
Siyuan-note1 product
- siyuan< 3.6.4
2 vendors · 2 products
References
2 links- github.com/siyuan-note/siyuan/security/advisories/GHSA-x63q-3rcj-hhp5X Refsource CONFIRMThird Party Advisory