/

CVE-2026-86712

Severity:

HIGH RISK

(8.8)

Cross-Site Scripting (CWE-79) in SiYuan Paste Handler

CVE-2026-86712

Deferred

Vulnerability type

Category:

Cross-Site Scripting

CWE:

CWE-79

Impact:

Code Execution

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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/siyuan MIME 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.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan
github.comgithub.com/siyuan-note/siyuan/blob/v3.8.1/app/src/protyle/util/paste.ts
github.comgithub.com/siyuan-note/siyuan/commit/9ce660652de2ced26ec2d98a5a242cb0b8bb7273
github.comgithub.com/siyuan-note/siyuan/releases/tag/v3.8.2
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-9rr9-pxr4-gcgc
vulncheck.comvulncheck.com/advisories/siyuan-before-3.8.2-remote-code-execution-via-clipboard

Frequently asked

questions

A malicious web page may prepare the clipboard remotely, but exploitation generally requires the victim to paste the crafted content into SiYuan.

The attacker typically does not need direct local access. They need to influence clipboard contents and rely on the victim performing the paste action.

Treat clipboard data as untrusted, sanitize or encode it before interpretation, and prevent pasted content from reaching script-capable sinks.

Keep Electron renderers least privileged, avoid Node.js exposure where it is unnecessary, validate MIME types rather than trusting them, and test paste workflows with attacker-controlled content.

Find out what's already
exploitable in your codebase.