Summary
SiYuan before 3.8.2 trusts attacker-controlled clipboard content identified by the text/siyuan MIME type and bypasses sanitization in its paste handler. When a user pastes content prepared by a malicious web page, injected scripts may execute in the Node-enabled desktop renderer and access powerful Electron or Node.js capabilities.
Affected context
The vulnerability occurs in SiYuan desktop environments where:
- Clipboard content can be populated by untrusted web pages
- The application recognizes the attacker-writable
text/siyuanMIME type - Paste processing accepts the content without adequate sanitization
- The renderer has Node.js or privileged Electron integration enabled
Exploitation generally depends on a user copying or pasting content into the affected application.
Exploit preconditions
- Attack surface: SiYuan's desktop clipboard and paste-handling functionality
- Required access: The ability to cause a victim's browser or another application to place crafted content on the clipboard
- Trigger point: Pasting the crafted content into SiYuan
- Why exploitation is possible: The paste handler trusts the attacker-writable MIME type and allows script content to bypass sanitization in a privileged renderer
Why this happens
The underlying bug is insufficient output encoding and sanitization of clipboard-derived content before it is interpreted as active markup or script.
By trusting the text/siyuan MIME type as an indication of safe application content, the paste handler reduces the effective trust boundary around clipboard data. This maps to CWE-79: Improper Neutralization of Input During Web Page Generation, because attacker-controlled content can be interpreted as executable script. The risk is amplified when the renderer exposes Node.js or other privileged Electron capabilities.
Potential impact
- Arbitrary script execution in the SiYuan renderer
- Access to Node.js APIs and local application resources
- Theft or modification of locally accessible notes and files
- Account or session data exposure where available
- Further compromise of the user's desktop environment
General mitigation guidance
Mitigation generally focuses on treating all clipboard content as untrusted and removing unnecessary privilege from renderer processes.
Common defensive patterns include:
- Applying context-appropriate sanitization and output encoding to pasted content
- Validating clipboard data independently of its MIME type
- Avoiding script-capable insertion paths for user-controlled content
- Disabling Node.js integration and restricting Electron renderer privileges where possible
- Using an explicit, narrowly scoped IPC bridge instead of exposing general Node.js access
- Requiring user confirmation for high-risk paste operations or active-content imports
How teams detect issues like this
Organizations can identify similar risks through:
- Static analysis rules for unsanitized clipboard or DOM insertion flows
- Code review checks for MIME-type trust decisions and privileged renderer configuration
- Tests that paste HTML or script-bearing content from untrusted sources
- Electron policy checks for Node.js integration, unrestricted IPC, and unsafe context isolation settings
- Runtime monitoring for unexpected filesystem, process, or IPC activity following paste events
Automated security review tools may help flag dangerous sinks and missing sanitization, but manual review is useful for assessing trust boundaries and renderer privileges.

