Loading...
Skip to main content

CVE-2026-39846

CRITICAL

SiYuan: Remote Code Execution in the Electron desktop client via stored XSS in synced table captions

Published April 8, 2026Updated June 25, 2026Source: osv

Summary

### Summary A malicious note synced to another user can trigger remote code execution in the SiYuan Electron desktop client. The root cause is that table caption content is stored without safe escaping and later unescaped into rendered HTML, creating a stored XSS sink. Because the desktop renderer runs with `nodeIntegration` enabled and `contextIsolation` disabled, attacker-controlled JavaScript executes with access to Node.js APIs. In practice, an attacker can import a crafted note into a synced workspace, wait for the victim to sync, and achieve code execution when the victim opens the note. ### Details The vulnerability exists in the table caption handling path. When a table block is parsed, the `caption` attribute is saved into the node's IAL properties without proper HTML escaping. Later, during rendering, that value is read back, passed through HTML unescaping, and written directly into the output DOM. This turns an attacker-controlled caption into active HTML inside the rendered note. I confirmed that a crafted table caption containing encoded HTML such as `<img src=x onerror=...>` is rendered as a live DOM element instead of inert text. This makes the issue a stored XSS. I also confirmed that the most practical delivery path is not Markdown import, but a crafted `.sy.zip` note imported into a synced workspace. Once synced to another desktop client, opening the note executes the payload automatically. In the Electron desktop client, this XSS results in code execution rather than browser-only script execution. The renderer is configured with `nodeIntegration: true` and `contextIsolation: false`, so JavaScript running in the note context can call Node.js APIs directly. A payload such as `require('child_process').exec('calc')` executes successfully, demonstrating code execution on the victim machine in the context of the logged-in user. ### PoC - SiYuan Desktop Client A: attacker - SiYuan Desktop Client B: victim - Both clients are configured to use the same sync target ### PoC File I created a malicious `.sy.zip` note containing a table block with a crafted `caption` property. Safe validation payload: ```html <img src=x onerror=alert('caption-xss')> ``` RCE validation payload on Windows: ```html <img src=x onerror=require('child_process').exec('calc')> ``` ### Steps to Reproduce 1.On Client A, import the crafted `.sy.zip` note using: `Import -> SiYuan .sy.zip` 2.Confirm the imported note appears in the workspace. 3.Trigger sync on Client A so the malicious note is uploaded to the shared sync target. 4.On Client B, trigger sync so the note is downloaded from the shared sync target. 5.Open the synced note on Client B. ### Observed Result With the safe payload, JavaScript executes automatically when the victim opens the note. With the RCE payload, the Electron renderer executes: ```js require('child_process').exec('calc') ``` This launches Calculator on Windows, demonstrating code execution in the victim user's context. ### Impact - Impact Across All Platforms: Stored XSS - Electron Desktop App: Remote Code Execution

Remediation

Upgrade to the fixed version using your package manager.

Go
Update github.com/siyuan-note/siyuan/kernel to 0.0.0-20260407035653-2f416e5253f1 or later
go get github.com/siyuan-note/siyuan/kernel@v0.0.0-20260407035653-2f416e5253f1

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (1)

PackageEcosystemAffectedFixed In
github.com/siyuan-note/siyuan/kernel
go
All versions0.0.0-20260407035653-2f416e5253f1

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

  • CWE-79
    Cross-site Scripting (XSS)MITRE
  • CWE-94
    Code InjectionMITRE

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 9.0 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
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

Frequently Asked Questions

What is CVE-2026-39846?
SiYuan: Remote Code Execution in the Electron desktop client via stored XSS in synced table captions This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.0/10).
How do I check if my project is affected by CVE-2026-39846?
CVE-2026-39846 affects github.com/siyuan-note/siyuan/kernel. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-39846 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
9.0

Exploitation is straightforward and causes maximum impact. Patch immediately.

Also Known As

GHSA-phhp-9rm9-6gr2
GO-2026-5540

Related CVEs

  • CVE-2026-44588
    CRITICAL

    SiYuan: Electron Renderer RCE via decodeURIComponent-driven tooltip XSS in aria-label sink (incomplete fix for CVE-2026-34585)

  • CVE-2026-45375
    CRITICAL

    SiYuan Bazaar marketplace renders unescaped package `name` and `version` metadata, allowing stored XSS and Electron code execution

  • CVE-2026-30869
    CRITICAL

    SiYuan Vulnerable to Path Traversal in /export Endpoint Allows Arbitrary File Read and Secret Leakage

  • CVE-2026-44670
    CRITICAL

    SiYuan Affected by Stored XSS via Attribute View Name to Electron Renderer RCE

  • CVE-2026-33669
    CRITICAL

    SiYuan has Arbitrary Document Reading within the Publishing Service

  • CVE-2026-33670
    CRITICAL

    SiYuan has directory traversal within its publishing service

  • CVE-2026-32110
    HIGH

    SiYuan has a Full-Read SSRF via /api/network/forwardProxy

  • CVE-2026-40107
    HIGH

    SiYuan Affected by Zero-Click NTLM Hash Theft and Blind SSRF via Mermaid Diagram Rendering

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies