/

CVE-2026-56397

Severity:

CRITICAL RISK

(9.6)

Stored XSS (CWE-79) in SiYuan Bazaar Marketplace UI

CVE-2026-56397

Deferred

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Remote Code Execution via Stored XSS

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

A stored cross-site scripting (XSS) issue in the SiYuan Bazaar marketplace allows malicious package metadata and README content to inject arbitrary HTML and JavaScript into the Electron-based UI.

When users browse malicious packages, attacker-controlled scripts can run with nodeIntegration enabled, potentially leading to remote code execution on their systems.

Affected context

This vulnerability appears in the SiYuan Bazaar marketplace interface, where package metadata (such as displayName and description) and README content are rendered inside an Electron application.

The risk emerges when user-supplied HTML or markdown is rendered without proper escaping or sanitization and is displayed in contexts that allow script execution while Electron's nodeIntegration remains enabled.

Any user who opens or previews a malicious package entry in the Bazaar is potentially exposed to attacker-controlled JavaScript.

Exploit preconditions

  • Attack surface: Bazaar marketplace views within the SiYuan Electron client
  • Required access: Ability to publish or update a package entry (or compromise a package feed) with crafted metadata or README content
  • Trigger point: A victim user browsing or viewing details of the malicious package in the Bazaar UI
  • Why exploitation is possible: Package fields are rendered as HTML/markdown without robust sanitization or output encoding, and the Electron environment allows injected JavaScript to access Node APIs due to nodeIntegration, elevating a typical XSS into desktop-level code execution.

Why this happens

The root cause is improper neutralization of user-controlled content before it is rendered in a web-like context, consistent with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting).

Package metadata and README fields are treated as trusted display content and are inserted into the UI without sufficient HTML/JavaScript sanitization or contextual encoding.

In an Electron environment with nodeIntegration enabled, this insecure pattern allows injected scripts not only to execute in the renderer but also to interact with OS-level capabilities through Node APIs, transforming a classic stored XSS into a remote code execution primitive.

Potential impact

  • Compromise of the SiYuan desktop application session for affected users
  • Execution of arbitrary OS commands on the victim's machine via Node APIs
  • Theft or modification of user data managed within the SiYuan environment
  • Installation of additional malware or backdoors on the host system
  • Use of compromised clients as a foothold for broader lateral movement

General mitigation guidance

Effective mitigation centers on reducing trust in display content and limiting renderer privileges.

Common defensive patterns include:

  • Applying strict HTML sanitization and context-aware output encoding to all user-supplied or marketplace-sourced fields before rendering
  • Rendering untrusted content in a fully isolated context (e.g., sandboxed iframes or dedicated views without privileged bindings)
  • Disabling or minimizing nodeIntegration and other high-privilege renderer features, favoring secure IPC channels for required functionality
  • Introducing a well-defined content policy that restricts scripts, inline event handlers, and dangerous HTML constructs in marketplace content
  • Enforcing least-privilege principles so that even if display content is compromised, access to sensitive APIs and file system operations is constrained

How teams detect issues like this

Detection efforts can focus on both code and behavior.

From a code perspective:

  • Static analysis rules can flag direct insertion of user-controlled strings into HTML, innerHTML, dangerouslySetInnerHTML, or templating constructs without sanitization or encoding.
  • Reviews can specifically look for uses of nodeIntegration, preload scripts, and unguarded access to Node APIs from renderer contexts that display remote or marketplace content.
  • Security-focused code review checklists can mandate explicit sanitization steps when rendering markdown or HTML from external sources.

From an operational perspective:

  • Instrumentation and logging around marketplace content rendering can help detect anomalous script execution patterns or unexpected IPC calls originating from UI components.
  • Automated scanning of marketplace submissions for obvious XSS patterns can serve as a supplemental control, though it should not replace defensive coding.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-v3mg-9v85-fcm7
vulncheck.comvulncheck.com/advisories/siyuan-remote-code-execution-via-malicious-bazaar-package-metadata-and-readme-2

Frequently asked

questions

Yes. An attacker who can publish or alter Bazaar packages can craft payloads that execute when a user simply browses the malicious package in the SiYuan client, without additional interaction.

The attacker typically needs the ability to submit or modify package metadata or README content in the Bazaar ecosystem, or to intercept and inject content into that supply chain. End users only need to open the affected marketplace view for exploitation to occur.

The most robust fix combines strong HTML/markdown sanitization for all untrusted content, strict context-aware output encoding, and architectural changes to remove or strictly limit nodeIntegration and other privileged renderer capabilities when displaying marketplace data.

Future prevention depends on treating all external or user-provided content as untrusted, applying a default-deny approach to script execution, formalizing secure patterns for rendering content in Electron (e.g., sandboxed renderers plus IPC), and incorporating static analysis and security reviews focused on XSS and renderer-privilege boundaries into the development lifecycle.

Find out what's already
exploitable in your codebase.