The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2026-40322

CVE-2026-40322: SiYuan Knowledge Management RCE Vulnerability

CVE-2026-40322 is a remote code execution vulnerability in SiYuan knowledge management system affecting versions 3.6.3 and below. Malicious Mermaid diagrams can execute arbitrary code. This article covers technical details, impact, and mitigation.

Published: April 16, 2026

CVE-2026-40322 Overview

CVE-2026-40322 is a critical Cross-Site Scripting (XSS) vulnerability in SiYuan, an open-source personal knowledge management system. The vulnerability exists in versions 3.6.3 and below, where 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.

Critical Impact

This vulnerability enables attackers to achieve arbitrary code execution on desktop Electron builds through a stored XSS attack vector, potentially compromising the entire system when a victim interacts with a malicious Mermaid diagram.

Affected Products

  • SiYuan versions 3.6.3 and below
  • SiYuan Desktop (Electron-based builds)
  • SiYuan installations using Mermaid diagram rendering

Discovery Timeline

  • 2026-04-16 - CVE-2026-40322 published to NVD
  • 2026-04-16 - Last updated in NVD database

Technical Details for CVE-2026-40322

Vulnerability Analysis

This vulnerability represents a dangerous combination of insecure content rendering and Electron security misconfigurations. The root issue lies in how SiYuan processes Mermaid diagram content within notes. When a user creates or opens a note containing a Mermaid code block, the application renders the diagram with the Mermaid library's securityLevel option configured as "loose" rather than the more restrictive "strict" setting.

With loose security, Mermaid allows potentially dangerous content such as javascript: protocol handlers to be included in diagram node definitions. This rendered SVG content is then inserted directly into the page DOM using innerHTML, bypassing any sanitization that might otherwise strip malicious scripts.

On its own, this stored XSS vulnerability would be concerning but limited in scope. However, SiYuan's Electron configuration dramatically amplifies the impact. The application creates browser windows with nodeIntegration: true and contextIsolation: false, meaning JavaScript executing in the renderer process has direct access to Node.js APIs. An attacker exploiting this XSS can therefore execute arbitrary system commands, read and write files, and fully compromise the victim's machine.

Root Cause

The vulnerability stems from two compounding security weaknesses. First, the Mermaid diagram renderer is configured with securityLevel: "loose", which permits dangerous content like javascript: URLs in diagram nodes. Second, the rendered SVG is inserted into the DOM using innerHTML without proper sanitization. Combined with Electron's insecure default configuration (nodeIntegration: true, contextIsolation: false), this allows XSS payloads to escalate to full code execution with Node.js capabilities.

Attack Vector

The attack requires an attacker to craft a malicious note containing a specially crafted Mermaid diagram code block. The Mermaid syntax allows defining clickable nodes with URL handlers. By embedding a javascript: URL containing malicious code, the attacker can create a diagram that executes arbitrary JavaScript when clicked.

When a victim opens the note and clicks on the malicious diagram node, the JavaScript executes within the Electron renderer context. Due to the enabled nodeIntegration and disabled contextIsolation, this JavaScript has full access to Node.js APIs, allowing the attacker to spawn child processes, access the file system, or perform any operation the user account permits.

The attack requires user interaction (clicking the diagram node), making it a network-based attack requiring low privileges and user interaction.

Detection Methods for CVE-2026-40322

Indicators of Compromise

  • Presence of notes containing Mermaid code blocks with javascript: protocol URLs
  • Unusual child processes spawned from the SiYuan Electron application
  • File system modifications originating from the SiYuan process outside normal application directories
  • Network connections initiated by SiYuan to unexpected external hosts

Detection Strategies

  • Monitor for Mermaid diagram content containing javascript:, data:, or other dangerous URI schemes in stored notes
  • Implement endpoint detection rules for Node.js child process spawning from Electron applications
  • Audit SiYuan note databases for suspicious Mermaid code block patterns
  • Deploy application behavior monitoring to detect anomalous file or network activity from SiYuan

Monitoring Recommendations

  • Enable process creation logging to identify suspicious child processes from SiYuan
  • Monitor file integrity in sensitive directories for changes initiated by the SiYuan process
  • Implement network traffic analysis for unusual outbound connections from note-taking applications
  • Review shared notes or imported content for potentially malicious Mermaid diagrams before opening

How to Mitigate CVE-2026-40322

Immediate Actions Required

  • Upgrade SiYuan to version 3.6.4 or later immediately
  • Review any recently received or imported notes for suspicious Mermaid diagram content
  • Avoid clicking on diagram nodes in notes from untrusted sources until patched
  • Consider temporarily disabling Mermaid diagram rendering if upgrade is not immediately possible

Patch Information

The vulnerability has been addressed in SiYuan version 3.6.4. Users should upgrade immediately to receive the security fix. The patch addresses the insecure Mermaid securityLevel configuration and improves content sanitization before DOM insertion. For detailed release information, refer to the SiYuan v3.6.4 Release Notes. Additional technical details are available in the GitHub Security Advisory GHSA-x63q-3rcj-hhp5.

Workarounds

  • Avoid opening notes from untrusted sources containing Mermaid diagrams
  • Do not click on diagram nodes until the application is upgraded to version 3.6.4
  • Review and sanitize any imported or shared notes before opening
  • Consider using SiYuan's web version if available, as it may have different security constraints than the Electron desktop build

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechSiyuan

  • SeverityCRITICAL

  • CVSS Score9.0

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityHigh
  • AvailabilityHigh
  • CWE References
  • CWE-79
  • Technical References
  • GitHub Siyuan Release v3.6.4

  • GitHub Security Advisory GHSA-x63q-3rcj-hhp5
  • Related CVEs
  • CVE-2026-39846: SiYuan Electron Desktop Client RCE Flaw

  • CVE-2026-34449: SiYuan Knowledge Management RCE Vulnerability

  • CVE-2026-34585: SiYuan Knowledge System RCE Vulnerability

  • CVE-2026-34448: SiYuan Knowledge Management RCE Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English