SiYuan: Unauthenticated SQL injection in searchDocs via unescaped keyword (publish mode): cross-notebook read/write with statement stacking
### Summary The `/api/filetree/searchDocs` endpoint concatenates the caller-supplied search keyword directly into a SQL statement with no escaping and no parameter binding. 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 resulting 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. An unauthenticated request can therefore read and write database content across every non-encrypted notebook on the instance. ### Details Data flow, unescaped and unbound at every hop: - `searchDocs` (`kernel/api/filetree.go`): `k := arg["k"].(string)` passed straight to `model.SearchDocs(k, …)`, no sanitization. - `SearchDocs` (`kernel/model/file.go`): after `TrimSpace` and `strings.Fields`, each token is spliced into a single-quoted `LIKE` literal by concatenation `condition.WriteString("(hpath LIKE '%" + k + "%'")`. No escaping, no `''` doubling, no bind placeholder. - `NAMFilter` (`kernel/conf/search.go`): appends `" OR name LIKE '%" + keyword + "%'"` (and `alias`, `memo`) the same way, enabled by default. - `QueryRootBlockByCondition` (`kernel/sql/block_query.go`): `"SELECT *, … FROM blocks WHERE type = 'd' AND " + condition + " ORDER BY … LIMIT …"` passed to `query(sqlStmt)`. The only value-inspecting guard is `ast.IsNodeIDPattern(keyword)`, which merely route
- Products
- github.com/siyuan-note/siyuan/kernel
- Affected versions
- Not specified
- Fixed versions
- 0.0.0-20260721043339-eef10568384e
- CVEs
- CVE-2026-69085
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 28 Oct 2026, 08:46 UTC · Revision 1
Source evidence
SiYuan: Unauthenticated SQL injection in searchDocs via unescaped keyword (publish mode): cross-notebook read/write with statement stacking
core-osv · Original sourcePublished 1 Oct 2026, 14:38 UTC
### Summary The `/api/filetree/searchDocs` endpoint concatenates the caller-supplied search keyword directly into a SQL statement with no escaping and no parameter binding. 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 resulting 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. An unauthenticated request can therefore read and write database content across every non-encrypted notebook on the instance. ### Details Data flow, unescaped and unbound at every hop: - `searchDocs` (`kernel/api/filetree.go`): `k := arg["k"].(string)` passed straight to `model.SearchDocs(k, …)`, no sanitization. - `SearchDocs` (`kernel/model/file.go`): after `TrimSpace` and `strings.Fields`, each token is spliced into a single-quoted `LIKE` literal by concatenation `condition.WriteString("(hpath LIKE '%" + k + "%'")`. No escaping, no `''` doubling, no bind placeholder. - `NAMFilter` (`kernel/conf/search.go`): appends `" OR name LIKE '%" + keyword + "%'"` (and `alias`, `memo`) the same way, enabled by default. - `QueryRootBlockByCondition` (`kernel/sql/block_query.go`): `"SELECT *, … FROM blocks WHERE type = 'd' AND " + condition + " ORDER BY … LIMIT …"` passed to `query(sqlStmt)`. The only value-inspecting guard is `ast.IsNodeIDPattern(keyword)`, which merely route
osv:GHSA-33jq-p8c2-q3q4
github.com/siyuan-note/siyuan/kernel
Fixed versions: 0.0.0-20260721043339-eef10568384e
Complete source record
{
"id": "a600794940e4b909d05ac30fcb151bca60b9e70e056224ff22a93b45087da0fd",
"url": "https://osv.dev/vulnerability/GHSA-33jq-p8c2-q3q4",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "SiYuan: Unauthenticated SQL injection in searchDocs via unescaped keyword (publish mode): cross-notebook read/write with statement stacking",
"summary": "### Summary The `/api/filetree/searchDocs` endpoint concatenates the caller-supplied search keyword directly into a SQL statement with no escaping and no parameter binding. 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 resulting 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. An unauthenticated request can therefore read and write database content across every non-encrypted notebook on the instance. ### Details Data flow, unescaped and unbound at every hop: - `searchDocs` (`kernel/api/filetree.go`): `k := arg[\"k\"].(string)` passed straight to `model.SearchDocs(k, …)`, no sanitization. - `SearchDocs` (`kernel/model/file.go`): after `TrimSpace` and `strings.Fields`, each token is spliced into a single-quoted `LIKE` literal by concatenation `condition.WriteString(\"(hpath LIKE '%\" + k + \"%'\")`. No escaping, no `''` doubling, no bind placeholder. - `NAMFilter` (`kernel/conf/search.go`): appends `\" OR name LIKE '%\" + keyword + \"%'\"` (and `alias`, `memo`) the same way, enabled by default. - `QueryRootBlockByCondition` (`kernel/sql/block_query.go`): `\"SELECT *, … FROM blocks WHERE type = 'd' AND \" + condition + \" ORDER BY … LIMIT …\"` passed to `query(sqlStmt)`. The only value-inspecting guard is `ast.IsNodeIDPattern(keyword)`, which merely route",
"evidence": "osv:GHSA-33jq-p8c2-q3q4",
"products": [
{
"name": {
"value": "github.com/siyuan-note/siyuan/kernel",
"evidence": "/affected/0/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "0.0.0-20260721043339-eef10568384e",
"evidence": "/affected/0/ranges"
}
],
"affected_versions": []
}
],
"severity": "critical",
"structured": {
"id": "GHSA-33jq-p8c2-q3q4",
"aliases": [
"CVE-2026-69085",
"GHSA-33jq-p8c2-q3q4",
"GO-2026-6621"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N"
}
],
"affected": [
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "0"
},
{
"fixed": "0.0.0-20260721043339-eef10568384e"
}
]
}
],
"package": {
"name": "github.com/siyuan-note/siyuan/kernel",
"purl": "pkg:golang/github.com/siyuan-note/siyuan/kernel",
"ecosystem": "Go"
},
"database_specific": {
"source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-33jq-p8c2-q3q4/GHSA-33jq-p8c2-q3q4.json"
}
}
],
"modified": "2026-10-07T17:55:40.796181279Z",
"provider": "osv",
"references": [
"https://github.com/siyuan-note/siyuan/security/advisories/GHSA-33jq-p8c2-q3q4",
"https://nvd.nist.gov/vuln/detail/CVE-2026-69085",
"https://github.com/siyuan-note/siyuan",
"https://github.com/siyuan-note/siyuan/releases/tag/v3.7.3",
"https://www.vulncheck.com/advisories/siyuan-before-sql-injection-via-searchdocs"
],
"provider_metadata": {
"cwe_ids": [
"CWE-89"
],
"severity": "CRITICAL",
"github_reviewed": true,
"nvd_published_at": null,
"github_reviewed_at": "2026-10-01T14:38:48Z"
}
},
"related_cves": [
{
"value": "CVE-2026-69085",
"evidence": "/aliases"
}
],
"security_relevant": true,
"severity_evidence": "/database_specific/severity"
},
"source_id": "core-osv",
"document_id": 97119,
"published_at": "2026-10-01T14:38:48+00:00"
}SiYuan: Unauthenticated SQL injection in searchDocs via unescaped keyword (publish mode): cross-notebook read/write with statement stacking in github.com/siyuan-note/siyuan/kernel
core-osv · Original sourcePublished 7 Oct 2026, 14:09 UTC
SiYuan: Unauthenticated SQL injection in searchDocs via unescaped keyword (publish mode): cross-notebook read/write with statement stacking in github.com/siyuan-note/siyuan/kernel
osv:GO-2026-6621
github.com/siyuan-note/siyuan/kernel
Fixed versions: 0.0.0-20260721043339-eef10568384e
Complete source record
{
"id": "428f0d14b60d034b952eadfc6b6e03ff521cf218fb96cf68c8c63b8180911122",
"url": "https://osv.dev/vulnerability/GO-2026-6621",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "SiYuan: Unauthenticated SQL injection in searchDocs via unescaped keyword (publish mode): cross-notebook read/write with statement stacking in github.com/siyuan-note/siyuan/kernel",
"summary": "SiYuan: Unauthenticated SQL injection in searchDocs via unescaped keyword (publish mode): cross-notebook read/write with statement stacking in github.com/siyuan-note/siyuan/kernel",
"evidence": "osv:GO-2026-6621",
"products": [
{
"name": {
"value": "github.com/siyuan-note/siyuan/kernel",
"evidence": "/affected/0/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "0.0.0-20260721043339-eef10568384e",
"evidence": "/affected/0/ranges"
}
],
"affected_versions": []
}
],
"severity": "unknown",
"structured": {
"id": "GO-2026-6621",
"aliases": [
"CVE-2026-69085",
"GHSA-33jq-p8c2-q3q4",
"GO-2026-6621"
],
"affected": [
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "0"
},
{
"fixed": "0.0.0-20260721043339-eef10568384e"
}
]
}
],
"package": {
"name": "github.com/siyuan-note/siyuan/kernel",
"purl": "pkg:golang/github.com/siyuan-note/siyuan/kernel",
"ecosystem": "Go"
},
"database_specific": {
"source": "https://vuln.go.dev/ID/GO-2026-6621.json"
},
"ecosystem_specific": {}
}
],
"modified": "2026-10-07T17:45:14.315085106Z",
"provider": "osv",
"references": [
"https://github.com/siyuan-note/siyuan/security/advisories/GHSA-33jq-p8c2-q3q4",
"https://nvd.nist.gov/vuln/detail/CVE-2026-69085",
"https://github.com/siyuan-note/siyuan/releases/tag/v3.7.3",
"https://www.vulncheck.com/advisories/siyuan-before-sql-injection-via-searchdocs"
],
"provider_metadata": {
"url": "https://pkg.go.dev/vuln/GO-2026-6621",
"review_status": "UNREVIEWED"
}
},
"related_cves": [
{
"value": "CVE-2026-69085",
"evidence": "/aliases"
}
],
"security_relevant": true,
"severity_evidence": null
},
"source_id": "core-osv",
"document_id": 97113,
"published_at": "2026-10-07T14:09:59+00:00"
}