Summary
SiYuan has a stored cross-site scripting vulnerability in Attribute View rendering that can occur when an attacker can save asset values containing markup interpreted as HTML. When a victim opens the affected note or row attribute panel in the desktop app, the injected script may execute and, in that environment, run OS commands through Node.js.
Affected context
The issue occurs in genAVValueHTML() when Attribute View asset values are rendered into an image src attribute without adequate escaping. It affects SiYuan builds before 3.8.10 when an attacker can store a crafted asset value and a victim later opens the associated note or row attribute panel in the desktop app.
Exploit preconditions
- Attack surface: Attribute View asset-value rendering in the SiYuan desktop app
- Required access: Ability to store or modify an Attribute View asset value
- Trigger point: A victim opens the bound note or row attribute panel
- Why exploitation is possible: Unescaped data is inserted into an HTML attribute, allowing browser-interpreted script execution; the desktop app's Node.js capabilities may enable OS command execution
Why this happens
The rendering logic places an asset value into an HTML image attribute without correctly encoding it for that context. This allows stored input to alter the resulting markup and cause script execution when the HTML is rendered. The behavior maps to CWE-79: Improper Neutralization of Input During Web Page Generation.
Potential impact
- Injected script may execute when a victim views the affected panel
- In the desktop app environment, script execution could lead to OS command execution
- An attacker may gain access to data or actions available to the victim or application process
- The incident could affect other notes or workflows accessible to the compromised app
General mitigation guidance
Mitigations generally focus on treating stored values as untrusted and preventing them from changing the structure of generated HTML.
Common defensive patterns include:
- Applying context-appropriate output encoding to values inserted into HTML attributes
- Using safe DOM APIs or templating that escapes values by default instead of assembling HTML strings
- Validating asset URLs against a narrow set of acceptable formats and schemes
- Limiting desktop renderer privileges and isolating web content from Node.js capabilities
- Applying least privilege to the application process and restricting access to sensitive operating-system resources
How teams detect issues like this
- Use static analysis to identify dynamic values concatenated into HTML or attribute strings without contextual encoding.
- Review rendering code for untrusted stored data passed to HTML-generation helpers, especially in image and URL attributes.
- Add tests that verify special characters in stored values remain data rather than altering rendered markup.
- Enforce secure rendering and desktop-process isolation policies through code review and CI checks; automated review tools may help flag risky patterns.

