SiYuan Mermaid Rendering Flaws Expose NTLM Hashes and Enable Electron RCE
Vulnerability Disclosure · 2 sources · Updated 5mo ago · First seen Apr 9, 2026

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.


