GitHub Advisoryadvisory · Go
GHSA-w7cg-whh7-xp28 SiYuan: Stored XSS in Bazaar marketplace via package README event handlers
HIGH
Official page ↗
- Aliases
- CVE-2026-54070
- Ecosystem
- Go
- Packages
- github.com/siyuan-note/siyuan/kernel
- Severity
- High
- CVSS vector
- CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:L
- Weaknesses
- CWE-184, CWE-79
- Reviewed
- 2026-07-10
Affected packages
• Go github.com/siyuan-note/siyuan/kernel: < 0.0.0-20260628153353-2d5d72223df4 → fixed in 0.0.0-20260628153353-2d5d72223df4
Description
Summary
`renderPackageREADME` in `kernel/bazaar/readme.go` renders a Bazaar package README from Markdown to HTML with the lute engine and `SetSanitize(true)`. The lute sanitizer is an event-handler blocklist: `allowAttr` rejects only attribute names present in a fixed `eventAttrs` map copied from the w3schools legacy handler list.
That map omits modern event handlers. `onpointerover`, `onpointerdown`, `onauxclick`, `onbeforetoggle`, `onfocusin`, `onanimationstart`, and `ontransitionend` are not in the list, so the sanitizer passes them through verbatim on any tag.
The frontend assigns the rendered HTML to `mdElement.innerHTML` in `app/src/config/bazaar.ts` with no client-side DOMPurify on this path, into a normal element in the main document (no iframe, no sandbox). The kernel sends no Content-Security-Policy, X-Frame-Options, or X-Content-Type-Options header on any response, so an inline handler runs when its event fires.
The README is rendered when an Administrator opens a package in Settings → Marketplace, after the one-time marketplace trust consent. Install is not required.
Result: a third-party Bazaar package author runs JavaScript in the Administrator's authenticated SiYuan origin when the Administrator views and interacts with the package listing, and gains full control of the workspace.
Affected
siyuan-note/siyuan, ` workspace/data/plugins/evil-plugin/plugin.json plugin description\n' \
> workspace/data/plugins/evil-plugin/README.md
```
2. Request the rendered README the way the Marketplace panel does:
```
curl -s -X POST http://127.0.0.1:6806/api/bazaar/getInstalledPlugin \
-H "Authorization: Token " -H "Content-Type: application/json" \
-d '{"frontend":"all","keyword":""}'
```
Response `data.packages[].preferredReadme` contains the handler verbatim:
```
plugin description
```
A control `` in the same README is returned HTML-escaped and inert.
3. In Settings → Marketplace, open the package and move the pointer over its README.
Live-verified: the rendered HTML is assigned to `mdElement.innerHTML` (no CSP, no sandbox) and the `onpointerover` handler executes `alert(document.domain)` in the SiYuan origin on hover. Handlers do not auto-fire on insertion; one pointer/focus/click interaction on the listing triggers them.
Impact
• JavaScript execution in the Administrator's authenticated origin on a marketplace package view plus one hover/click/focus, no install needed.
• Theft of the kernel API token (`conf.api.token`), which grants full Administrator API access.
• Pivot to `installBazaarPlugin` and kernel control; the runtime image ships a shell.
• A single malicious community package reaches every instance that views its listing.
Credit
Jan Kahmen, turingpoint ([email protected])
Related
Alias · CVE (1)
- CVE-2026-54070 SiYuan is an open-source personal knowledge management system. vulnerability