/

CVE-2026-100641

Severity:

HIGH RISK

(8.0)

Stored XSS (CWE-79) in SiYuan Card Manager Desktop

CVE-2026-100641

Deferred

Vulnerability type

Category:

Stored Cross-Site Scripting

CWE:

CWE-79

Impact:

Arbitrary Code Execution

Severity:

HIGH RISK

(8.0)

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 stores flashcard block content without HTML-escaping it before inserting that content into the card-manager interface. When an administrator opens the manager in the desktop application, attacker-controlled markup may execute in a privileged Electron renderer and could lead to arbitrary code execution on the host.

Affected context

The issue occurs in SiYuan desktop deployments where flashcard content from an authenticated workspace is interpolated into card-manager markup and assigned to innerHTML without context-appropriate escaping. Risk is present when untrusted content enters a workspace through mechanisms such as imports or contributions and an administrator later opens the card manager. The affected API remains protected by authentication and administrator-role checks, so this is not an authorization bypass.

Exploit preconditions

  • Attack surface: SiYuan desktop card-manager interface and its flashcard-content retrieval flow
  • Required access: Ability to introduce or influence flashcard block content in a workspace; an administrator must have access to the affected workspace
  • Trigger point: The administrator opens the card manager, causing returned card content to be inserted into the list markup
  • Why exploitation is possible: Untrusted content reaches innerHTML without HTML escaping, allowing browser-interpreted markup and event-handler attributes to execute
  • Privilege boundary: The desktop renderer uses Electron settings that expose Node.js integration and do not isolate the renderer context

Why this happens

The underlying bug is stored cross-site scripting caused by treating persisted user-controlled content as trusted HTML. Flashcard content is interpolated into a UI template and assigned to innerHTML rather than being inserted as text or sanitized according to a strict allowlist. This maps to CWE-79: Improper Neutralization of Input During Web Page Generation. In the desktop context, the resulting script execution is more severe because the renderer has privileged Electron capabilities.

Potential impact

  • Malicious script may execute when an administrator opens the card manager
  • The attacker could access data exposed to the privileged renderer
  • The vulnerability could enable arbitrary code execution on the host
  • Workspace content or application settings may be modified
  • The compromise could support further local persistence or lateral movement

General mitigation guidance

Mitigation generally focuses on ensuring that untrusted flashcard content cannot become executable markup and on reducing renderer privileges.

Common defensive patterns include:

  • Rendering untrusted values through text-node or framework-safe binding APIs instead of innerHTML
  • Applying context-aware output encoding and narrowly scoped sanitization where formatted content is required
  • Enforcing a strict allowlist for permitted markup and removing event-handler attributes and executable URL schemes
  • Treating imported and contributed workspace content as untrusted at every rendering boundary
  • Disabling Node.js integration and enabling context isolation for Electron renderer windows where feasible
  • Separating privileged operations behind narrowly scoped, authenticated preload APIs
  • Applying least privilege to desktop application capabilities and sensitive filesystem access

How teams detect issues like this

High-level detection can combine:

  • Static analysis for template interpolation followed by innerHTML, insertAdjacentHTML, or equivalent HTML sinks
  • Code review checks for missing output encoding at UI rendering boundaries
  • Tests using inert HTML markers to verify that imported or contributed content is rendered as text rather than interpreted markup
  • Policy enforcement requiring safe DOM construction APIs or approved sanitization libraries
  • Electron configuration checks for Node.js integration, context isolation, and unrestricted renderer capabilities
  • Runtime monitoring for unexpected renderer process behavior or access to sensitive host resources

Automated security review tools may help identify dangerous HTML sinks and insecure Electron settings, but findings should be validated against actual data flow.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/commit/1ecb1c07de497ff03b585536fe5579291754d96b
github.comgithub.com/siyuan-note/siyuan/commit/41b14025b4ac4a8379d1200580344ca18ad152b7
github.comgithub.com/siyuan-note/siyuan/commit/48c354e7de130aaada9d7120125bbc768344fd3b
github.comgithub.com/siyuan-note/siyuan/commit/8641553a1f07374001902d3ce773285db1292b2d
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-2mmf-4xwm-55rm
vulncheck.comvulncheck.com/advisories/siyuan-before-3.8.4-stored-xss-via-unescaped-flashcard-content

Frequently asked

questions

It is not an unauthenticated remote exploit by itself. Exploitation generally requires attacker-controlled flashcard content to reach a workspace and an administrator to open the card manager in the desktop application.

No. The affected card-retrieval endpoint remains behind authentication and administrator-role checks. The issue crosses a trust boundary from untrusted stored content into a privileged renderer.

Render untrusted content as text by default, or use tightly controlled, context-aware sanitization for intentionally supported formatting. The privileged Electron renderer should also be hardened with isolated contexts and minimal capabilities.

Treat imported and contributed content as untrusted, prohibit unsafe HTML sinks in review and CI policies, test rendering boundaries with adversarial markup, and continuously audit Electron security settings.

Find out what's already
exploitable in your codebase.