/

CVE-2026-33067

Severity:

CRITICAL RISK

(9.0)

XSS in SiYuan Bazaar Package Metadata Leading to RCE

CVE-2026-33067

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Remote Code Execution via Stored Cross-Site Scripting

Severity:

CRITICAL RISK

(9.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 versions 3.6.0 and below render unescaped package metadata (displayName, description) in the Bazaar marketplace, allowing malicious packages to inject arbitrary HTML and JavaScript.

In the vulnerable Electron configuration (nodeIntegration: true, contextIsolation: false), this cross-site scripting flaw escalates to full remote code execution on the user's operating system when they simply open the Bazaar page.

Affected context

The vulnerability appears in SiYuan's built-in Bazaar marketplace UI where package metadata is rendered into HTML views.

It becomes relevant when:

  • SiYuan is running as an Electron desktop application with nodeIntegration enabled and contextIsolation disabled
  • Bazaar content is loaded that includes untrusted metadata from third-party packages
  • The application interpolates these metadata fields directly into the DOM using template literals without HTML escaping or sanitization

Any user who opens the Bazaar page in affected versions is exposed to scripts embedded in malicious package metadata.

Exploit preconditions

  • Attack surface: SiYuan Bazaar marketplace interface in the Electron client
  • Required access: Ability to publish or influence package metadata (displayName, description) that will be visible in the Bazaar; or control of a registry/source feeding these fields
  • Victim interaction: The victim only needs to open or refresh the Bazaar tab; no clicks or confirmations are required
  • Trigger point: Rendering of package metadata into HTML via template literals without escaping
  • Why exploitation is possible: Untrusted text is treated as HTML/JS in a privileged Electron renderer process where nodeIntegration is enabled and contextIsolation is disabled, so injected scripts gain access to Node.js and OS APIs.

Why this happens

This issue stems from directly interpolating untrusted metadata fields into HTML templates without escaping or sanitization, a classic pattern of CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting).

The Bazaar view builds DOM content using template literals, embedding package displayName and description as raw HTML.

In a browser-like environment without proper output encoding, attackers can smuggle <script> tags, event handlers, or other active content that executes when the DOM is rendered.

Because SiYuan's Electron configuration exposes Node.js in the renderer process and lacks isolation boundaries, the XSS is not confined to the UI but effectively becomes a code execution primitive on the host system.

Potential impact

  • Execution of arbitrary JavaScript in the SiYuan renderer process
  • Escalation from XSS to arbitrary OS-level command execution via Node.js APIs
  • Installation of additional malware or persistence mechanisms on the victim machine
  • Theft or modification of local SiYuan data and notes
  • Exfiltration of local files accessible to the Electron app
  • Use of the compromised host as a pivot for broader network compromise

General mitigation guidance

Effective mitigation generally focuses on output encoding, content sanitization, and reducing renderer privileges:

  • Apply strict HTML escaping or context-appropriate output encoding to all untrusted metadata fields before inserting them into the DOM.
  • Use a robust, well-maintained HTML sanitization library when rich text is truly needed, limiting or stripping active content (scripts, event handlers, inline JS).
  • Prefer safe DOM construction APIs (e.g., textContent, innerText, or programmatic element creation) rather than string-based HTML templating for untrusted data.
  • In Electron, configure the application for defense in depth by disabling nodeIntegration in renderer processes and enabling contextIsolation, using preload scripts and IPC to mediate privileged operations.
  • Treat external marketplace/registry data as untrusted by default, with validation and normalization layers between data retrieval and UI rendering.

How teams detect issues like this

Organizations can look for this class of issue using both automated and manual techniques:

  • Static analysis: Rules that flag direct insertion of variables into HTML via template literals (innerHTML, outerHTML, or similar sinks) without prior escaping or sanitization; Electron-specific checks for XSS sinks in renderers with nodeIntegration: true.
  • Code review: Security-focused reviews of UI components that render marketplace or plugin metadata, with attention to any bypass of templating engines that normally escape content.
  • Policy enforcement: Internal guidelines that prohibit raw HTML rendering of untrusted data and require security-conscious Electron configuration (no Node.js in untrusted views).
  • Dynamic testing: Automated or manual tests that inject benign XSS payload markers into package metadata fields and verify whether they execute when displayed in the Bazaar interface.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-mvpm-v6q4-m2pf

Frequently asked

questions

Yes. If an attacker can publish or influence a package listed in the Bazaar, they can deliver malicious metadata to any user that opens the marketplace tab, leading to remote code execution on those users' machines.

No local access is required beyond the ability to supply malicious package metadata. From the victim's side, simply opening or refreshing the Bazaar page in an affected version is enough to trigger the exploit; no additional clicks are necessary.

Ensure all untrusted metadata is properly escaped or sanitized before rendering, and adjust the Electron security model so that untrusted UI surfaces do not have direct access to Node.js or the operating system. Isolate privileged logic behind controlled IPC channels.

Adopt a standard output-encoding strategy for all UI components, enforce security-focused Electron defaults (nodeIntegration disabled, contextIsolation enabled), and integrate security review or automated checks into the development and publishing process for marketplace features and plugin ecosystems.

Find out what's already
exploitable in your codebase.