Skip to content

SiYuan kernel publish-mode security batch

Summary

On September 3, 2026, GitHub Security Advisories published a coordinated 20-advisory batch against the SiYuan kernel (github.com/siyuan-note/siyuan), a popular open-source, local-first knowledge base / note-taking application. The batch discloses 3 critical (CVSS 10.0) unauthenticated SQL-execution flaws reachable in publish mode, 9 high, and 8 medium flaws, all stemming from a systemic failure to enforce SiYuan's publish/reader access boundary and, in three cases, from passing client-supplied SQL directly to a read-write database handle with no single-statement or read-only guard. All 20 are fixed in the v3.8.3-alpha.1 release line (hardening commits dated 2026-07-21 through 2026-07-23; the first_patched_version for the criticals is the pre-release kernel build 0.0.0-20260721004815-cf42dd5680c8 and siblings).

The durable defender lesson: a knowledge-base "publish mode" is a read surface, but this implementation made it effectively read-write. When a product exposes an HTTP API where the "reader" token is gated only by CheckAuth (authentication) rather than a per-data authorization check, every data-returning endpoint becomes a candidate for cross-boundary disclosure, and the moment one endpoint accepts a raw SQL statement rather than a parameterized query, the boundary collapses into arbitrary read/write against the entire cleartext workspace.

Why this matters

  • SiYuan is widely self-hosted as a personal/team knowledge base, and "publish mode" is its primary way to share a notebook with readers over the network. An exposed SiYuan instance is a realistic internet attack surface, and the two most severe classes here require no credentials when Publish.Auth.Enable is false (the default for many self-hosted setups).
  • Unauthenticated SQL execution on a read-write handle is not merely "SQL injection": the endpoints accept a full SQL statement by design and simply fail to restrict who may call them. An attacker can read and write across all cleartext notebooks, spanning the cross-notebook asset-content store.
  • The localhost-trust admin bypass (CVE-2026-72809, 8.0) is the second-order amplifier: the kernel grants RoleAdministrator to any request whose RemoteAddr is loopback on a set of endpoints, and the fixed-port reverse proxy forwards to the kernel over loopback with no auth token and no SetTrustedProxies, so a proxy bound to a network interface can remote the bypass.
  • Second-order / supply-chain vector (CVE-2026-72807, 8.0): attribute-view template columns are live-evaluated on render and expose a queryBlocks function that runs raw SQL. An attacker can ship a maliciously crafted SiYuan document or AV package that executes arbitrary SQL when a victim imports it, a document-delivery primitive, not just a remote one.

Operational characteristics

  • Affected component: SiYuan kernel (Go), github.com/siyuan-note/siyuan/kernel, the HTTP API service, its search/attribute-view/backlink endpoints, the fixed-port reverse proxy, and the encrypted-notebook key material.
  • Exploit status: no public PoC, in-the-wild exploitation, or actor attribution reported in the reviewed advisories. This is a disclosure/publish batch; treat it as a patch-now, not a hunt-now, item until exploitation telemetry appears.
  • CVSS / severity breakdown (20 GHSAs):
  • Critical 10.0 (3): CVE-2026-69083 (unauthenticated SQL execution + REGEXP injection via fullTextSearchAssetContent, publish mode), CVE-2026-69084 (unauthenticated arbitrary SQL execution via searchEmbedBlock, publish mode), CVE-2026-72811 (SQL injection in backlink/mention search via unescaped stored + client input, publish mode).
  • High (9): CVE-2026-72804 (8.6, graph endpoints omit publish-password tier), CVE-2026-72810 (8.6, publish-boundary bypass via WebSocket live broadcast), CVE-2026-68584 (8.6, anonymous publish-password auth bypass via getHeading*), CVE-2026-68586 (8.6, cross-boundary content disclosure via getBacklinkDoc/getBackmentionDoc), CVE-2026-68587 (8.6, full-content disclosure of publish-disabled docs via getHeading*Transaction), CVE-2026-72807 (8.0, second-order SSTI→SQL via AV template queryBlocks), CVE-2026-72809 (8.0, localhost-trust admin bypass via fixed-port proxy), CVE-2026-69086 (7.7, path traversal via unvalidated avID in AV read endpoints), CVE-2026-72801 (7.5, encrypted-notebook key-derivation + wrapped keys disclosed to anonymous readers).
  • Medium (8): CVE-2026-72812 (6.5, refreshBacklink missing authorization), CVE-2026-72800/72803/72805/72806/72808/68585 (5.8, various missing publish-access filters disclosing schema/block attributes/breadcrumbs/annotations/metadata), CVE-2026-72802 (5.3, filesystem path + OS username disclosure via resolveAssetPath).
  • Fixed versions: kernel builds from 2026-07-21 to 2026-07-23; available in the v3.8.3-alpha.1 release (published 2026-09-03) and the v3.8.2 → v3.8.3 line. vulnerable_version_range is expressed as a Go pseudo-version < 0.0.0-20260721004815-cf42dd5680c8 (and siblings), i.e. anything before those hardening commits.
  • Public attribution: none in the reviewed advisories. No actor, campaign, or malware linkage. Keep attribution unset unless a primary source publishes follow-up.

Defender heuristics

  • Inventory SiYuan instances (self-hosted knowledge bases / note servers) and confirm the kernel build. If you are on any build prior to the v3.8.3 hardening commits, upgrade to v3.8.3-alpha.1 or later, the criticals require no credentials when publish auth is disabled.
  • Do not expose the kernel to the open internet. If publish mode must be reachable, set Publish.Auth.Enable to true (so the anonymous account is off) and enforce the publish-password tier; the high-severity disclosure flaws (CVE-2026-72804/68584/68586/68587) are specifically about the anonymous reader bypassing the password tier.
  • Treat "accepts a raw SQL statement" as a design smell. Any endpoint that takes a full SQL string and runs it on a read-write handle is an arbitrary-data read/write primitive regardless of how it is gated. Audit for this pattern when triaging similar "publish"/"share"/"preview" APIs.
  • Watch for the second-order import vector (CVE-2026-72807). A shared/forwarded SiYuan document or attribute-view package with a malicious .action{queryBlocks "..."} template column is a delivery mechanism; treat unexpected imports of AV packages as potentially hostile.
  • Check the fixed-port proxy (CVE-2026-72809). If the SiYuan fixed-port reverse proxy is bound to a non-loopback interface, confirm it is not forwarding to the kernel without an auth token and that SetTrustedProxies is configured; otherwise the loopback admin bypass is remotely reachable.
  • Encrypted notebooks are only as strong as their key-disclosure surface (CVE-2026-72801). The Argon2id salt/cost, a password verifier, and the wrapped per-notebook key can be retrieved by an anonymous reader on unpatched builds, reducing every encrypted notebook to an offline-crack problem, rotate the master password and notebook keys after patching if the instance was reachable.
  • Hunt for unauthorized SQL writes across cleartext notebooks (unexpected block mutations, pg_authid-style tampering analogs in the SiYuan .db), anomalous fullTextSearchAssetContent / searchEmbedBlock requests, and import events of AV packages around any disclosure window.

October 1, 2026 follow-up: a second GHSA batch lands, fourth unauthenticated SQL-execution critical (searchDocs) on the same unpatched class

