SiyuanApplication · B3log

CVE-2026-40322

CRITICAL · 9.0 CVSS v3.1 Published 2026-04-16
Fix available
A fix is available. Upgrade to 3.6.4 or later.
See remediation →
94/100
Remediation priority · Urgent
Remotely reachable

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
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.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

SiYuan versions 3.6.3 and below render Mermaid diagrams with securityLevel set to 'loose' and inject the resulting SVG via innerHTML, allowing attacker-controlled javascript: URLs in Mermaid code blocks to execute. On Electron desktop builds with nodeIntegration enabled and contextIsolation disabled, this stored XSS escalates to arbitrary code execution when users click malicious diagram nodes.

MitigationUpgrade to SiYuan version 3.6.4 or later, which fixes the Mermaid securityLevel configuration.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.

NVD · CPE data
SiyuanApplication
Affected:< 3.6.4

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
Low
Privileges
Low
User interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Check installed SiYuan version
    Open SiYuan, go to Help > About, or check the application version in the installation directory. Compare the version number to the affected range (3.6.3 and below).
    Affected if Version is 3.6.3 or lower, or any version below 3.6.4.
  2. Identify Mermaid diagram usage
    Search your SiYuan notes for code blocks with mermaid language specifier. Look for blocks like ```mermaid in your markdown files or use SiYuan's search function to find mermaid code blocks.
    Affected if Any notes contain Mermaid code blocks, especially if they contain hyperlinks or clickable elements.
  3. Inspect Electron security configuration (desktop builds)
    If using the Electron desktop application, locate the main.js or electron configuration file in the SiYuan installation directory. Check for nodeIntegration: true and contextIsolation: false settings in the webPreferences object.
    Affected if nodeIntegration is enabled AND contextIsolation is disabled in the Electron configuration.
  4. Examine rendered Mermaid SVG output
    Open a note with a Mermaid diagram, right-click the rendered diagram, and inspect the HTML. Look for SVG elements with event handlers or javascript: URLs in href attributes.
    Affected if The rendered SVG contains clickable elements with javascript: protocols or inline event handlers.

You are affected if running SiYuan version 3.6.3 or below, using Mermaid diagrams in notes, and (for desktop builds) with insecure Electron settings that allow the stored XSS to escalate to code execution.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Upgrade available Upgrade to 3.6.4 or later
Fixed in 3.6.4
Interim mitigation

Upgrade to SiYuan version 3.6.4 or later, which fixes the Mermaid securityLevel configuration.

Recommended fix High confidence

3.6.4

  1. 1. Back up your SiYuan data before upgrading.
  2. 2. Download SiYuan version 3.6.4 or later from the official repository.
  3. 3. Install the updated version, overwriting the existing installation.
  4. 4. Verify the version number after installation to confirm the upgrade was successful.

Generated from the published advisory — verify against the referenced sources before acting.

Fix this in Siyuan Scoped from the published advisory
  • Consultation3.0 h
  • Implementation6.0 h
  • Testing3.0 h
  • Review / QA2.0 h
14.0 hours of engineering $2,490
Get the upgrade done

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $3,984.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2026-40322 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2026-40322 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data