CVE-2026-72807: SiYuan Second-order SSTI To Arbitrary SQL Vulnerability
HIGHCVE-2026-72807 is a HIGH (CVSS 8.0) second-order ssti to arbitrary sql vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting SiYuan libraries in the Go ecosystem. The issue involves second-order ssti to arbitrary sql via attribute-view template column (queryblocks): malicious imported package executes sql on victim kernel. Remediation is available by upgrading affected packages to version 0.0.0-20260723035036-0a176345e02a.
CVE-2026-72807 at a Glance
Security Impact
CVSS: 8.0
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:R/S:C/C:H/I:H/A:N).
How to Fix CVE-2026-72807
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.
Upgrade github.com/siyuan-note/siyuan/kernel to 0.0.0-20260723035036-0a176345e02a
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-72807, 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-20260723035036-0a176345e02a), 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-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. 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-2026-72807 Affected SiYuan Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/siyuan-note/siyuan/kernel
|
Go |
< 0.0.0-20260723035036-0a176345e02a
|
0.0.0-20260723035036-0a176345e02a
|
References
Frequently Asked Questions
What is CVE-2026-72807?
Which SiYuan versions are affected?
What version fixes CVE-2026-72807?
Is github.com/siyuan-note/siyuan/kernel affected?
What is the CVSS score of CVE-2026-72807?
What CWE is associated with CVE-2026-72807?
How can I check Go dependencies for CVE-2026-72807?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-x67c-8pwr-m8g3",
"modified" : "2026-09-03T22:49:31Z",
"published" : "2026-09-03T22:49:30Z",
"aliases" : [ "CVE-2026-72807" ],
"summary" : "SiYuan: Second-order SSTI to arbitrary SQL via attribute-view template column (queryBlocks): malicious imported package executes SQL on victim kernel",
"details" : "**CVE:** This vulnerability corresponds to [CVE-2026-72807](https://nvd.nist.gov/vuln/detail/CVE-2026-72807).\n\n### Summary\n\nAttribute-view (AV) template columns are live-evaluated on every render and expose the `queryBlocks` template function, which runs raw SQL on the read-write database handle (`SelectBlocksRawStmt`, using `?`→argument string substitution rather than parameter binding). AV mutations are admin-gated, so this is not directly reader-injectable but it is a second-order vector: an attacker distributes a SiYuan document or AV package whose template column contains `.action{queryBlocks \"<arbitrary SQL>\"}` when a victim imports the package and renders the AV, the attacker's SQL executes on the victim's kernel (read and, via statement stacking, write).\n\n### Details\n\nDoc-level `{{…}}` templates are rendered at insert-time and become static, so they are not re-evaluated on reader view. The residual is AV template columns, which are live-evaluated at render. `queryBlocks` passes its argument to `SelectBlocksRawStmt` with `?`→arg string substitution, not a bound parameter, on the main read-write handle (`88250/go-sqlite3` fork, statement-stacking capable) so an attacker-controlled template argument becomes arbitrary SQL.\n\nThe SSTI surface is otherwise hardened: `BuiltInTemplateFuncs` deletes `env`, `expandenv`, and `getHostByName` so there is no environment/host/file/exec SSTI. `queryBlocks`-to-SQL is the remaining live-evaluated sink.\n\n### Proof of Concept\n\nAn AV template column set to `.action{queryBlocks \"<sql>\"}` executes `<sql>` against the read-write handle when the AV is rendered. Delivered second-order: a shared/imported document or AV package carrying such a column runs the embedded SQL on any kernel that imports and renders it.\n\n### Proof of Concept\n\nReproduced on a live instance.\n\n**1. Host doc + AV (admin, 6806):**\n```\nPOST /api/filetree/createDocWithMd {notebook, path:\"/ssti-poc\", markdown:\"host\"} → DOC\nPOST /api/av/renderAttributeView {id:\"<AV>\"} # materializes the AV\n```\n\n**2. Plant the malicious template column (one performTransactions call):**\n```json\n{\"reqId\":1,\"session\":\"poc\",\"transactions\":[{\"doOperations\":[\n {\"action\":\"addAttrViewCol\",\"avID\":\"<AV>\",\"id\":\"<COL>\",\"name\":\"tpl\",\"type\":\"template\"},\n {\"action\":\"updateAttrViewColTemplate\",\"avID\":\"<AV>\",\"id\":\"<COL>\",\"type\":\"template\",\n \"data\":\".action{range queryBlocks \\\"SELECT * FROM blocks WHERE root_id='<PROTECTED_DOC_ID>'\\\"}.action{.Markdown} .action{end}\"},\n {\"action\":\"insertAttrViewBlock\",\"avID\":\"<AV>\",\"isDetached\":true}\n]}]}\n```\n\n**3. Trigger (render evaluates the template):**\n```\nPOST /api/av/renderAttributeView {id:\"<AV>\"}\n```\nResult: the template cell renders `## LockedSection TOP_SECRET…` the `queryBlocks` SQL executed and returned the password-protected document's content, arbitrary SQL via template reading across the publish/password boundary. `queryBlocks` uses `?`→arg string substitution (not parameterized), so UNION and stacked writes are also possible. Delivered second-order, the same column executes on any kernel that imports and renders the AV.\n\n### Impact\n\nAn attacker who gets a victim to import a crafted document/AV package and render it achieves arbitrary SQL execution on the victim's kernel cross-notebook read and via stacking, write. Precondition is content delivery plus render (import of an attacker-supplied package), which bounds severity to Medium. Not directly reachable by an anonymous reader (AV creation is admin-gated); the injection travels in stored/imported template content.\n\n### Suggested fix\n\nParameterize `queryBlocks` bind the argument rather than substituting it into the SQL string or restrict the template function set available in AV columns as was done for the doc-template functions. Treat imported template content as untrusted at render time.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/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-20260723035036-0a176345e02a"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/siyuan-note/siyuan/security/advisories/GHSA-x67c-8pwr-m8g3"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-72807"
}, {
"type" : "WEB",
"url" : "https://github.com/siyuan-note/siyuan/commit/0a176345e02a0d19bdc7762e50e0b92002087d20"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/siyuan-note/siyuan"
}, {
"type" : "WEB",
"url" : "https://www.vulncheck.com/advisories/siyuan-before-sql-injection-via-queryblocks-template"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1336", "CWE-89" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-09-03T22:49:30Z",
"nvd_published_at" : null
}
}