/

CVE-2026-100639

Severity:

HIGH RISK

(8.8)

DOM XSS (CWE-79) in SiYuan Gutter Button Component

CVE-2026-100639

Deferred

Vulnerability type

Category:

Cross-Site Scripting

CWE:

CWE-79

Impact:

DOM-Based Cross-Site Scripting and Potential Remote Code Execution

Severity:

HIGH RISK

(8.8)

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 improperly escapes an attribute in generated gutter-button markup when processing specially crafted Markdown pasted as plain text. If the resulting control receives focus, injected script may execute, and the Electron desktop application's renderer privileges can increase the impact to JavaScript execution and remote code execution.

Affected context

The vulnerability occurs in SiYuan's Protyle gutter-button rendering path when Markdown supplied through plain-text paste is processed by the shared Lute renderer. It becomes risky when attacker-controlled inline attribute data reaches dynamically generated HTML without adequate attribute escaping, particularly in the Electron desktop application where renderer security boundaries are weakened.

Exploit preconditions

  • Attack surface: Markdown paste handling and client-side gutter-button rendering
  • Required access: Ability to provide or cause a victim to paste crafted Markdown content
  • Trigger point: Browser reparsing of dynamically assigned gutter markup, followed by focus reaching the affected control
  • Why exploitation is possible: User-controlled attribute content is inserted into HTML without context-appropriate escaping, allowing markup injection and event-handler execution
  • Impact dependency: Electron deployments with Node integration enabled and context isolation disabled may expose additional renderer capabilities

Why this happens

The underlying bug is improper output encoding for an HTML attribute generated from parsed Markdown metadata. The application assigns constructed markup through innerHTML without ensuring that the data-subtype value remains confined to its intended attribute context.

This maps to CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), because attacker-influenced content is interpreted as active browser markup rather than inert data. The use of weakened Electron renderer isolation can amplify the consequences of successful script execution.

Potential impact

  • Arbitrary JavaScript execution in the affected renderer
  • Session or application data exposure
  • Actions performed with the victim's application privileges
  • Remote code execution in desktop deployments with accessible Node.js renderer privileges
  • Potential compromise of locally accessible files or connected services

General mitigation guidance

Mitigation generally focuses on preserving a strict separation between Markdown data and generated HTML.

Common defensive patterns include:

  • Apply context-aware HTML attribute encoding to every dynamic value
  • Prefer DOM APIs such as attribute setters over string-based innerHTML construction
  • Treat pasted Markdown and parsed inline attributes as untrusted input
  • Sanitize or restrict supported attribute names and values before rendering
  • Enable Electron context isolation and disable unnecessary Node integration in renderer windows
  • Enforce least privilege for renderer processes and exposed preload APIs
  • Use a restrictive Content Security Policy where compatible

These controls reduce both the likelihood of markup injection and the impact if a rendering flaw remains.

How teams detect issues like this

High-level detection can combine:

  • Static analysis rules for dynamic innerHTML assignments involving parsed or user-controlled data
  • Code review checks for missing HTML attribute encoding and unsafe template construction
  • Searches for Markdown, Kramdown, or inline-attribute values flowing into DOM sinks
  • Electron configuration checks for Node integration, context isolation, and preload exposure
  • Policy enforcement requiring approved sanitization or DOM construction APIs
  • Security tests that verify pasted untrusted content remains inert across focus and interaction events

Automated code review and taint-analysis tools can help identify data flows from paste or document input into browser HTML sinks.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-2cmm-9x9j-rvff
vulncheck.comvulncheck.com/advisories/siyuan-before-3.8.4-cross-site-scripting-via-kramdown-ial

Frequently asked

questions

Exploitation generally depends on getting crafted Markdown into a victim's SiYuan workspace, commonly through paste or another content-transfer path. It is not necessarily exploitable as a standalone network request.

The attacker needs a way to supply content that the victim processes and pastes or opens. The victim must also interact with or focus the affected gutter control for the injected handler to run.

Keep untrusted Markdown metadata as data: use context-aware attribute encoding or safe DOM APIs, validate allowed values, and avoid constructing HTML with string concatenation.

Combine output-encoding rules, sanitization, DOM-sink analysis, secure Electron isolation settings, least privilege, and regression tests covering pasted content and interactive controls.

Find out what's already
exploitable in your codebase.