{"vuln_id":"CVE-2026-56397","aliases":["GHSA-v3mg-9v85-fcm7"],"description":"SiYuan Vulnerable to Remote Code Execution via Malicious Bazaar Package — Marketplace XSS","published_at":"2026-03-16T20:43:49Z","modified_at":"2026-11-17T07:11:28.734015Z","first_seen_at":"2026-11-21T19:15:56.733292Z","severity":"critical","severity_source":"nvd","cvss_score":9.4,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","cwe":["CWE-79"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":0.00496,"epss_percentile":0.43425,"nvd_status":"Deferred","enriched_at":"2026-11-22T10:13:34.127555Z","links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-56397"},"matched_alias":null,"items":[{"id":10989,"source":{"id":"osv","name":"OSV.dev"},"title":"GO-2026-4720: SiYuan vulnerable to remote code execution via marketplace XSS in github.com/siyuan-note/siyuan/kernel","summary":"SiYuan vulnerable to remote code execution via marketplace XSS in github.com/siyuan-note/siyuan/kernel.\n\nNOTE: The source advisory for this report contains additional versions that could not be automatically mapped to standard Go module versions.\n\n(If this is causing false-positive reports from vulnerability scanners, please suggest an edit to the report.)\n\nThe additional affected modules and versions are: github.com/siyuan-note/siyuan/kernel before v3.6.1.\n\nAffected: Go:github.com/siyuan-note/siyuan/kernel\n\nFixed in: 0.0.0-20260317012524-fe4523fff2c8\n\nReferences:\nhttps://github.com/siyuan-note/siyuan/security/advisories/GHSA-v3mg-9v85-fcm7","url":"https://osv.dev/vulnerability/GO-2026-4720","published_at":"2026-08-19T15:16:03Z","updated_at":"2026-11-17T07:11:28.734015Z","fetched_at":"2026-11-21T19:15:55.946352Z","severity":"critical","cvss_score":9.4,"epss":0.00496,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"github.com/siyuan-note/siyuan/kernel","vuln_id":"CVE-2026-56397","vuln_ids":["CVE-2026-56397","GHSA-V3MG-9V85-FCM7","GO-2026-4720"],"tags":["osv","go","fix-available"],"cluster_id":10760,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10989","html":"https://vulnwatch.ve1ve2.com/item/10989"}},{"id":10988,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-v3mg-9v85-fcm7: SiYuan Vulnerable to Remote Code Execution via Malicious Bazaar Package — Marketplace XSS","summary":"SiYuan Vulnerable to Remote Code Execution via Malicious Bazaar Package — Marketplace XSS\n\n# Remote Code Execution via Malicious Bazaar Package — Marketplace XSS\n\n## Summary\n\nSiYuan's Bazaar (community marketplace) renders plugin/theme/template metadata and README content without sanitization. A malicious package author can achieve RCE on any user who browses the Bazaar by:\n\n1. **Package metadata XSS (zero-click):** Package `displayName` and `description` fields are injected directly into HTML via template literals without escaping. Just loading the Bazaar page triggers execution.\n2. **README XSS (one-click):** The `renderREADME` function uses `lute.New()` without `SetSanitize(true)`, so raw HTML in the README passes through to `innerHTML` unsanitized.\n\nBoth vectors execute in Electron's renderer with `nodeIntegration: true` and `contextIsolation: false`, giving full OS command execution.\n\n## Affected Component\n\n- **Metadata rendering:** `app/src/config/bazaar.ts:275-277`\n- **README rendering (backend):** `kernel/bazaar/package.go:635-645` (`renderREADME`)\n- **README rendering (frontend):** `app/src/config/bazaar.ts:607` (`innerHTML`)\n- **Electron config:** `app/electron/main.js:422-426` (`nodeIntegration: true`)\n- **Version:** SiYuan <= 3.5.9\n\n## Vulnerable Code\n\n### Vector 1: Package metadata — no HTML escaping (bazaar.ts:275-277)\n\n```typescript\n// Package name injected directly into HTML template — NO escaping\n${item.preferredName}${item.preferredName !== item.name\n? `\n${item.name}\n` : \"\"}\n\n// Package description injected directly — NO escaping\n\n${item.preferredDesc || \"\"}\n\n```\n\nNote: The `title` attribute uses `escapeAttr()`, but the actual text content does not — inconsistent escaping.\n\n### Vector 2: README rendering — no Lute sanitization (package.go:635-645)\n\n```go\nfunc renderREADME(repoURL string, mdData []byte) (ret string, err error) {\nluteEngine := lute.New() // Fresh Lute instance — SetSanitize NOT called\nluteEngine.SetSoftBreak2HardBreak(false)\nluteEngine.SetCodeSyntaxHighlight(false)\nlinkBase := \"https://cdn.jsdelivr.net/gh/\" + ...\nluteEngine.SetLinkBase(linkBase)\nret = luteEngine.Md2HTML(string(mdData)) // Raw HTML in markdown preserved\nreturn\n}\n```\n\nCompare with the SiYuan note renderer in `kernel/util/lute.go:81`:\n```go\nluteEngine.SetSanitize(true) // Notes ARE sanitized — but README is NOT\n```\n\n### Frontend innerHTML injection (bazaar.ts:607)\n\n```typescript\nfetchPost(\"/api/bazaar/getBazaarPackageREADME\", {...}, response => {\nmdElement.innerHTML = response.data.html; // Unsanitized HTML from README\n});\n```\n\n## Proof of Concept\n\n### Vector 1: Malicious package manifest (zero-click RCE)\n\nA malicious `plugin.json` (or `theme.json`, `template.json`):\n\n```json\n{\n\"name\": \"helpful-plugin\",\n\"displayName\": {\n\"default\": \"Helpful Plugin\n\"\n},\n\"descrip\n\nAffected: Go:github.com/siyuan-note/siyuan/kernel\n\nNo fixed version published yet\n\nReferences:\nhttps://github.com/siyuan-note/siyuan/security/advisories/GHSA-v3mg-9v85-fcm7\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-56397\nhttps://github.com/siyuan-note/siyuan\nhttps://www.vulncheck.com/advisories/siyuan-remote-code-execution-via-malicious-bazaar-package-metadata-and-readme-2","url":"https://osv.dev/vulnerability/GHSA-v3mg-9v85-fcm7","published_at":"2026-03-16T20:43:49Z","updated_at":"2026-11-17T07:11:28.734015Z","fetched_at":"2026-11-21T19:15:55.946351Z","severity":"critical","cvss_score":9.4,"epss":0.00496,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"github.com/siyuan-note/siyuan/kernel","vuln_id":"CVE-2026-56397","vuln_ids":["CVE-2026-56397","GHSA-V3MG-9V85-FCM7","GO-2026-4720"],"tags":["osv","go","no-fix-yet"],"cluster_id":10759,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10988","html":"https://vulnwatch.ve1ve2.com/item/10988"}}]}