/

CVE-2026-65605

Severity:

CRITICAL RISK

(9.6)

Stored XSS (CWE-79) in SiYuan Attribute View Cells

CVE-2026-65605

Deferred

Vulnerability type

Category:

Cross-Site Scripting (Stored)

CWE:

CWE-79

Impact:

Arbitrary JavaScript and OS Command Execution

Severity:

CRITICAL RISK

(9.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

SiYuan contains a stored cross-site scripting flaw in the Attribute View (database) feature where template column values are rendered as HTML without consistent auto-escaping.

An attacker who can save crafted HTML in a template cell can trigger script execution when the database is viewed, and in the desktop app this JavaScript can escalate to arbitrary command execution via Node integration.

Affected context

This vulnerability arises in SiYuan's Attribute View (database) when users define Template columns whose content is rendered through text/template into the UI.

In affected versions, the renderer selectively applies HTML escaping based on a heuristic that checks for unclosed HTML tags, and then inserts the result with innerHTML.

Balanced self-closing tags, such as <img>, bypass this check and are rendered unescaped, creating a persistent XSS condition in any environment where user-controlled template values are stored and later displayed.

Exploit preconditions

  • Attack surface: Attribute View (database) UI where Template columns are used and rendered into the main page.
  • Required access: Ability to create or modify database entries or templates so that crafted HTML is stored in a Template column.
  • Trigger point: A victim (or the attacker) opens or refreshes the affected Attribute View so that the vulnerable cell is rendered via innerHTML.
  • Why exploitation is possible: The rendering pipeline uses text/template without default auto-escaping and relies on a HasUnclosedHtmlTag heuristic before applying EscapeHTML; self-closing tags such as <img> pass this heuristic and are inserted directly as HTML, allowing injected event handlers to run. In the desktop app with nodeIntegration enabled, the injected script can access require and pivot to arbitrary command execution.

Why this happens

The core issue is inconsistent output encoding in a context where user-controlled data is rendered as HTML.

SiYuan's template rendering engine treats template column values as trusted markup, using text/template and inserting the resulting string via innerHTML while only conditionally escaping content.

Because the decision to escape relies on detecting unclosed tags, structurally valid HTML fragments with self-closing tags are not sanitized, directly mapping to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting).

This pattern allows untrusted content to be interpreted as active HTML/JavaScript in both the browser and Electron-like desktop renderer, broadening the impact to OS-level command execution when Node APIs are exposed.

Potential impact

  • Stored execution of arbitrary JavaScript in the context of the SiYuan UI.
  • Theft or manipulation of user data stored or displayed within SiYuan.
  • Session hijacking or persistence of attacker-controlled scripts in shared workspaces.
  • In the desktop application, arbitrary command execution via access to Node's require and related APIs.
  • Potential installation of additional malware or backdoors on the host system running the desktop app.

General mitigation guidance

Effective mitigation focuses on enforcing strict output encoding and reducing trust in user-controlled template content.

Common defensive patterns include:

  • Treating all template-derived values as untrusted and applying context-appropriate escaping before assigning to innerHTML or equivalent sinks.
  • Configuring template engines to be HTML-escaping by default, only allowing raw HTML through tightly controlled and audited helpers.
  • Avoiding heuristic-based escaping decisions; instead, apply consistent encoding for all outputs unless an explicit, well-reviewed exception exists.
  • Segmenting untrusted data from markup by using DOM APIs (e.g., textContent, attribute setters) rather than building HTML strings where possible.
  • In desktop environments, disabling or minimizing nodeIntegration and applying least-privilege principles so that a single XSS does not directly yield OS command execution.

How teams detect issues like this

Detection can leverage both code-centric and behavioral approaches:

  • Static analysis rules that flag uses of innerHTML, dangerouslySetInnerHTML, or similar APIs combined with unescaped user-controlled data.
  • Checks in templating logic for non-escaping render paths, especially where text/template, RAW blocks, or custom helpers bypass default encoders.
  • Code review guidelines that require reviewers to verify context-aware escaping for any data rendered into HTML, attributes, or event handlers.
  • Automated security tests or fuzzing that inject typical XSS payloads into Template columns and observe whether scripts execute when views are rendered.
  • Configuration audits for Electron or similar desktop frameworks to identify instances where nodeIntegration is enabled in windows that render untrusted content.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/commit/41f2861c87575ff5ac4b50a0520b1a4fe55b4a70
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-pw5c-qhf3-jhwh
vulncheck.comvulncheck.com/advisories/siyuan-before-stored-xss-to-rce-via-attribute-view

Frequently asked

questions

Exploitation requires the ability to store or modify Template column values, so its reach depends on how database views are shared; in shared workspaces or multi-user setups, one user's payload can affect others who open the view.

Typically yes, because they must create or edit database entries or templates within SiYuan; however, in any scenario where untrusted parties can contribute content, that content becomes a potential vector.

Apply consistent, context-aware output encoding on all untrusted data before it reaches HTML sinks, and configure template engines to escape by default, reserving raw HTML rendering for tightly controlled, audited paths only.

Establish a secure templating model where user input is always treated as data, not markup; enforce code review policies around HTML sinks and Node-integration settings, and integrate static analysis or linters that flag unescaped uses of innerHTML or equivalent APIs.

Find out what's already
exploitable in your codebase.