| Gói / sản phẩm | Phiên bản bị ảnh hưởng | Phiên bản đã vá |
|---|---|---|
| github.com/siyuan-note/siyuan/kernel | < 0.0.0-20260304034809-d68bd5a79391 | 0.0.0-20260304034809-d68bd5a79391 |
| siyuan | < 3.5.9 | 3.5.9 |
An unauthenticated reflected XSS vulnerability exists in the dynamic icon API endpoint:
GET /api/icon/getDynamicIconWhen type=8, attacker-controlled content is embedded into SVG output without escaping. Because the endpoint is unauthenticated and returns image/svg+xml, a crafted URL can inject executable SVG/HTML event handlers (for example onerror) and run JavaScript in the SiYuan web origin.
This can be chained to perform authenticated API actions and exfiltrate sensitive data when a logged-in user opens the malicious link.
The issue is caused by unsafe output construction and incomplete sanitization:
Endpoint is exposed without auth middleware
GET /api/icon/getDynamicIcon is registered in the unauthenticated section.User input is inserted into SVG via string formatting
generateTypeEightSVG, %s directly injects content into <text>...</text> without XML/HTML escaping.Sanitizer only removes <script> tags
RemoveScriptsInSVG removes <script> nodes, but does not remove dangerous attributes (onerror, onload, etc.) or unsafe elements.As a result, payloads such as </text><image ... onerror=...><text> survive and execute.
Bạn đang dùng một trong các sản phẩm này? Quét site để biết có đang lộ phiên bản có lỗ hổng không.
Quét site miễn phíOpen this URL in a browser:
GET /api/icon/getDynamicIcon?type=8&content=%3C%2Ftext%3E%3Cimage%20href%3Dx%20onerror%3Dalert(document.domain)%3E%3C%2Fimage%3E%3Ctext%3E
Example full URL:
http://127.0.0.1:6806/api/icon/getDynamicIcon?type=8&content=%3C%2Ftext%3E%3Cimage%20href%3Dx%20onerror%3Dalert(document.domain)%3E%3C%2Fimage%3E%3Ctext%3E
Expected result:
alert(document.domain)), confirming reflected XSS.If a victim is authenticated in the same browser session, JavaScript running in origin can call privileged APIs and exfiltrate returned data.
This is a reflected XSS in an unauthenticated endpoint, with realistic account/data compromise impact: