/

CVE-2026-54158

Severity:

CRITICAL RISK

(9.9)

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

CVE-2026-54158

Deferred

Vulnerability type

Category:

Cross-Site Scripting (Stored XSS)

CWE:

CWE-79, CWE-1188

Impact:

Remote Code Execution via Stored XSS in Desktop App

Severity:

CRITICAL RISK

(9.9)

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

A stored cross-site scripting vulnerability in SiYuan's attribute-view (database) cell renderer allows raw cell values to break out of HTML contexts and execute arbitrary JavaScript when a user opens the block-attribute panel.

In Electron desktop builds with nodeIntegration enabled, this JavaScript can further invoke Node.js APIs to achieve remote code execution on the host system, especially when an attacker can write to a synced workspace.

Affected context

This issue arises in SiYuan's attribute-view (database) feature where cell values for types such as text, URL, phone, and mAsset are rendered into HTML without proper escaping.

It is relevant in deployments where:

  • Users open the block-attribute panel that displays database rows
  • Workspaces are synced across devices, allowing shared AV files
  • Electron desktop clients run with nodeIntegration enabled in the renderer

The vulnerability relies on unescaped cell content being persisted and later interpreted as HTML/JavaScript in the UI.

Exploit preconditions

  • Attack surface: Attribute-view (database) UI, specifically the block-attribute panel where cells are rendered.
  • Required access: Ability to write or modify AV (attribute-view) files under a synced SiYuan workspace (e.g., via collaboration, compromised sync endpoint, or local file access).
  • Trigger point: A victim opens a block-attribute panel that includes a row containing a malicious cell value, causing the unsafe renderer branch (text, URL, phone, or mAsset) to interpolate the payload.
  • Why exploitation is possible: The genAVValueHTML function interpolates cell content into HTML attributes and tags without equivalent escaping to html.EscapeAttrVal, allowing attackers to close existing tags and inject arbitrary HTML/JavaScript that the renderer executes.

Why this happens

The vulnerability stems from improper neutralization of untrusted data in the generation of HTML for attribute-view cells, mapping to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting).

In several branches of the cell renderer (text, URL, phone, mAsset), raw cell values are inserted directly into HTML contexts without escaping or context-aware encoding.

This enables crafted values like </textarea><img src=x onerror="..."> or " ><img src=x onerror="..."> to break out of their intended tag boundaries and introduce executable JavaScript.

On Electron desktop, the renderer is configured with nodeIntegration:true, which expands the impact into CWE-1188: Insecure Use of nodeIntegration, because injected JavaScript gains direct access to Node.js primitives like require('child_process'), allowing local code execution.

Potential impact

  • Compromise of the SiYuan user session via arbitrary JavaScript execution in the renderer.
  • Exfiltration or manipulation of notes, documents, and metadata stored in the SiYuan workspace.
  • Execution of arbitrary OS commands on Electron desktop clients using Node.js APIs, leading to full host compromise.
  • Propagation of malicious payloads across synced devices, impacting multiple users or machines tied to the same workspace.
  • Potential installation of persistence mechanisms or secondary malware via script-based RCE on affected desktops.

General mitigation guidance

Effective mitigation focuses on proper output encoding and minimizing renderer privileges:

  • Apply context-aware escaping or encoding to all cell values before inserting them into HTML, ensuring tags, attributes, and text cannot be broken by user-controlled content.
  • Use a robust HTML sanitization pipeline that strips or neutralizes script-capable constructs from untrusted data while preserving safe formatting.
  • Avoid using nodeIntegration:true in Electron renderer processes that handle untrusted or semi-trusted content, or isolate such content in views without Node.js access.
  • Enforce clear trust boundaries around synced workspaces by treating all synchronized data as potentially hostile and processing it through the same secure rendering path.
  • Adopt a secure-by-default rendering API that requires explicit opt-in for allowing rich HTML, rather than interpolating arbitrary strings.

How teams detect issues like this

Organizations can identify similar vulnerabilities and misconfigurations through:

  • Static analysis rules that flag direct interpolation of untrusted variables into HTML strings or template literals, especially inside renderers or view-layer helpers.
  • Targeted reviews of UI code paths (e.g., functions like genAVValueHTML) where user data is transformed into HTML, checking for consistent use of escaping utilities such as html.EscapeAttrVal or equivalent.
  • Security reviews of Electron configuration, ensuring nodeIntegration is disabled or justified, and that renderer processes do not mix untrusted content with elevated capabilities.
  • Automated scanning using linters or security tools that recognize common XSS sinks (innerHTML, dangerouslySetInnerHTML, manual string concatenation in templates).
  • Policy enforcement in CI/CD pipelines that require secure rendering patterns and mandate code review for changes involving HTML generation, view rendering, or Electron security options.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-5xfx-xj4h-5p7r

Frequently asked

questions

It affects both, but the impact is more severe on Electron desktop clients with nodeIntegration:true, where XSS can escalate to remote code execution on the host via Node.js APIs.

An attacker needs the ability to write or modify AV files within a target workspace, such as via shared sync, compromised storage, or direct filesystem access; once planted, the payload triggers when a victim opens the affected block-attribute panel.

The safest pattern is to treat all cell values as untrusted, apply strict context-aware escaping or sanitization when rendering to HTML, and run renderers without Node.js integration so that any residual XSS cannot directly access the OS.

Consistently use standardized escaping utilities for all HTML generation, avoid manual string concatenation for UI templates, review Electron security options to minimize renderer privileges, and incorporate security-oriented code review and automated checks for XSS and nodeIntegration misuse into the development workflow.

Find out what's already
exploitable in your codebase.