CVE-2026-69084: SiYuan Unauthenticated Arbitrary SQL Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-vh22-h7hf-www7
CVSS 10.0
Published
Advisory Summary

CVE-2026-69084 is a CRITICAL (CVSS 10.0) unauthenticated arbitrary sql execution vulnerability (General Security Weakness) affecting SiYuan libraries in the Go ecosystem. The issue involves unauthenticated arbitrary sql execution via searchembedblock (publish mode) : reader-reachable raw statement on read-write handle, cross-notebook read/write. Remediation is available by upgrading affected packages to version 0.0.0-20260721002947-23a17d44b5f3.

CVE-2026-69084 at a Glance

CVE Identifier CVE-2026-69084
GHSA Identifier GHSA-vh22-h7hf-www7
Severity CRITICAL
CVSS v3.1 Base Score 10.0
CWE Classification General Security Weakness
Affected Product SiYuan
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 10.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-69084

To remediate this vulnerability, upgrade all affected SiYuan dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/siyuan-note/siyuan/kernel fixed: 0.0.0-20260721002947-23a17d44b5f3
Upgrade github.com/siyuan-note/siyuan/kernel to 0.0.0-20260721002947-23a17d44b5f3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/siyuan-note/siyuan/kernel

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-69084, inspect your project dependencies for SiYuan:

inspect dependencies for github.com/siyuan-note/siyuan/kernel

Analyze the terminal output to locate any version of SiYuan in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.0-20260721002947-23a17d44b5f3), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In SiYuan, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

