SiYuan Mermaid Rendering Flaws Expose NTLM Hashes and Enable Electron RCE
GitHub security advisories disclosed two high-severity vulnerabilities in SiYuan that stem from unsafe Mermaid diagram rendering in versions 3.6.3 and earlier. In CVE-2026-40107, SiYuan rendered Mermaid content with securityLevel="loose" and htmlLabels enabled, allowing attacker-controlled img tags to survive sanitization and be injected into SVG foreignObject content through innerHTML. When a victim opens a malicious note, the Electron client can fetch an attacker-controlled URL; on Windows, protocol-relative paths may resolve to UNC shares and trigger automatic SMB authentication, leaking the victim's NTLMv2 hash. The issue was fixed in version 3.6.4 and mapped to CWE-918.
A second flaw, CVE-2026-40322, used the same Mermaid configuration weakness to allow javascript: links to persist in rendered SVG output, creating a stored XSS condition. In SiYuan's Electron desktop application, where nodeIntegration was enabled and contextIsolation disabled, the bug could be escalated to arbitrary code execution if a user opened a malicious note and clicked the rendered diagram node. The vulnerability affects the same pre-3.6.4 release line and is mapped to CWE-79 and CWE-94, with advisory details describing high impact to confidentiality, integrity, and availability.

Get ahead of threats like this
Mallory correlates global threat intelligence with your attack surface — know if you’re exposed before adversaries strike.
How this story unfolded
3 events from the most recent confirmed update back to the earliest known activity.
GitHub advisory discloses CVE-2026-40322 for SiYuan
A GitHub security advisory disclosed CVE-2026-40322, detailing a stored XSS issue in SiYuan's Mermaid rendering that could be escalated to arbitrary code execution in Electron desktop builds. The flaw required a victim to open a malicious note and click a rendered diagram node, and affected version 3.6.3 and earlier.
GitHub advisory discloses CVE-2026-40107 for SiYuan
A GitHub security advisory published CVE-2026-40107, describing how malicious Mermaid content in SiYuan could trigger attacker-controlled requests and, on Windows, leak a victim's NTLMv2 hash via automatic SMB authentication to a UNC path. The issue was associated with Mermaid securityLevel set to loose and htmlLabels surviving sanitization.
SiYuan fixes Mermaid rendering flaws in version 3.6.4
SiYuan version 3.6.4 fixed multiple Mermaid-related vulnerabilities, including a zero-click NTLM hash theft and blind SSRF issue as well as a javascript: link injection flaw that could lead to stored XSS and Electron RCE. Both issues affected earlier 3.6.x versions and were tied to insecure Mermaid rendering settings and unsafe DOM injection.
Related entities
Vulnerabilities, threat actors, malware, products, organizations, and breaches Mallory has linked to this story.
Sources
2 references tracked. Mallory keeps watching after this page renders.
CVE-2026-40322 - SiYuan: Mermaid `javascript:` Link Injection Leads to Stored XSS and Electron RCE
cvefeed.io
Open sourceCVE-2026-40107 - SiYuan Affected by Zero-Click NTLM Hash Theft and Blind SSRF via Mermaid Diagram Rendering
cvefeed.io
Open sourceSee the full picture, correlated to your attack surface.
Map indicators from this story to your assets and identify affected systems in minutes.
Every observed campaign, victim, and pivot linked to actors named in this story.
Malware, exploits, and IOCs connected to the activity described here.
YARA, Sigma, and Snort rules deployed to your SIEM as soon as they’re published.
Get matching new stories delivered to your team as they break — not the next morning.
Ask questions about this story and take action on the answers.


