Summary
SiYuan has a stored cross-site scripting vulnerability in Attribute View column names, which are rendered without proper escaping. If a victim adds or duplicates a malicious column in the desktop application, the injected script may run with Node.js privileges and could enable desktop code execution.
Affected context
The issue occurs when Attribute View column names containing attacker-controlled HTML are rendered in col.ts without escaping. Malicious names may be introduced through addAttributeViewKey, a .sy.zip import, or synchronization. Risk depends on a victim opening or interacting with the affected view in a vulnerable SiYuan desktop context.
Exploit preconditions
- Attack surface: Attribute View column names and their rendering in the SiYuan application
- Required access: Ability to introduce or synchronize a crafted column name, or otherwise provide a malicious
.sy.zipimport - Trigger point: A victim adds or duplicates the affected column
- Why exploitation is possible: The column name is rendered as HTML without adequate escaping, allowing script execution; in the desktop context, the script may have Node.js privileges
Why this happens
This is a stored cross-site scripting flaw mapped to CWE-79: Improper Neutralization of Input During Web Page Generation. Attacker-controlled column names are treated as markup rather than plain text when rendered, and insertion through insertAdjacentHTML allows embedded script to execute. The desktop application's Node.js privileges can increase the consequences beyond those of ordinary browser-based XSS.
Potential impact
- Malicious script may execute when a victim adds or duplicates the affected column.
- In the desktop context, script execution may enable access to Node.js capabilities.
- An attacker could potentially execute code on the victim's machine or access data available to the application.
- The issue could compromise the integrity or confidentiality of the user's SiYuan workspace.
General mitigation guidance
Defensive patterns include:
- Render column names as text using safe DOM APIs rather than inserting them as HTML.
- Apply context-appropriate output encoding and, where rich text is necessary, use a restrictive, well-maintained sanitizer.
- Treat imported, synchronized, and otherwise externally supplied content as untrusted.
- Minimize or isolate privileged Node.js capabilities from content-rendering contexts.
- Use a restrictive content security policy as a defense-in-depth measure.
How teams detect issues like this
- Use static analysis to identify unsafe HTML insertion APIs such as
insertAdjacentHTMLwhen their inputs may contain user-controlled values. - Review rendering paths for Attribute View names and trace whether imported, synchronized, or API-supplied values reach HTML sinks without encoding or sanitization.
- Add tests that verify hostile markup is displayed as inert text across add, duplicate, import, and synchronization flows.
- Apply code review and CI policies that flag unsafe DOM sinks and require approved rendering or sanitization patterns.

