Summary
SiYuan: Missing consistency check between packageName and repoURL/repoHash in bazaar package install allows overwriting an existing, trusted plugin
installBazaarPlugin (and the equivalent endpoints for widgets/icons/templates/themes) acceptpackageName, 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:
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:
func getPackageInstallPath(pkgType, packageName string) (string, string, error) {
case "plugins":
return filepath.Join(util.DataDir, "plugins", packageName), "plugin.json", nil
kernel/bazaar/install.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 fromrepoURL/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 sharegetPackageInstallPath.
This does not involve path traversal, installPath always resolves insideDataDir/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:
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:
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 likelocalhost.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 bybatchUpdatePackage), 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.
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/push_reload.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.
Impact
CVE-2026-62204 has a CVSS score of 6.6 (Medium). The vector is requires local access, low privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (0.0.0-20260808010544-26ccb40d390e); upgrading removes the vulnerable code path.
Affected versions
Security releases
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
Verify that packageName matches the package name declared in the downloaded package's ownplugin.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).
Frequently Asked Questions
- What is CVE-2026-62204? CVE-2026-62204 is a medium-severity security vulnerability in github.com/siyuan-note/siyuan/kernel (go), affecting versions < 0.0.0-20260808010544-26ccb40d390e. It is fixed in 0.0.0-20260808010544-26ccb40d390e.
- How severe is CVE-2026-62204? CVE-2026-62204 has a CVSS score of 6.6 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of github.com/siyuan-note/siyuan/kernel are affected by CVE-2026-62204? github.com/siyuan-note/siyuan/kernel (go) versions < 0.0.0-20260808010544-26ccb40d390e is affected.
- Is there a fix for CVE-2026-62204? Yes. CVE-2026-62204 is fixed in 0.0.0-20260808010544-26ccb40d390e. Upgrade to this version or later.
- Is CVE-2026-62204 exploitable, and should I be worried? Whether CVE-2026-62204 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
- What actually determines whether CVE-2026-62204 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.
- How do I fix CVE-2026-62204? Upgrade
github.com/siyuan-note/siyuan/kernelto 0.0.0-20260808010544-26ccb40d390e or later.