CVE-2026-66394 Overview
CVE-2026-66394 is a stored and reflected cross-site scripting (XSS) vulnerability in SiYuan, an open-source personal knowledge management application. Versions before v3.7.3 fail to properly sanitize SVG content, allowing authenticated attackers to bypass the HTML parser-based cleaner. The flaw resides in how the sanitizer handles desc, style, and noscript elements. Browsers interpret embedded scripts as executable SVG content when the response is served with the image/svg+xml content type. Successful exploitation executes attacker-controlled JavaScript in the application origin [CWE-79].
Critical Impact
Authenticated attackers can execute arbitrary JavaScript in the SiYuan application origin, enabling session hijacking, data theft, and further compromise of user workspaces.
Affected Products
- SiYuan versions prior to v3.7.3
- SiYuan note-taking application (all platforms)
- SVG sanitization component within SiYuan
Discovery Timeline
- 2026-07-27 - CVE-2026-66394 published to NVD
- 2026-07-28 - Last updated in NVD database
Technical Details for CVE-2026-66394
Vulnerability Analysis
The vulnerability originates in SiYuan's SVG sanitization logic. The sanitizer relies on an HTML parser to identify and remove dangerous elements. However, HTML parsers and SVG-aware browsers differ in how they handle certain container elements. The HTML parser treats content inside desc, style, and noscript tags as raw character data. When the same content is served to a browser as image/svg+xml, the browser parses it under XML/SVG rules and executes embedded <script> blocks.
Attackers can store crafted SVG payloads in SiYuan documents or deliver them via reflected inputs. Once retrieved and rendered, the script runs in the application origin. This grants access to authentication cookies, local storage, and application APIs available to the current user session.
Root Cause
The root cause is a parser differential between the sanitizer's HTML parsing model and the browser's SVG rendering model. The sanitizer assumes tag semantics that do not hold when the payload is later interpreted as SVG. Content hidden in elements the HTML parser treats as text becomes active markup in the SVG context.
Attack Vector
Exploitation requires an authenticated user to submit or view a crafted SVG. An attacker uploads or embeds an SVG containing a <script> block nested inside <desc>, <style>, or <noscript> tags. When the SVG is served with the image/svg+xml content type and rendered by a victim's browser, the script executes. The victim only needs to view the affected document or resource for the payload to fire.
The vulnerability mechanism is described in detail in the GitHub Security Advisory and the VulnCheck Advisory on XSS.
Detection Methods for CVE-2026-66394
Indicators of Compromise
- SVG files or embedded SVG content containing <script> tags nested within <desc>, <style>, or <noscript> elements
- Unexpected outbound requests from browser sessions rendering SiYuan documents
- Anomalous session token usage originating from user endpoints after opening shared notes
- SiYuan server logs showing uploads or requests for resources with the image/svg+xml content type from untrusted sources
Detection Strategies
- Inspect stored SVG assets for <script> payloads inside desc, style, or noscript containers using regex or SVG-aware scanners
- Monitor HTTP responses served with Content-Type: image/svg+xml for script tag content
- Correlate authentication events with anomalous JavaScript-driven API calls to SiYuan endpoints
- Alert on user accounts sharing SVG-containing documents shortly after account creation or credential changes
Monitoring Recommendations
- Enable verbose logging on the SiYuan instance to capture asset uploads and content types served
- Baseline normal SVG usage across user workspaces and flag deviations in size or embedded elements
- Forward SiYuan application and web server logs to a centralized analytics platform for correlation with endpoint telemetry
- Track browser process activity on endpoints that access SiYuan for signs of credential theft or unusual outbound connections
How to Mitigate CVE-2026-66394
Immediate Actions Required
- Upgrade SiYuan to version 3.7.3 or later, which contains the sanitizer fix
- Audit existing documents and stored assets for malicious SVG payloads and remove them
- Rotate session tokens and credentials for users who may have viewed untrusted SVG content
- Restrict SVG uploads to trusted users until patching is complete
Patch Information
The SiYuan maintainers released v3.7.3 to address CVE-2026-66394. The fix updates the SVG sanitizer to correctly strip script content nested inside desc, style, and noscript elements. Refer to the GitHub Security Advisory GHSA-99rq-75j6-5j9f for the complete remediation details.
Workarounds
- Serve SVG content with a non-rendering content type such as application/octet-stream where feasible
- Deploy a strict Content Security Policy (CSP) that disallows inline scripts on the SiYuan origin
- Disable SVG uploads or embedded SVG rendering until the patch is applied
- Limit workspace sharing to trusted collaborators to reduce exposure to reflected payloads
# Example CSP header to reduce XSS impact on the SiYuan origin
Content-Security-Policy: default-src 'self'; script-src 'self'; object-src 'none'; base-uri 'self'
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

