CVE-2026-34605 Overview
CVE-2026-34605 is a Cross-Site Scripting (XSS) vulnerability in SiYuan, a personal knowledge management system. The vulnerability exists in versions 3.6.0 to 3.6.1, where the SanitizeSVG function—introduced to mitigate XSS in the unauthenticated /api/icon/getDynamicIcon endpoint—can be bypassed using namespace-prefixed element names. By crafting an SVG with elements like <x:script xmlns:x="http://www.w3.org/2000/svg">, attackers can circumvent the sanitization logic and achieve arbitrary script execution in victim browsers.
Critical Impact
Unauthenticated attackers can execute arbitrary JavaScript in the context of a victim's browser session by exploiting the SVG sanitization bypass, potentially leading to session hijacking, credential theft, or further system compromise.
Affected Products
- SiYuan version 3.6.0
- SiYuan version 3.6.1
- SiYuan versions before 3.6.2
Discovery Timeline
- 2026-03-31 - CVE-2026-34605 published to NVD
- 2026-04-01 - Last updated in NVD database
Technical Details for CVE-2026-34605
Vulnerability Analysis
The vulnerability stems from a discrepancy between how the Go HTML5 parser and browser XML parsers handle namespace-prefixed element names within SVG content. When the SanitizeSVG function processes incoming SVG data, it uses the Go HTML5 parser which records elements with namespace prefixes (such as x:script) as literal tag names rather than resolving the namespace.
The sanitization logic performs tag checks against a blocklist of dangerous elements like script, iframe, and object. However, because the parser records the full prefixed name (x:script) rather than the resolved element name (script), the malicious element passes through the sanitization check undetected.
When the SVG is subsequently served to a browser with Content-Type: image/svg+xml and no Content Security Policy headers, the browser's XML parser correctly resolves the namespace prefix to the SVG namespace and executes the embedded script as if it were a standard <script> element.
Root Cause
The root cause is an incomplete understanding of namespace handling differences between HTML5 and XML parsing contexts. The SanitizeSVG function relies on string-based tag name comparisons without accounting for XML namespace resolution. This creates a semantic gap where the sanitizer sees x:script as an unknown safe element, while the browser XML engine interprets it as an executable SVG script element due to the xmlns:x declaration mapping to the SVG namespace.
Attack Vector
The attack vector is network-based and requires no authentication. An attacker can craft a malicious SVG payload and submit it to the /api/icon/getDynamicIcon endpoint. When a victim accesses the returned SVG URL directly in their browser, the embedded script executes within the browser's context.
The attack leverages XML namespace prefixing to evade tag-based filtering. By declaring a custom prefix that maps to the SVG namespace (xmlns:x="http://www.w3.org/2000/svg"), the attacker can embed script elements that appear innocuous to the Go HTML5 parser but are recognized as executable by browser XML engines.
The vulnerability is particularly concerning because the endpoint is unauthenticated, SVG content is served without CSP headers, and no user interaction beyond accessing the malicious URL is required for exploitation. See the GitHub Security Advisory GHSA-73g7-86qr-jrg3 for additional technical details.
Detection Methods for CVE-2026-34605
Indicators of Compromise
- HTTP requests to /api/icon/getDynamicIcon containing namespace declarations with prefixed element names (e.g., xmlns: followed by script-related elements)
- SVG responses containing <x:script>, <y:script>, or similar namespace-prefixed script elements
- Unusual access patterns to the dynamic icon API endpoint from external sources
- Browser console errors or script execution logs originating from SVG resources
Detection Strategies
- Deploy Web Application Firewall (WAF) rules to detect SVG payloads containing namespace-prefixed dangerous elements like script, iframe, object, or event handlers
- Implement application-layer logging for all requests to the /api/icon/getDynamicIcon endpoint with payload inspection
- Configure endpoint detection and response (EDR) solutions to monitor for suspicious script execution originating from SVG content types
- Review server access logs for anomalous patterns of requests to the vulnerable endpoint
Monitoring Recommendations
- Enable verbose logging on the SiYuan application server to capture full request bodies for the affected endpoint
- Implement real-time alerting for requests containing XML namespace declarations in SVG upload or icon generation contexts
- Monitor for increases in failed XSS filter events or sanitization warnings that may indicate exploitation attempts
- Correlate network traffic analysis with endpoint behavior to identify potential exfiltration following successful XSS exploitation
How to Mitigate CVE-2026-34605
Immediate Actions Required
- Upgrade SiYuan to version 3.6.2 or later immediately as this version contains the official patch for CVE-2026-34605
- If immediate upgrade is not possible, restrict access to the /api/icon/getDynamicIcon endpoint through network controls or reverse proxy rules
- Implement Content Security Policy headers to prevent inline script execution as a defense-in-depth measure
- Audit logs for any evidence of prior exploitation attempts against the vulnerable endpoint
Patch Information
The vulnerability has been patched in SiYuan version 3.6.2. The patch addresses the namespace bypass issue in the SanitizeSVG function by implementing proper namespace-aware element validation. Users should update to this version or later to remediate the vulnerability.
For detailed information about the patch, refer to the GitHub Release v3.6.2 and the GitHub Security Advisory GHSA-73g7-86qr-jrg3.
Workarounds
- Block or restrict access to the /api/icon/getDynamicIcon endpoint at the reverse proxy or firewall level until patching is complete
- Implement a strict Content Security Policy with script-src 'self' to prevent execution of inline scripts in SVG content
- Deploy WAF rules to strip or reject SVG content containing XML namespace declarations with prefixed elements
- Consider temporarily disabling the dynamic icon functionality if it is not critical to operations
# Example nginx configuration to add CSP headers
location /api/icon/getDynamicIcon {
add_header Content-Security-Policy "default-src 'none'; script-src 'none';" always;
# Optionally restrict access entirely
# deny all;
# return 403;
}
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


