Описание
SiYuan has incomplete fix for CVE-2026-33066: XSS
Summary
The incomplete fix for SiYuan's bazaar README rendering enables the Lute HTML sanitizer but fails to block <iframe> tags, allowing stored XSS via srcdoc attributes containing embedded scripts that execute in the Electron context.
Affected Package
- Ecosystem: Go
- Package: github.com/siyuan-note/siyuan
- Affected versions: < commit b382f50e1880
- Patched versions: >= commit b382f50e1880
Details
The renderPackageREADME() function in kernel/bazaar/readme.go renders Markdown README content from bazaar (marketplace) packages into HTML. The original vulnerability allowed stored XSS through unsanitized HTML in READMEs. The fix adds luteEngine.SetSanitize(true) to enable Lute's built-in HTML sanitizer.
However, the Lute sanitizer in lute/render/sanitizer.go has a critical gap:
<iframe>is explicitly commented out ofsetOfElementsToSkipContent, so iframe tags pass through.- The
srcdocattribute is checked against URL-prefix blocklists (javascript:,data:text/html), butsrcdoccontains raw HTML content, not a URL. A value like<img src=x onerror=alert(1)>does not start with any blocked prefix. - The browser renders
srcdocHTML in a nested browsing context, executing embedded scripts and event handlers.
The fix correctly blocks direct <script> tags, event handler attributes, and javascript: protocol links. However:
<iframe srcdoc="<script>alert(document.domain)</script>">passes through because iframe is not blocked and the srcdoc value is raw HTML (not a URL scheme).<iframe srcdoc="<img src=x onerror=alert(document.cookie)>">also passes because the event handler is inside the srcdoc string value, not a top-level tag attribute.
PoC
Steps to reproduce:
git clone https://github.com/siyuan-note/siyuan /tmp/siyuan_testcd /tmp/siyuan_test && git checkout b382f50e1880ed996364509de5a10a72d7409428~1python3 poc.py(orgo run poc.goif Go PoC)
Expected output:
Impact
A malicious bazaar package author can include <iframe srcdoc='<script>...</script>'> in their README.md. When other users view the package in SiYuan's marketplace UI, the XSS executes in the Electron context with full application privileges, enabling data theft, local file access, and arbitrary code execution on the user's machine.
Suggested Remediation
- Add
iframeto thesetOfElementsToSkipContentset in the Lute sanitizer. - If iframes must be preserved, strip the
srcdocattribute entirely or sanitize its HTML content recursively. - Apply a Content Security Policy (CSP) to the README rendering context.
References
- Incomplete fix commit: https://github.com/siyuan-note/siyuan/commit/b382f50e1880ed996364509de5a10a72d7409428
- Original CVE: CVE-2026-33066
Ссылки
- https://github.com/siyuan-note/siyuan/security/advisories/GHSA-8q5w-mmxf-48jg
- https://nvd.nist.gov/vuln/detail/CVE-2026-33066
- https://nvd.nist.gov/vuln/detail/CVE-2026-40922
- https://github.com/siyuan-note/siyuan/commit/b382f50e1880ed996364509de5a10a72d7409428
- https://github.com/advisories/GHSA-4663-4mpg-879v
- https://github.com/siyuan-note/siyuan/releases/tag/v3.6.4
Пакеты
github.com/siyuan-note/siyuan/kernel
< 0.0.0-20260414013942-62eed37a3263
0.0.0-20260414013942-62eed37a3263
Связанные уязвимости
SiYuan is an open-source personal knowledge management system. In versions 3.6.1 through 3.6.3, a prior fix for XSS in bazaar README rendering (incomplete fix for CVE-2026-33066) enabled the Lute HTML sanitizer, but the sanitizer does not block iframe tags, and its URL-prefix blocklist does not effectively filter srcdoc attributes which contain raw HTML rather than URLs. A malicious bazaar package author can include an iframe with a srcdoc attribute containing embedded scripts in their README. When other users view the package in SiYuan's marketplace UI, the payload executes in the Electron context with full application privileges, enabling arbitrary code execution on the user's machine. This issue has been fixed in version 3.6.4.
Уязвимость системы управления персональными знаниями SiYuan, связанная с непринятием мер по защите структуры веб-страницы, позволяющая нарушителю выполнить произвольный код