**CVE:** This vulnerability corresponds to [CVE-2026-69084](https://nvd.nist.gov/vuln/detail/CVE-2026-69084). ### Summary The `/api/search/searchEmbedBlock` endpoint passes a client-supplied SQL statement verbatim to the database with no validation. The endpoint is gated by `CheckAuth` only reachable by the publish RoleReader token, and by the anonymous account when `Publish.Auth.Enable` is `false`. The statement runs on the main read-write `siyuan.db` handle through a driver that executes stacked statements, with no single-statement or read-only guard. An unauthenticated request can therefore execute arbitrary SQL reading and writing content across all cleartext notebooks. Unlike SQL injection into a fixed query, this endpoint accepts a full SQL statement by design and simply fails to restrict who may call it or what the statement may do. ### Details Data flow verbatim, unvalidated: - `searchEmbedBlock` (`kernel/api/search.go`): `stmt := arg["stmt"].(string)` passed directly to `model.SearchEmbedBlock(stmt, …)`. No validation. - `SearchEmbedBlock` → `SearchEmbedBlockInBox` → `sql.SelectBlocksRawStmtNoParse(stmt, …)` → `selectBlocksRawStmt` → `query(stmt)`. - `query()` (`kernel/sql/database.go`) calls `db.Query(stmt)` on the global `siyuan.db` handle. **Missing guards.** The comparable endpoints enforce restrictions this one omits: - `/api/query/sql` runs `CheckSingleStatement` (all modes) and `CheckReadonlyStatement` (readonly mode) and is route-gated `CheckAuth + CheckAdminRole + CheckReadonly`. - `fullTextSearchBlock` rejects the SQL search method for non-admins (`if method == 2 && !IsAdminRoleContext(c)`). `searchEmbedBlock` has none of these, no statement check, no read-only check, no admin gate. **Route/auth tier.** `router.go`: `Handle("POST", "/api/search/searchEmbedBlock", model.CheckAuth, searchEmbedBlock)`, `CheckAuth` only. `CheckAuth` admits `RoleReader`, and the publish proxy forwards port-6808 traffic with a Reader JWT (anonymous account when publish auth is disabled). Anonymous/reader reachable. **Handle/stacking.** `query()` uses the global `siyuan.db` handle, the same read-write handle behind the accepted `searchDocs` finding. Driver is the vendored `88250/go-sqlite3` (mattn fork), whose connection `query` loops over `;`-separated statements, so stacked statements execute for their side effects. The DSN sets no `mode=ro` / `_query_only`, so the handle is read-write; `ATTACH` is available. **Post-hoc filter does not bound the statement.** `FilterEmbedBlocksByPublishAccess` runs on the returned slice *after* `query()` has executed. It filters rows; it cannot constrain what the statement did. Any write or `ATTACH` side effect has already occurred before the filter runs. It is not a security boundary for this sink. **Scope.** The main `blocks`/DB handle spans every opened cleartext notebook. Encrypted notebooks use separate per-box databases and are excluded. ### Impact An unauthenticated request (publish mode with auth disabled) or any publish `RoleReader` executes arbitrary SQL on the main read-write database. This permits cross-notebook read disclosure of document content, and via the read-write handle and statement stacking, modification of database content and `ATTACH`-reachable files. No admin role, CSRF token, or write permission through the normal API is required. Encrypted notebooks are not exposed. Code execution is not reachable in the default build (no `load_extension`). ### PoC Steps 1. Build the kernel image from pinned HEAD `docker build -f D:/bb/zitadel/chatto/siyuan/Dockerfile.poc -t siyuan-head D:/bb/zitadel/chatto/siyuan` 2. Run fresh, workspace mounted to the host ``` docker rm -f siyuan-poc 2>nul docker run -d --name siyuan-poc -p 6806:6806 -p 6808:6808 -v D:/bb/siyuan:/siyuan/workspace siyuan-head serve --accessAuthCode=1234567 --port=6806 ``` Confirm it booted (version string back, not Cobra help): ``` docker logs siyuan-poc curl -s http://127.0.0.1:6806/api/system/version ``` 3. Grab the admin API token from the host file. Use that value wherever TOKEN appears below (yours was g4wj3r04ntobe9m4). 4. Turn on the reader surface: publish on 6808, Basic Auth OFF `curl -s -X POST http://127.0.0.1:6806/api/setting/setPublish -H "Content-Type: application/json" -H "Authorization: Token TOKEN" -d "{\"enable\":true,\"port\":6808,\"auth\":{\"enable\":false,\"accounts\":[]}}"` Must return "data":{"port":6808,...} (non-zero port = bound OK). Port 6808, not 6806. 5. THE PROOF: anonymous reader on 6808, no token (the differential) Guarded sibling rejects reader SQL: `curl -i -X POST http://127.0.0.1:6808/api/search/fullTextSearchBlock -H "Content-Type: application/json" -d "{\"query\":\"SELECT * FROM blocks LIMIT 1\",\"method\":2}"` → -1 / "SQL search requires administrator privileges" searchEmbedBlock accepts the same reader SQL (no guard): `curl -i -X POST http://127.0.0.1:6808/api/search/searchEmbedBlock -H "Content-Type: application/json" -d "{\"embedBlockID\":\"\",\"stmt\":\"SELECT * FROM blocks LIMIT 1\",\"excludeIDs\":[]}"` → HTTP 200 / code:0 : arbitrary SQL executed at the anonymous reader tier. This pair is the finding. ### Suggested fix Apply the same controls the sibling SQL endpoints already use: route `searchEmbedBlock` through `CheckSingleStatement` and `CheckReadonlyStatement`, and gate the raw-SQL capability behind `CheckAdminRole` (as `/api/query/sql` and `fullTextSearchBlock`'s SQL method do). At minimum, the read paths should run on a `_query_only=1` handle so a reader-reachable statement cannot write or `ATTACH`.

CVE-2026-69084 Affected SiYuan Versions

1 component(s)
Fixed Versions:
0.0.0-20260721002947-23a17d44b5f3
Product / Package Ecosystem Affected Versions Fixed Version
github.com/siyuan-note/siyuan/kernel
Go
< 0.0.0-20260721002947-23a17d44b5f3
0.0.0-20260721002947-23a17d44b5f3

References

Frequently Asked Questions

What is CVE-2026-69084?
CVE-2026-69084 is a security vulnerability in SiYuan involving Unauthenticated arbitrary SQL execution via searchEmbedBlock (publish mode) : reader-reachable raw statement on read-write handle, cross-notebook read/write under General Security Weakness.
Which SiYuan versions are affected?
Affected versions include releases prior to 0.0.0-20260721002947-23a17d44b5f3 across affected packages: github.com/siyuan-note/siyuan/kernel.
What version fixes CVE-2026-69084?
Upgrading to 0.0.0-20260721002947-23a17d44b5f3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/siyuan-note/siyuan/kernel affected?
Yes, github.com/siyuan-note/siyuan/kernel is affected in releases prior to 0.0.0-20260721002947-23a17d44b5f3. Upgrade your dependency to 0.0.0-20260721002947-23a17d44b5f3 or later.
What is the CVSS score of CVE-2026-69084?
CVE-2026-69084 has a CVSS v3.1 base score of 10.0 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2026-69084?
CVE-2026-69084 is classified under General Security Weakness.
How can I check Go dependencies for CVE-2026-69084?
Run the dependency tree command: 'inspect dependencies for github.com/siyuan-note/siyuan/kernel'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vh22-h7hf-www7",
  "modified" : "2026-09-03T20:19:22Z",
  "published" : "2026-09-03T20:19:22Z",
  "aliases" : [ "CVE-2026-69084" ],
  "summary" : "SiYuan: Unauthenticated arbitrary SQL execution via searchEmbedBlock (publish mode) : reader-reachable raw statement on read-write handle, cross-notebook read/write",
  "details" : "**CVE:** This vulnerability corresponds to [CVE-2026-69084](https://nvd.nist.gov/vuln/detail/CVE-2026-69084).\n\n### Summary\n\nThe `/api/search/searchEmbedBlock` endpoint passes a client-supplied SQL statement verbatim to the database with no validation. The endpoint is gated by `CheckAuth` only reachable by the publish RoleReader token, and by the anonymous account when `Publish.Auth.Enable` is `false`. The statement runs on the main read-write `siyuan.db` handle through a driver that executes stacked statements, with no single-statement or read-only guard. An unauthenticated request can therefore execute arbitrary SQL reading and writing content across all cleartext notebooks.\n\nUnlike SQL injection into a fixed query, this endpoint accepts a full SQL statement by design and simply fails to restrict who may call it or what the statement may do.\n\n### Details\n\nData flow verbatim, unvalidated:\n\n- `searchEmbedBlock` (`kernel/api/search.go`): `stmt := arg[\"stmt\"].(string)` passed directly to `model.SearchEmbedBlock(stmt, …)`. No validation.\n- `SearchEmbedBlock` → `SearchEmbedBlockInBox` → `sql.SelectBlocksRawStmtNoParse(stmt, …)` → `selectBlocksRawStmt` → `query(stmt)`.\n- `query()` (`kernel/sql/database.go`) calls `db.Query(stmt)` on the global `siyuan.db` handle.\n\n**Missing guards.** The comparable endpoints enforce restrictions this one omits:\n- `/api/query/sql` runs `CheckSingleStatement` (all modes) and `CheckReadonlyStatement` (readonly mode) and is route-gated `CheckAuth + CheckAdminRole + CheckReadonly`.\n- `fullTextSearchBlock` rejects the SQL search method for non-admins (`if method == 2 && !IsAdminRoleContext(c)`).\n\n`searchEmbedBlock` has none of these, no statement check, no read-only check, no admin gate.\n\n**Route/auth tier.** `router.go`: `Handle(\"POST\", \"/api/search/searchEmbedBlock\", model.CheckAuth, searchEmbedBlock)`, `CheckAuth` only. `CheckAuth` admits `RoleReader`, and the publish proxy forwards port-6808 traffic with a Reader JWT (anonymous account when publish auth is disabled). Anonymous/reader reachable.\n\n**Handle/stacking.** `query()` uses the global `siyuan.db` handle, the same read-write handle behind the accepted `searchDocs` finding. Driver is the vendored `88250/go-sqlite3` (mattn fork), whose connection `query` loops over `;`-separated statements, so stacked statements execute for their side effects. The DSN sets no `mode=ro` / `_query_only`, so the handle is read-write; `ATTACH` is available.\n\n**Post-hoc filter does not bound the statement.** `FilterEmbedBlocksByPublishAccess` runs on the returned slice *after* `query()` has executed. It filters rows; it cannot constrain what the statement did. Any write or `ATTACH` side effect has already occurred before the filter runs. It is not a security boundary for this sink.\n\n**Scope.** The main `blocks`/DB handle spans every opened cleartext notebook. Encrypted notebooks use separate per-box databases and are excluded.\n\n### Impact\n\nAn unauthenticated request (publish mode with auth disabled) or any publish `RoleReader` executes arbitrary SQL on the main read-write database. This permits cross-notebook read disclosure of document content, and via the read-write handle and statement stacking, modification of database content and `ATTACH`-reachable files. No admin role, CSRF token, or write permission through the normal API is required. Encrypted notebooks are not exposed. Code execution is not reachable in the default build (no `load_extension`).\n\n### PoC Steps\n\n1. Build the kernel image from pinned HEAD\n\n`docker build -f D:/bb/zitadel/chatto/siyuan/Dockerfile.poc -t siyuan-head D:/bb/zitadel/chatto/siyuan`\n\n2. Run fresh, workspace mounted to the host\n\n```\ndocker rm -f siyuan-poc 2>nul\ndocker run -d --name siyuan-poc -p 6806:6806 -p 6808:6808 -v D:/bb/siyuan:/siyuan/workspace siyuan-head serve --accessAuthCode=1234567 --port=6806\n```\n\nConfirm it booted (version string back, not Cobra help):\n\n```\ndocker logs siyuan-poc\ncurl -s http://127.0.0.1:6806/api/system/version\n```\n\n3. Grab the admin API token from the host file. Use that value wherever TOKEN appears below (yours was g4wj3r04ntobe9m4).\n\n4. Turn on the reader surface: publish on 6808, Basic Auth OFF\n\n`curl -s -X POST http://127.0.0.1:6806/api/setting/setPublish -H \"Content-Type: application/json\" -H \"Authorization: Token TOKEN\" -d \"{\\\"enable\\\":true,\\\"port\\\":6808,\\\"auth\\\":{\\\"enable\\\":false,\\\"accounts\\\":[]}}\"`\n\nMust return \"data\":{\"port\":6808,...} (non-zero port = bound OK). Port 6808, not 6806.\n\n5. THE PROOF: anonymous reader on 6808, no token (the differential)\n\nGuarded sibling rejects reader SQL:\n`curl -i -X POST http://127.0.0.1:6808/api/search/fullTextSearchBlock -H \"Content-Type: application/json\" -d \"{\\\"query\\\":\\\"SELECT * FROM blocks LIMIT 1\\\",\\\"method\\\":2}\"`\n\n→ -1 / \"SQL search requires administrator privileges\"\n\nsearchEmbedBlock accepts the same reader SQL (no guard):\n`curl -i -X POST http://127.0.0.1:6808/api/search/searchEmbedBlock -H \"Content-Type: application/json\" -d \"{\\\"embedBlockID\\\":\\\"\\\",\\\"stmt\\\":\\\"SELECT * FROM blocks LIMIT 1\\\",\\\"excludeIDs\\\":[]}\"`\n→ HTTP 200 / code:0 : arbitrary SQL executed at the anonymous reader tier. This pair is the finding.\n\n### Suggested fix\n\nApply the same controls the sibling SQL endpoints already use: route `searchEmbedBlock` through `CheckSingleStatement` and `CheckReadonlyStatement`, and gate the raw-SQL capability behind `CheckAdminRole` (as `/api/query/sql` and `fullTextSearchBlock`'s SQL method do). At minimum, the read paths should run on a `_query_only=1` handle so a reader-reachable statement cannot write or `ATTACH`.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/siyuan-note/siyuan/kernel"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.0-20260721002947-23a17d44b5f3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/siyuan-note/siyuan/security/advisories/GHSA-vh22-h7hf-www7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-69084"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/siyuan-note/siyuan/commit/0015cbafbf685363b217bbc46283a3c0f51c79fa"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/siyuan-note/siyuan/commit/23a17d44b5f3da59c85e7fbee11236e6c12386b9"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/siyuan-note/siyuan"
  }, {
    "type" : "WEB",
    "url" : "https://www.vulncheck.com/advisories/siyuan-before-sql-injection-via-searchembedblock"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-09-03T20:19:22Z",
    "nvd_published_at" : null
  }
}