CVE-2026-62204: SiYuan: Missing consistency check between packageName and repoURL/repoHash in bazaar package install allows overwriting an existing, trusted plugin

Published Aug 22, 2026
·
Updated

Summary

installBazaarPlugin (and the equivalent endpoints for widgets/icons/templates/themes) accept packageName, repoURL, and repoHash as independent request fields with no validation that they refer to the same package. packageName alone determines the install destination; repoURL/repoHash alone determine what content gets downloaded and written there. A request can name an already-installed, already-enabled plugin as packageName while pointing repoURL/ repoHash at different, attacker-influenced content, silently overwriting the existing plugin's files.

Affected code

kernel/api/bazaar.go: go util.BindJsonArg("packageName", &packageName, true, true) util.BindJsonArg("repoURL", &repoURL, true, true) util.BindJsonArg("repoHash", &repoHash, true, true) err := model.InstallBazaarPackage("plugins", repoURL, repoHash, packageName, 0)

kernel/model/bazaar.go: go func getPackageInstallPath(pkgType, packageName string) (string, string, error) { case "plugins": return filepath.Join(util.DataDir, "plugins", packageName), "plugin.json", nil

kernel/bazaar/install.go: go func installPackage(data []byte, installPath string) (err error) { ... if err = filelock.Copy(srcPath, installPath); err != nil { return } return }

installPath is derived solely from packageName; the downloaded data is derived solely from repoURL/repoHash; nothing cross-validates them, and installPackage performs no check for whether installPath already contains an existing package before copying into it. The same pattern applies to the widget/icon/template/theme install endpoints, which share getPackageInstallPath.

This does not involve path traversal — installPath always resolves inside DataDir/plugins/ (or the corresponding directory for other package types), so this is not an instance of "arbitrary file write outside the workspace path" (excluded by this project's SECURITY.md). The issue is that the write lands in the wrong, existing location within the intended directory, not outside it — an authorization/identity-verification gap, not a path traversal.

Reachability / why this is not trivially remote

The bazaar endpoints are gated by model.CheckAuth, model.CheckAdminRole, model.CheckReadonly. When no lock-screen password is configured (the common desktop default), CheckAuth still enforces a same-origin check: go if !localhost || ... || ("" != origin && !util.IsLocalOrigin(origin)) || ... { // reject with 401 } I verified IsLocalOrigin/IsLocalHostname correctly parse the Origin header via url.Parse and check exact hostname / loopback IP: go func IsLocalOrigin(origin string) bool { if u, err := url.Parse(origin); err == nil { return IsLocalHostname(u.Hostname()) } return false } func IsLocalHostname(hostname string) bool { if "localhost" == hostname || strings.HasSuffix(hostname, ".localhost") { return true } if ip := net.ParseIP(hostname); nil != ip { return ip.IsLoopback() } return false } This was tested against common bypass patterns (subdomain-suffix tricks like localhost.attacker.com, and Origin: null as sent by sandboxed iframes) and found no bypass — this is a correctly-implemented check. This means a purely remote attacker (e.g. a malicious website) cannot invoke this endpoint via CSRF; a request must originate from SiYuan's own renderer origin.

Realistic impact

Given SiYuan runs as an Electron app with nodeIntegration: true (per prior advisories in this repository), a same-origin script-execution primitive (e.g. an XSS bug in the renderer, of which several have been fixed in this repository recently) is typically already sufficient for direct code execution. This bug's marginal value is persistence: a transient XSS-driven compromise can use this endpoint to overwrite an existing, trusted, already-enabled plugin's index.js, converting a one-time compromise into code that runs on every future launch of the application, surviving after the original XSS vector is closed.

The overwrite does not effect immediately, via this specific endpoint. PushReloadPlugin (the websocket event that triggers frontend hot-reload without restart) is only called from the batch-update path (InstallBazaarPackages, used by batchUpdatePackage), which explicitly checks if petal != nil && petal.Enabled before forcing a reload via SetPetalEnabled. The single-package install endpoint (installBazaarPlugin) does not call PushReloadPlugin at all — it only pushes a generic success toast. So an overwrite via this endpoint activates on the next app restart or manual plugin toggle, rather than instantly still a realistic and frequent event for a desktop application, but not an instant hot-reload.

Suggested fix

Verify that packageName matches the package name declared in the downloaded package's own plugin.json/theme.json/etc. before copying into installPath, and/or refuse to install over an existing, non-empty destination directory unless the request is explicitly an update of that same package (matching by source repo identity, not just by request-supplied name).

Verification notes

Confirmed via static source review of kernel/api/bazaar.go, kernel/model/bazaar.go, kernel/bazaar/install.go, kernel/model/session.go (CheckAuth), kernel/util/net.go (IsLocalOrigin/IsLocalHostname), and kernel/model/pushreload.go / app/src/plugin/loader.ts (reload trigger wiring). I do not have a running SiYuan instance in this environment to execute an end-to-end proof of concept; findings are based on tracing the actual, unmodified control flow across these files rather than assumption.

Other sources

SiYuan versions before v3.7.4 fail to validate that packageName matches the downloaded package content in bazaar install endpoints. Attackers with same-origin access can overwrite existing trusted plugins by supplying mismatched packageName and repoURL parameters, achieving persistence across application restarts.

— MITRE

SiYuan: Missing consistency check between packageName and repoURL/repoHash in bazaar package install allows overwriting an existing, trusted plugin in github.com/siyuan-note/siyuan/kernel

— OSV

Affected Software

2 affected componentsFixes available
SiYuan SiYuan<v3.7.4
go/github.com/siyuan-note/siyuan/kernel<0.0.0-20260808010544-26ccb40d390e
0.0.0-20260808010544-26ccb40d390e

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade go/github.com/siyuan-note/siyuan/kernel to a version that resolves this vulnerability.

    Fixed in 0.0.0-20260808010544-26ccb40d390e
  2. Upgrade

    Upgrade SiYuan to a version that resolves this vulnerability.

    Fixed in 3.7.4

Event History

Aug 22, 2026
CVE Published
via MITRE·12:26 PM
Data Sourced
via MITRE·12:26 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·01:16 PM
DescriptionSeverityWeakness
Oct 23, 2026
Advisory Published
via GitHub·06:38 PM
Data Sourced
via GitHub·06:38 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What access does an attacker need to exploit this issue?

The attacker needs same-origin access, low privileges, and user interaction. Exploitation also has high attack complexity and requires access to the bazaar install endpoints.

2

Which installations are affected?

SiYuan versions before v3.7.4 are affected. The issue concerns installations where the bazaar install functionality can be used to install packages.

3

What is the practical impact of successful exploitation?

An attacker can overwrite an existing trusted plugin by supplying mismatched packageName and repoURL parameters. The replaced plugin can persist across application restarts.

4

How can I tell whether I may already be affected?

Review installed trusted plugins for unexpected replacement or content changes, especially after bazaar installation activity. Check whether the SiYuan version is earlier than v3.7.4.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203