CVE-2026-40322: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in siyuan-note siyuan
CVE-2026-40322 is a critical cross-site scripting (XSS) vulnerability in SiYuan versions 3. 6. 3 and below. The issue arises because Mermaid diagrams are rendered with securityLevel set to "loose" and injected into the DOM via innerHTML, allowing attacker-controlled javascript: URLs to persist in rendered output. On desktop Electron builds with nodeIntegration enabled and contextIsolation disabled, this XSS can escalate to arbitrary code execution when a user interacts with a malicious Mermaid diagram. This vulnerability is fixed in version 3. 6. 4.
AI Analysis
Technical Summary
SiYuan, an open-source personal knowledge management system, versions 3.6.3 and earlier render Mermaid diagrams insecurely by setting securityLevel to "loose" and injecting SVG content via innerHTML. This allows attacker-supplied javascript: URLs in Mermaid code blocks to survive into the rendered SVG output, resulting in stored cross-site scripting. On desktop Electron builds with nodeIntegration enabled and contextIsolation disabled, this stored XSS can escalate to arbitrary code execution when a victim opens a note containing a malicious Mermaid block and clicks the rendered diagram node. The vulnerability is tracked as CVE-2026-40322 with a CVSS 3.1 score of 9.1 (critical) and has been fixed in version 3.6.4.
Potential Impact
Successful exploitation allows an attacker to execute arbitrary JavaScript code within the context of the SiYuan application. On desktop Electron builds with insecure configurations (nodeIntegration enabled and contextIsolation disabled), this can escalate to arbitrary code execution on the victim's system. This can lead to full compromise of the affected host running vulnerable versions of SiYuan prior to 3.6.4.
Mitigation Recommendations
Upgrade SiYuan to version 3.6.4 or later, where this vulnerability has been fixed by changing the Mermaid rendering security settings. Users should ensure they are not running versions 3.6.3 or below. No other mitigations are specified in the advisory.
CVE-2026-40322: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in siyuan-note siyuan
Description
CVE-2026-40322 is a critical cross-site scripting (XSS) vulnerability in SiYuan versions 3. 6. 3 and below. The issue arises because Mermaid diagrams are rendered with securityLevel set to "loose" and injected into the DOM via innerHTML, allowing attacker-controlled javascript: URLs to persist in rendered output. On desktop Electron builds with nodeIntegration enabled and contextIsolation disabled, this XSS can escalate to arbitrary code execution when a user interacts with a malicious Mermaid diagram. This vulnerability is fixed in version 3. 6. 4.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
SiYuan, an open-source personal knowledge management system, versions 3.6.3 and earlier render Mermaid diagrams insecurely by setting securityLevel to "loose" and injecting SVG content via innerHTML. This allows attacker-supplied javascript: URLs in Mermaid code blocks to survive into the rendered SVG output, resulting in stored cross-site scripting. On desktop Electron builds with nodeIntegration enabled and contextIsolation disabled, this stored XSS can escalate to arbitrary code execution when a victim opens a note containing a malicious Mermaid block and clicks the rendered diagram node. The vulnerability is tracked as CVE-2026-40322 with a CVSS 3.1 score of 9.1 (critical) and has been fixed in version 3.6.4.
Potential Impact
Successful exploitation allows an attacker to execute arbitrary JavaScript code within the context of the SiYuan application. On desktop Electron builds with insecure configurations (nodeIntegration enabled and contextIsolation disabled), this can escalate to arbitrary code execution on the victim's system. This can lead to full compromise of the affected host running vulnerable versions of SiYuan prior to 3.6.4.
Mitigation Recommendations
Upgrade SiYuan to version 3.6.4 or later, where this vulnerability has been fixed by changing the Mermaid rendering security settings. Users should ensure they are not running versions 3.6.3 or below. No other mitigations are specified in the advisory.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-04-10T21:41:54.505Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 69e2142282d89c981fcd7cf5
Added to database: 4/17/2026, 11:06:10 AM
Last enriched: 4/17/2026, 11:07:48 AM
Last updated: 4/17/2026, 12:39:02 PM
Views: 5
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.