CVE-2026-39846: SiYuan Remote Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-phhp-9rm9-6gr2
CVSS 9.0
CWE-94 CWE-79
Published
Advisory Summary

CVE-2026-39846 is a CRITICAL (CVSS 9.0) remote code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting SiYuan libraries in the Go ecosystem. The issue involves remote code execution in the electron desktop client via stored xss in synced table captions. Remediation is available by upgrading affected packages to version 0.0.0-20260407035653-2f416e5253f1.

CVE-2026-39846 at a Glance

CVE Identifier CVE-2026-39846
GHSA Identifier GHSA-phhp-9rm9-6gr2
Severity CRITICAL
CVSS v3.1 Base Score 9.0
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product SiYuan
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 9.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-39846

To remediate this vulnerability, upgrade all affected SiYuan dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/siyuan-note/siyuan/kernel fixed: 0.0.0-20260407035653-2f416e5253f1
Upgrade github.com/siyuan-note/siyuan/kernel to 0.0.0-20260407035653-2f416e5253f1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/siyuan-note/siyuan/kernel

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-39846, inspect your project dependencies for SiYuan:

inspect dependencies for github.com/siyuan-note/siyuan/kernel

Analyze the terminal output to locate any version of SiYuan in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.0-20260407035653-2f416e5253f1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In SiYuan, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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

CVE-2026-39846 Affected SiYuan Versions

1 component(s)
Fixed Versions:
0.0.0-20260407035653-2f416e5253f1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/siyuan-note/siyuan/kernel
Go
< 0.0.0-20260407035653-2f416e5253f1
0.0.0-20260407035653-2f416e5253f1

References

Frequently Asked Questions

What is CVE-2026-39846?
CVE-2026-39846 is a security vulnerability in SiYuan involving Remote Code Execution in the Electron desktop client via stored XSS in synced table captions under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which SiYuan versions are affected?
Affected versions include releases prior to 0.0.0-20260407035653-2f416e5253f1 across affected packages: github.com/siyuan-note/siyuan/kernel.
What version fixes CVE-2026-39846?
Upgrading to 0.0.0-20260407035653-2f416e5253f1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/siyuan-note/siyuan/kernel affected?
Yes, github.com/siyuan-note/siyuan/kernel is affected in releases prior to 0.0.0-20260407035653-2f416e5253f1. Upgrade your dependency to 0.0.0-20260407035653-2f416e5253f1 or later.
What is the CVSS score of CVE-2026-39846?
CVE-2026-39846 has a CVSS v3.1 base score of 9.0 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2026-39846?
CVE-2026-39846 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check Go dependencies for CVE-2026-39846?
Run the dependency tree command: 'inspect dependencies for github.com/siyuan-note/siyuan/kernel'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-phhp-9rm9-6gr2",
  "modified" : "2026-04-08T15:03:55Z",
  "published" : "2026-04-08T15:03:54Z",
  "aliases" : [ "CVE-2026-39846" ],
  "summary" : "SiYuan: Remote Code Execution in the Electron desktop client via stored XSS in synced table captions",
  "details" : "### Summary\nA 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.\n\n### Details\nThe 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.\n\nI confirmed that a crafted table caption containing encoded HTML such as `&lt;img src=x onerror=...&gt;` 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.\n\nIn 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.\n\n### PoC\n\n- SiYuan Desktop Client A: attacker\n- SiYuan Desktop Client B: victim\n- Both clients are configured to use the same sync target\n\n### PoC File\n\nI created a malicious `.sy.zip` note containing a table block with a crafted `caption` property.\n\nSafe validation payload:\n```html\n&lt;img src=x onerror=alert('caption-xss')&gt;\n```\nRCE validation payload on Windows:\n```html\n&lt;img src=x onerror=require('child_process').exec('calc')&gt;\n```\n\n### Steps to Reproduce\n1.On Client A, import the crafted `.sy.zip` note using:\n\n`Import -> SiYuan .sy.zip`\n\n2.Confirm the imported note appears in the workspace.\n\n3.Trigger sync on Client A so the malicious note is uploaded to the shared sync target.\n\n4.On Client B, trigger sync so the note is downloaded from the shared sync target.\n\n5.Open the synced note on Client B.\n\n### Observed Result\nWith the safe payload, JavaScript executes automatically when the victim opens the note.\nWith the RCE payload, the Electron renderer executes:\n```js\nrequire('child_process').exec('calc')\n```\nThis launches Calculator on Windows, demonstrating code execution in the victim user's context.\n\n### Impact\n- Impact Across All Platforms: Stored XSS\n- Electron Desktop App: Remote Code Execution",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/siyuan-note/siyuan/kernel"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.0-20260407035653-2f416e5253f1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/siyuan-note/siyuan/security/advisories/GHSA-phhp-9rm9-6gr2"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-39846"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/siyuan-note/siyuan"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79", "CWE-94" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-08T15:03:54Z",
    "nvd_published_at" : "2026-04-07T22:16:23Z"
  }
}