On October 1, 2026 (14:38-16:29 UTC), GitHub Security Advisories published a second SiYuan kernel batch: seven advisories, continuing the September 3 disclosure line against the same publish-mode boundary collapse:

  • GHSA-33jq-p8c2-q3q4 / CVE-2026-69085 (critical): /api/filetree/searchDocs concatenates the caller-supplied keyword k directly into LIKE literals, no escaping, no bind placeholder, at every hop (searchDocs → SearchDocs → NAMFilter → QueryRootBlockByCondition), and the statement runs on a read-write SQLite handle through a driver that executes stacked (;-separated) statements against the global blocks table spanning all cleartext notebooks. Gated only by CheckAuth, i.e. unauthenticated when Publish.Auth.Enable is false (the share-link default). Cross-notebook read AND write from one HTTP request. Fixed at kernel pseudo-version 0.0.0-20260721043339-eef10568384e.
  • Six medium/high disclosure additions: GHSA-hgfg-j9pg-43xw / CVE-2026-72788 (admin's open documents + search terms disclosed to anonymous readers), GHSA-53fp-9jmv-227g / CVE-2026-73607 (outline state of reader-forbidden documents), GHSA-hf8h-97gm-4x2p / CVE-2026-73605 (unvalidated client path in getUniqueFilename), GHSA-j4ph-9xwf-wcj4 / CVE-2026-73609 (every bookmark label to anonymous readers), GHSA-9cqf-hhrq-7v45 (attribute-view search rows to anonymous readers, no CVE at check), GHSA-vg99-7gj7-2fr5 / CVE-2026-73606 (getRefIDs checks visibility but not the password tier).

Durable reads: 1. The September batch's diagnosis was incomplete, not fixed-wrong. searchDocs is the FOURTH unauthenticated SQL-execution endpoint found in the same API surface (after fullTextSearchAssetContent, searchEmbedBlock, backlink/mention search), and its advisory text confirms the string-concatenation pattern repeats across the search layer. When one endpoint of a family takes raw SQL, audit the whole family. 2. Fix-date continuity: this batch's patch pseudo-version is also dated 2026-07-21 (0.0.0-20260721043339-…), the same hardening window as the September batch. These advisories are being written against the July commits, meaning the vendor's own boundary review is still producing findings weeks after patching. Expect more batches; v3.8.3-alpha.1-era builds remain the floor, and the line is still moving. 3. Registry-lag datapoint: at this wiki's Oct 1 check, GHSA-33jq-p8c2-q3q4 carries no OSV alias (OSV MAL stream high-water still MAL-2026-17420) and no CVE-side NVD record yet, OSV-keyed and NVD-keyed consumers are blind to a critical unauth SQLi that GHSA/Dependabot users can see. Watch both feeds (standing rule on-wiki).

Still no public PoC, no in-the-wild exploitation report, no actor attribution for either batch. Patch posture unchanged: v3.8.3-alpha.1 or later + Publish.Auth.Enable=true + no open-internet kernel exposure, and treat any build predating the 2026-07-21 hardening commits as fully exposed across now four unauthenticated SQL-execution endpoints.

October 2, 2026 follow-up: a third batch lands, GHSA-4vpg-gwqq-w44c / CVE-2026-74904: seventeen of twenty-eight /api/block/* handlers have ZERO publish-access checks (CWE-862), found by an automated access-check-presence sweep

On October 2, 2026 (23:05:33 UTC) GitHub published GHSA-4vpg-gwqq-w44c / CVE-2026-74904 (high, CVSS 3.1 7.5 AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N, CWE-862 + CWE-204), the third consecutive advisory batch on this disclosure line. Scope: github.com/siyuan-note/siyuan/kernel < 0.0.0-20260804015139-bd067a4fe9b2 (patched at that pseudo-version).

Finding: an automated bulk sweep of every /api/block/* handler in kernel/api/block.go for the literal presence of ANY access-check reference (IsReadOnlyRoleContext, checkBlockPublishAccess, GetPublishAccess) found 17 of 28 candidate handlers with none, gated only by model.CheckAuth, no admin-role requirement, no publish-access check in the handler or the model functions they call. Sibling functions in the SAME file (getBlockInfo, getBlockDOM, getRefIDs) correctly implement the guard, proving an uneven gap, not a design choice. Worst endpoint: getRefText (POST /api/block/getRefText) returns the block's actual reference-display text, derived from its real content, for ANY block ID workspace-wide, with no session, no AccessAuthCode, no publish password. Plus existence oracles (checkBlockExist/checkBlocksExist/checkBlockRef), breadcrumbs/title paths (getBlockBreadcrumb), word counts, tree stats, sibling/ancestor resolution, 14 named disclosure endpoints in the advisory's table.

Why it matters: 1. The combination is the attack: the advisory itself pairs this with the companion batch's getIDsByHPath title-guessing primitive, title-guess → existence-oracle confirmation → getRefText content retrieval = efficiently enumerate and read PRIVATE (never-published / Disable=true) content on any published SiYuan workspace, anonymously, no credentials. 2. Method over finding: this batch was produced by grepping for the ABSENCE of an access-check token across one file, the same technique the reviewer used across prior files. The advisory explicitly recommends the maintainers run the inverse sweep over EVERY /api/* handler instead of fixing endpoint-by-endpoint, since the pattern has now recurred across three separate files. Expect a fourth batch until they do. 3. Patch-window drift continues: first two batches were written against the 2026-07-21 hardening commits; this one's fix pseudo-version is dated 2026-08-04 (0.0.0-20260804015139-bd067a4fe9b2), the boundary review is now two hardening windows deep, still producing findings. Build floor moves from the July window to the August 4 commit for the block-API surface. 4. Registry-lag note: unlike the Oct 1 batch, OSV imports GHSA-4vpg-gwqq-w44c at this wiki's check (~23:15 UTC), but an OSV version query at the patched pseudo-version returned no match, so OSV-keyed coverage of the Go pseudo-version grammar remains unverified.

Zero PoC, zero ITW, zero attribution, unchanged across all three batches. Patch posture: builds at/after 2026-08-04 commit bd067a4fe9b2 + Publish.Auth.Enable=true + no open-internet kernel exposure; self-hosted instances predating it are exposed across four unauth SQL-execution endpoints AND seventeen unchecked block endpoints.

October 3, 2026 follow-up: a fourth batch lands within ~30 minutes of the third, and it moves the fight to the MCP/agent-tool surface: DNS-rebinding TOCTOU bypassing the vendor's own SSRF guard, asset.upload arbitrary-path read, and an explicit CheckOrigin: true CSWSH

Between 22:46 and 23:17 UTC on October 2, while this wiki's fifty-second sweep was still open, GitHub published three more SiYuan kernel advisories, arriving ~30 minutes after GHSA-4vpg-gwqq-w44c and immediately validating the third batch's own recommendation to audit every handler rather than fix endpoint-by-endpoint. All three import into OSV at this wiki's Oct 3 ~01:30 UTC check.

  • GHSA-x8gv-g2g3-65fj (high), Agent Tools SSRF via DNS-rebinding TOCTOU (bypass of CheckHostSSRF). Disclosed by joysinleung, reported 2026-08-13. Affected <= 3.8.0, fixed at kernel pseudo-version 0.0.0-20260813142806-dd2778b70d02 (release 3.8.1). Components: kernel/util/httprequest.go (CheckHostSSRF), kernel/mcp/tools/http_request.go, kernel/util/webfetch.go, kernel/util/net.go (SSRFSafeDialer). Mechanism: the SSRF validation and the actual fetch resolve the hostname at different moments, so an attacker-controlled domain with a short-TTL record answers the validation lookup with a safe IP and the fetch lookup with an internal one, the classic rebinding TOCTOU, defeating BOTH the URL-screening function and the safe-dialer. The advisory self-labels an incomplete-fix variant of GHSA-rg26-cg95-gq6p (the earlier SSRF remediation), the vendor fixed the main vector, the reviewer found the residual. Reachable through the MCP/agent http_request tool under both SafeMode on and off; the advisory itself frames the trigger as prompt-injecting an AI Agent/MCP client into fetching an attacker domain.
  • GHSA-p23f-cm6q-2qp8 (medium), MCP asset.upload reads arbitrary absolute file paths (workspace boundary bypass). Same reporter/report date. kernel/mcp/tools/asset.go (assetUpload) → kernel/model/upload.go (InsertLocalAssets): the workspace-boundary check is entirely absent, so once the (category-level, user-clickable) confirmation is approved the tool copies ANY absolute path on the host into the workspace. Labeled a residual of CVE-2026-66012 (GHSA-cvhv-7xhj-xjp8) MCP remediation. Fixed 0.0.0-20260813142104-b26a4a307b8a.
  • GHSA-3cc2-h3v6-rqpq / CVE-2026-74802 (low-tagged, advisory header states High), Cross-Site WebSocket Hijacking on /ws/network/proxy. The admin-only WebSocket forward-proxy endpoint (target URL and headers fully query-parameter-specifiable = an authenticated network pivot through the kernel process) sets websocket.Upgrader{CheckOrigin: func(...) bool { return true }} at kernel/api/network.go:501, an EXPLICIT override that disables the origin validation gorilla/websocket enforces by default. WS handshakes are not subject to CORS preflight, so any victim's browser page can drive the proxy. Fixed 0.0.0-20260803045322-cb67e0b4fab5.

Durable reads: 1. The remaining SiYuan bugs are agent-surface bugs. Batches 1-3 were the publish-mode HTTP API; batch 4 is entirely MCP/agent-tool boundary gaps (SSRF-guard bypass, arbitrary path read) plus the proxy pivot. This is the same "agent tool = new privileged proxy" class this wiki tracks on the Unit 42 AgentCore heap-exfil pattern page and the exposed-MCP-server line, a documentation/note app's MCP surface inherits every classic web flaw class plus prompt-injection as the delivery rail. 2. Incomplete-fix advisories are now the genre. Two of three batch-4 advisories explicitly name the earlier GHSA they residual. The reviewer is auditing the vendor's FIXES, not just the code, expect fix-residual findings to keep landing as long as that audit continues, across files not yet touched. 3. Patch windows now THREE deep: fix pseudo-versions date to 2026-07-21 (batches 1-2), 2026-08-04 (batch 3), 2026-08-13 (batch 4). The build floor for an agent/MCP-enabled instance is now the 2026-08-13 commit dd2778b70d02 (release 3.8.1), not the July or August-4 windows. 4. One-line hunt for the wider ecosystem: grep any Go/gorilla/websocket codebase for CheckOrigin returning true, an explicit true-override is deliberate and almost always wrong on an auth-gated endpoint.

Zero PoC, zero ITW, zero attribution, unchanged across all four batches. Patch posture moves to 3.8.1 / builds at/after the 2026-08-13 commits for any instance with publish mode or the Agent/MCP surface enabled.

October 5, 2026 follow-up: a fifth batch lands, the guard's own blocklist is the bug: TLS private keys (conf/key.pem, conf/ca.key) readable by any authenticated user via getFile, and the history/repo-diff routes leak guarded files THROUGH THEIR OWN SNAPSHOTS

Two more kernel advisories published 2026-10-05 17:32:44/48Z, first appearance on the GHSA global recently-published feed since Oct 2 (this wiki's feed-frozen watch thaws on this batch). Both target the IsForbiddenAbsPath() centralized guard introduced by GHSA-c8r8-95hg-mp34, i.e. the reviewer is now auditing the blocklist itself.

  • GHSA-4wwp-f6gw-6qm5 (medium, CWE-552), TLS private keys readable via getFile (incomplete blocklist). IsForbiddenAbsPath() blocks conf/conf.json by EXACT match; the TLS private key conf/key.pem and CA private key conf/ca.key live in the SAME conf/ directory and are absent from the list. kernel/api/file.go:497 skips the blocklist for RoleAdministrator, and in v3.8.1 every authenticated user receives RoleAdministrator (no non-admin role is issued to direct API consumers), on a default no-auth-code instance the PoC in the advisory is a POST /api/file/getFile with body {"path": "/conf/key.pem"} returning raw PEM private-key bytes, no token required. The key material is generated on EVERY boot regardless of whether TLS is active. Fixed 0.0.0-20260819144130-256d73aa7f94. Durable read: exact-match file blocklists are a denylist-on-allowlist-surface, the fix class is path-confinement to data/ + an explicit key-material deny-glob, and the deeper flaw is the all-users-are-admin role model.
  • GHSA-3cm4-ccvw-6xr6 (medium, CVSS 4.9, CWE-200 + CWE-862), /history/*path + /repo/diff/*path expose historical snapshots of guarded files. The centralized guard was applied to file.go and mcp/tools/file.go; two OTHER routes that serve arbitrary files by path construct targets independently and never call it. Worse, the snapshot roots legitimately track data/, so a PRIOR version of data/.siyuan/publishAccess.json (plaintext publish-mode passwords) or data/templates/* sitting in util.HistoryDir/repo-diff checkout is reachable even after the live file is protected, a fix-residual via snapshot scope: protecting a path today doesn't protect yesterday's copy. Fixed 0.0.0-20260816034002-035bf9a8c311.

Durable reads: (1) the incomplete-fix genre continues its fourth-batch prediction, batches now audit the GUARD, not just the handlers, and the snapshot-scope finding is a class every app with a history/versioning subsystem should grep for (guard at read-path ≠ guard at snapshot-path); (2) fix pseudo-versions now span FOUR windows (Jul 21, Aug 4, Aug 13, Aug 16 + Aug 19 commits), build floor moves to 0.0.0-20260819144130-256d73aa7f94 (Aug 19); (3) self-hosted exposure note for defenders: if your SiYuan kernel port was ever reachable, the Oct-5 pair means assume TLS key + CA key + any historical publishAccess password compromise, not just data read, rotate keys and publish passwords alongside patching.

Zero PoC, zero ITW, zero attribution, unchanged across all five batches.

Sources

Tags