CVE-2026-40107 in B3Log Siyuan
SiYuan is a personal knowledge management system. Prior to 3.6.4, SiYuan configures Mermaid.js with securityLevel: "loose" and htmlLabels: true. In this mode, <img> tags with src attributes survive Mermaid's internal DOMPurify and land in SVG <foreignObject> blocks. The SVG is injected via innerHTML with no secondar...
Affects 1 product from 1 vendor. Facts below cite their sources.
Remotely exploitable over the network, low complexity, no authentication required, requires user interaction, impact contained to the vulnerable component, full confidentiality impact, no integrity impact, no availability impact.
Affected products and versions
| Vendor | Product | Affected versions |
|---|---|---|
| B3Log | Siyuan | < 3.6.4 |
A product listed here is affected only at the versions shown. Use the free check to test the exact version you run.
Fix and vendor advisory
No official vendor advisory link on record. See the CVE record.
Vendor PSIRT: [email protected]
Exploitation
| CISA known-exploited | Not in the CISA KEV catalog |
|---|---|
| Public exploit | Not confirmed |
Official description
SiYuan is a personal knowledge management system. Prior to 3.6.4, SiYuan configures Mermaid.js with securityLevel: "loose" and htmlLabels: true. In this mode, <img> tags with src attributes survive Mermaid's internal DOMPurify and land in SVG <foreignObject> blocks. The SVG is injected via innerHTML with no secondary sanitization. When a victim opens a note containing a malicious Mermaid diagram, the Electron client fetches the URL. On Windows, a protocol-relative URL (//attacker.com/image.png) resolves as a UNC path (\\attacker.com\image.png). Windows attempts SMB authentication automatically, sending the victim's NTLMv2 hash to the attacker. This vulnerability is fixed in 3.6.4.
Source: NIST NVD / MITRE CVE.
Record details
| CVE ID | CVE-2026-40107 |
|---|---|
| BreachSpider ID | BS-2026-GLOBAL-152177-M |
| CVSS vector | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N |
| Published | 2026-04-09 |
| Last modified | 2026-06-17 |
| Weakness (CWE) | |
| Source | NVD |
Weakness definitions
CWE-918: Server-Side Request Forgery (SSRF)
Attacker causes the server to make HTTP requests to attacker-chosen destinations, potentially reaching internal services.
Related attack patterns (CAPEC)
CAPEC-664 Server Side Request Forgery via CWE-918
Mapping is CWE to CAPEC per MITRE CAPEC 3.9.
Analysis AI-written, not human-reviewed
SiYuan, a personal knowledge management system, prior to version 3.6.4, is vulnerable to Cross-Site Scripting (XSS) due to improper configuration of Mermaid.js with securityLevel set to 'loose' and htmlLabels enabled. This allows malicious Mermaid diagrams to inject SVG content containing <img> tags with src attributes, which can execute arbitrary scripts in the context of the victim's browser.
An attacker can craft a malicious Mermaid diagram containing SVG with <img> tags that reference external scripts. When a victim opens a note containing this diagram, the SVG is injected into the DOM via innerHTML without further sanitization, leading to potential execution of arbitrary scripts in the victim's browser context.
Questions
What is CVE-2026-40107?
SiYuan, a personal knowledge management system, prior to version 3.6.4, is vulnerable to Cross-Site Scripting (XSS) due to improper configuration of Mermaid.js with securityLevel set to 'loose' and htmlLabels enabled. This allows malicious Mermaid diagrams to inject SVG content containing <img> tags with src attributes, which can execute arbitrary scripts in the context of the victim's browser.
What is the CVSS score for CVE-2026-40107?
CVE-2026-40107 has CVSS 6.5 (Medium). Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N. EPSS: 0.5%.
Is CVE-2026-40107 actively exploited?
No confirmed active exploitation of CVE-2026-40107 as of 2026-09-25.
How do I remediate CVE-2026-40107?
Priority: HIGH. PSIRT: [email protected]
What systems are affected by CVE-2026-40107?
CVE-2026-40107 affects B3Log Siyuan.
For developers and AI agents
Run this check from your own code or agent
REST API
curl -s https://breachspider.com/api/v1/assets/correlate-cves \
-H "Authorization: Bearer $BREACHSPIDER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"assets":[{"asset_id":"dev-1","vendor":"B3Log","product":"Siyuan","version":"1.0"}]}'
MCP for AI agents
# hosted: add as a connector
https://mcp.breachspider.com/mcp
# local
pipx install breachspider-mcp
Free trial: 14 days, 750 device checks, no card.
Page facts from NVD, MITRE, CISA and vendor advisories, record last modified 2026-06-17.