/

CVE-2026-45375

Severity:

CRITICAL RISK

(9.0)

XSS in SiYuan Bazaar Marketplace Package Metadata

CVE-2026-45375

Deferred

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79, CWE-116

Impact:

Stored Cross-Site Scripting leading to arbitrary script execution in the SiYuan UI context

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's Bazaar marketplace rendered unescaped Name and Version fields from plugin, theme, template, widget, and icon metadata directly into the Settings → Marketplace UI.

Malicious HTML in those fields could be executed in the user's browser when viewing the marketplace tab, enabling stored cross-site scripting in the application context.

Affected context

The vulnerability affects SiYuan installations that:

  • Use the built-in Bazaar (community marketplace) feature
  • Load package metadata from plugin.json, theme.json, template.json, widget.json, or icon.json
  • Render marketplace entries in Settings → Marketplace using innerHTML

In this flow, the backend only HTML-escapes Author, DisplayName, and Description, while Name and Version are passed through as-is and interpolated into HTML template strings on the frontend.

Exploit preconditions

  • Attack surface: SiYuan Marketplace UI rendered in the user's browser.
  • Required access: Ability to publish or influence package metadata (e.g., Name or Version fields) that the Bazaar consumes; any compromised distribution channel for these JSON files may suffice.
  • User interaction: A user must open or refresh the Settings → Marketplace tab so that the vulnerable entries are rendered.
  • Trigger point: The frontend substitutes unescaped Name/Version into template strings and assigns them to innerHTML, causing embedded HTML/JavaScript to be parsed and executed.
  • Why exploitation is possible: Inputs that control HTML content are not properly escaped or encoded before being placed in an HTML context, violating output encoding requirements for untrusted data.

Why this happens

The core issue is incomplete output encoding of untrusted data rendered into HTML.

On the backend, sanitizePackageDisplayStrings escapes Author, DisplayName, and Description but omits Name and Version, leaving those fields raw. On the frontend, the Bazaar code in app/src/config/bazaar.ts interpolates these raw fields into template literals (e.g., ${item.preferredName}, ${data.name}, v${data.version}) and assigns the resulting string directly to innerHTML. This combination matches CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting), and is related to CWE-116: Improper Encoding or Escaping of Output.

Abstractly, the insecure pattern is:

  • Trusting metadata fields as display-only text
  • Failing to apply context-aware output encoding (HTML-escaping) for all untrusted fields
  • Injecting those fields into HTML using innerHTML instead of safer, text-only DOM APIs.

Potential impact

  • Execution of arbitrary JavaScript in the context of the SiYuan desktop or web UI.
  • Theft or manipulation of in-app data accessible via the UI and its APIs.
  • Unauthorized actions performed on behalf of the user within SiYuan (e.g., configuration changes, content modifications).
  • Installation of additional malicious marketplace entries or alteration of marketplace views.
  • Pivot to other attacks if the SiYuan environment exposes tokens, local files, or privileged integration endpoints to the UI.

General mitigation guidance

Effective mitigation centers on enforcing strict output encoding and safe rendering patterns for all marketplace metadata:

  • Apply context-appropriate HTML escaping to every untrusted text field rendered in the marketplace, including Name and Version.
  • Avoid innerHTML for dynamic content that originates from untrusted or semi-trusted sources; instead, use textContent, DOM APIs, or templating systems that encode output by default.
  • Centralize sanitization in a single helper that consistently covers all displayable fields, reducing the chance of omissions when new fields are added.
  • Treat package metadata as untrusted input regardless of its apparent origin, and enforce a clear contract between backend sanitization and frontend rendering.
  • Consider a "safe-by-default" UI layer where any raw HTML injection requires explicit opt-in and justification.

How teams detect issues like this

Organizations can detect similar issues through a combination of review and automation:

  • Static analysis: Configure rules that flag assignments to innerHTML, outerHTML, or similar sinks when they include dynamic data, especially from external JSON or network responses.
  • Code review: During frontend and API reviews, verify that all fields derived from package metadata or other remote sources are passed through an appropriate escaping or sanitization function before being rendered.
  • Security testing: Perform focused XSS testing on marketplace-like views by injecting benign HTML/JavaScript in metadata fields in a staging environment to validate that they are rendered as text, not executed.
  • Policy enforcement: Introduce coding guidelines that mandate context-aware output encoding and prefer safe DOM manipulation APIs over raw HTML string concatenation, enforced via linters or pre-commit hooks.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-27qc-m5gf-jv5r

Frequently asked

questions

Yes, if an attacker can get malicious metadata into the Bazaar feed or any package source that SiYuan loads. Once that data is present, any user who opens the marketplace tab in their client may trigger script execution.

They need the ability to publish or tamper with package metadata consumed by the Bazaar (for example, by controlling a package entry or compromising a distribution channel). End users do not need elevated privileges; simply viewing the marketplace is enough.

Ensure that all untrusted fields (including Name and Version) are correctly HTML-escaped before rendering and replace innerHTML-based rendering with APIs that treat values as text by default. A single, consistently used sanitization routine for marketplace display strings helps avoid gaps.

Adopt a security model where all external metadata is considered untrusted, enforce context-aware output encoding in the UI, and use automated checks to flag unsafe sinks like innerHTML. Complement this with secure coding guidelines and regular security-focused reviews of user- and metadata-driven UI components.

Find out what's already
exploitable in your codebase.