{"id":"CVE-2026-34585","aliases":["CVE-2026-34585","GHSA-ff66-236v-p4fg","GO-2026-5357"],"related":[],"kind":"vulnerability","state":"published","title":"SiYuan: Stored XSS in imported .sy.zip content leads to arbitrary command execution","summary":"SiYuan is a personal knowledge management system. Prior to version 3.6.2, a vulnerability allows crafted block attribute values to bypass server-side attribute escaping when an HTML entity is mixed with raw special characters. An attacker can embed a malicious IAL value inside a .sy document, package it as a .sy.zip, and have the victim import it through the normal Import -> SiYuan .sy.zip workflow. Once the note is opened, the malicious attribute breaks out of its original HTML context and injects an event handler, resulting in stored XSS. In the Electron desktop client, this XSS reaches remote code execution because injected JavaScript runs with access to Node/Electron APIs. This issue has been patched in version 3.6.2.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"SiYuan is a personal knowledge management system. Prior to version 3.6.2, a vulnerability allows crafted block attribute values to bypass server-side attribute escaping when an HTML entity is mixed with raw special characters. An attacker can embed a malicious IAL value inside a .sy document, package it as a .sy.zip, and have the victim import it through the normal Import -> SiYuan .sy.zip workflow. Once the note is opened, the malicious attribute breaks out of its original HTML context and injects an event handler, resulting in stored XSS. In the Electron desktop client, this XSS reaches remote code execution because injected JavaScript runs with access to Node/Electron APIs. This issue has been patched in version 3.6.2.","source":"cvelist"},{"lang":"en","text":"### Summary\nA vulnerability allows crafted block attribute values to bypass server-side attribute escaping when an HTML entity is mixed with raw special characters. An attacker can embed a malicious IAL value inside a `.sy` document, package it as a `.sy.zip`, and have the victim import it through the normal `Import -> SiYuan .sy.zip` workflow. Once the note is opened, the malicious attribute breaks out of its original HTML context and injects an event handler, resulting in stored XSS. In the Electron desktop client, this XSS reaches remote code execution because injected JavaScript runs with access to Node/Electron APIs.\n\n### Details\nThe issue is caused by a logic regression in `escapeNodeAttributeValues` in `kernel/filesys/tree.go`.\nPreviously, the escaping logic converted `node.KramdownIAL` with `parse.IAL2Map(...)` before deciding whether a value needed escaping. That conversion unescaped existing entities first, so mixed values such as:\n```\n&amp;\" onmouseenter=\"alert('IAL-XSS')\n```\nwere still recognized as unsafe and escaped correctly.\nThe logic changed to inspect raw `KramdownIAL` values directly. The new `needsEscapeForValue` implementation returns `false` as soon as it sees any known entity such as `&amp;`, `&quot;`, `&lt;`, or `&gt;`. This means a value containing both an entity and an unescaped raw quote bypasses escaping entirely.\n\nThat bypass becomes exploitable because the renderer later inserts block IAL values directly into HTML attributes. A payload like:\n```\n&amp;\" onmouseenter=\"require('child_process').exec('calc')\n```\ncan be rendered into HTML equivalent to:\n```\n<div title=\"&amp;\" onmouseenter=\"require('child_process').exec('calc')\">\n```\nThis creates a stored XSS condition. In SiYuan Desktop, the Electron renderer runs with Node.js integration available, so attacker-controlled JavaScript can invoke Node APIs directly. As a result, the issue is not limited to script execution in the page context and becomes arbitrary command execution on the victim’s machine.\n\nThe stored XSS path was validated by importing a crafted `.sy.zip` through the normal GUI and triggering JavaScript execution from the rendered block. Because the same injected JavaScript runs in the privileged Electron renderer, this is an RCE issue in the desktop client.\n\n### PoC\n1. Start SiYuan Desktop `v3.6.1`.\n2. Prepare a crafted `.sy.zip` containing a .sy document with a block IAL property such as:\n```\n\"title\": \"&amp;\\\" onmouseenter=\\\"require('child_process').exec('calc')\"\n```\n3. In the UI, right-click any notebook.\n4. Select `Import -> SiYuan .sy.zip`.\n5. Import the crafted archive.\n6. Open the imported note.\n7. Move the mouse over the affected paragraph block.\n8. Observe that the injected JavaScript executes.\n9. On Windows, `calc.exe` launches, demonstrating arbitrary command execution.\n\n### Impact\nThis vulnerability allows an attacker to deliver a malicious `.sy.zip` file that executes attacker-controlled JavaScript after import. In the desktop application, that JavaScript runs with Node/Electron privileges and can execute arbitrary operating system commands under the victim’s account. This makes the bug equivalent to local code execution triggered by importing and opening attacker-supplied content.","format":"markdown","source":"ghsa"},{"lang":"en","text":"SiYuan Desktop: Stored XSS in imported .sy.zip content leads to arbitrary command execution in github.com/siyuan-note/siyuan/kernel","format":"markdown","source":"go"},{"lang":"es","text":"SiYuan es un sistema de gestión de conocimiento personal. Antes de la versión 3.6.2, una vulnerabilidad permite que valores de atributos de bloque manipulados eludan el escape de atributos del lado del servidor cuando una entidad HTML se mezcla con caracteres especiales sin procesar. Un atacante puede incrustar un valor IAL malicioso dentro de un documento .sy, empaquetarlo como un .sy.zip, y hacer que la víctima lo importe a través del flujo de trabajo normal de Importar -&gt; SiYuan .sy.zip. Una vez que se abre la nota, el atributo malicioso sale de su contexto HTML original e inyecta un gestor de eventos, resultando en XSS almacenado. En el cliente de escritorio Electron, este XSS alcanza la ejecución remota de código porque el JavaScript inyectado se ejecuta con acceso a las API de Node/Electron. Este problema ha sido parcheado en la versión 3.6.2.","source":"nvd"}],"published":"2026-03-31T21:47:01.843Z","modified":"2026-06-25T19:56:37.607Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","score":8.6,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","score":8.6,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","score":8.6,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H","score":8.2,"rating":"HIGH"}],"cwes":["CWE-79","CWE-94"],"affected":[{"ranges":[{"version":"< 3.6.2","status":"affected"}],"vendor":"siyuan-note","product":"siyuan","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.0.0-20260329142331-918d1bd9f967"}],"ecosystem":"Go","package":"github.com/siyuan-note/siyuan/kernel","purl":"pkg:golang/github.com/siyuan-note/siyuan/kernel","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.0.0-20260329142331-918d1bd9f967"}],"ecosystem":"Go","package":"github.com/siyuan-note/siyuan/kernel","purl":"pkg:golang/github.com/siyuan-note/siyuan/kernel","source":"go"},{"ranges":[{"status":"affected","fixed":"3.6.2"}],"vendor":"b3log","product":"siyuan","cpe":"cpe:2.3:a:b3log:siyuan:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/siyuan-note/siyuan/security/advisories/GHSA-ff66-236v-p4fg","tags":["advisory","exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/siyuan-note/siyuan/issues/17246","tags":["issue-tracking","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/siyuan-note/siyuan/releases/tag/v3.6.2","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-34585","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/siyuan-note/siyuan/commit/918d1bd9f967d888f474f6764744a3d8cca4a501","tags":["web"],"sources":["ghsa","go"]},{"url":"https://github.com/siyuan-note/siyuan","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-04-01T13:34:18.969Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-34585","url":"https://www.cve.org/CVERecord?id=CVE-2026-34585","licence":"CVE Terms of Use","modified":"2026-04-01T13:34:23.291Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-ff66-236v-p4fg","url":"https://github.com/advisories/GHSA-ff66-236v-p4fg","licence":"CC-BY-4.0","modified":"2026-06-25T19:56:37.607Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5357","url":"https://pkg.go.dev/vuln/GO-2026-5357","licence":"CC-BY-4.0","modified":"2026-06-25T19:45:35.020Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-34585","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-34585","licence":"Public domain","modified":"2026-06-17T10:39:16.763Z"}],"updatedAt":"2026-11-25T22:59:17.652Z","epss":{"score":0.004,"percentile":0.36369,"date":"2026-12-01T12:00:22.000Z"}}