Summary
SiYuan has a stored cross-site scripting vulnerability in Gallery and Kanban AttributeView rendering, where checkbox column names may be inserted into HTML without proper escaping. If a user opens a crafted document in the Electron desktop client with Node integration enabled, the injected content may execute Node.js code and host operating system commands.
Affected context
The issue affects SiYuan versions from 3.3.0 to before 3.8.10. It occurs when Gallery or Kanban AttributeView renderers display checkbox column names without escaping them as HTML. Risk is heightened when a crafted .sy.zip document is opened in the Electron desktop client with Node integration enabled.
Exploit preconditions
- Attack surface: Rendering imported or shared SiYuan documents in Gallery or Kanban AttributeViews
- Required access: An attacker must be able to provide a crafted document to a user; the user must open or render it
- Trigger point: Rendering a checkbox column name in an affected AttributeView
- Why exploitation is possible: Unescaped content can be interpreted as HTML, and Node integration in the desktop client may expose Node.js capabilities to injected script
Why this happens
The underlying bug is improper neutralization of user-controlled data in HTML output, corresponding to CWE-79: Cross-Site Scripting. The renderers treat checkbox column names as trusted content rather than applying context-appropriate output encoding. In an Electron environment with Node integration enabled, the consequences of script execution may extend beyond the application UI.
Potential impact
- Injected script may execute when the crafted document is rendered
- In the affected desktop-client configuration, code may access Node.js capabilities
- Host operating system commands could be run with the privileges of the SiYuan process
- Local data or the application environment could be exposed or modified
General mitigation guidance
Defensive patterns include:
- Apply context-appropriate HTML escaping to all user-controlled values before rendering
- Prefer safe templating or DOM APIs that treat values as text rather than markup
- Disable Node integration for content that may include untrusted HTML, and use Electron isolation and sandboxing controls
- Treat imported and shared documents as untrusted; validate or constrain their content before rendering
- Limit the privileges available to the desktop application and its process
How teams detect issues like this
- Use static analysis to identify user-controlled values flowing into HTML rendering without context-appropriate encoding
- Review Gallery and Kanban rendering paths, especially handling of column names and imported document content
- Add tests that verify special characters in attribute names are rendered as text, not interpreted as markup
- Enforce policies that restrict Node integration and require secure Electron isolation settings
- Automated code review tools may help identify unsafe HTML sinks and missing output encoding

