Summary
SiYuan fails to escape bookmark labels imported from notebook files before rendering them in the dock tree. A maliciously crafted .sy notebook may execute script in the Electron renderer when opened, potentially exposing renderer capabilities such as access to child_process.
Affected context
The vulnerability occurs when SiYuan imports or opens notebook files containing bookmark attributes and renders their labels in the dock tree. Risk is present when untrusted .sy files are processed by an Electron-based application and bookmark content is inserted into the renderer without context-appropriate HTML escaping.
Exploit preconditions
- Attack surface: Notebook-file import or opening within the SiYuan desktop application
- Required access: Ability to provide or persuade a user to open a malicious
.synotebook file - Trigger point: Rendering of an imported bookmark label in the dock tree
- Why exploitation is possible: Bookmark attributes are treated as trusted markup rather than safely encoded text, allowing script content to execute in the Electron renderer
Why this happens
The underlying bug is a failure to apply output encoding when displaying attacker-controlled bookmark labels.
HTML content from notebook attributes reaches the Electron renderer without context-appropriate escaping, enabling script execution when the label is rendered. This maps to CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'). The impact may be amplified when the renderer exposes privileged Electron or Node.js capabilities.
Potential impact
- Arbitrary script execution in the Electron renderer
- Access to application data available to the renderer
- Abuse of exposed
child_processfunctionality for operating-system command execution - Compromise of the local user account or application environment
- Theft, modification, or destruction of notebook content
General mitigation guidance
Mitigation generally focuses on treating imported notebook metadata as untrusted content throughout its lifecycle.
Common defensive patterns include:
- Escaping bookmark labels for the exact output context before rendering them
- Using text-only DOM APIs or framework-safe rendering alternatives instead of interpreting labels as HTML
- Sanitizing legacy content when rich text is genuinely required, using a narrowly allowlisted policy
- Reducing or isolating Node.js and Electron capabilities available to renderer processes
- Applying least privilege to application and child-process execution paths
- Separating untrusted document content from privileged application interfaces
These controls reduce the likelihood that malicious notebook content can cross from the document layer into executable renderer behavior.
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis rules identifying direct insertion of notebook fields into HTML or DOM sinks
- Code review checks for
innerHTML, HTML template interpolation, or equivalent rendering APIs used with imported metadata - Tests that render labels containing markup and verify that they remain inert text
- Electron policy checks for exposed Node.js integration, preload bridges, and child-process access
- Repository scanning and automated security review tools that flag missing output encoding at trust-boundary crossings
Runtime monitoring may also identify unexpected child-process creation or unusual file and process activity after opening untrusted documents.

