SiYuan, SQL Injection, CVE-2026-72811 (Critical) -DC-Sep2026-2173

Listen to this Post

The backlink/mention search query in SiYuan’s kernel/model/backlink.go constructs a SQL MATCH statement by concatenating stored block metadata (, name, alias, anchor text) with a client-supplied keyword. The only escaping applied is to double-quote characters (“); single quotes (‘) are left untouched. This allows a single quote in either the client keyword or any stored document field to break out of the string literal and enter SQL context. The query is executed on the main read-write siyuan.db handle using a SQLite driver that supports statement stacking via semicolon separators, enabling arbitrary SQL execution. Two distinct attack vectors exist: first-order, where an anonymous reader (or publish RoleReader) injects via the keyword parameter directly—reachable on the publish surface when auth is disabled; and second-order, where a malicious document contains a single quote in its /name/alias, stored safely via parameterized inserts, but later concatenated into the backlink query when any kernel ingests that document (e.g., through sync, import, or opening a .sy.zip). The injection surface is unique to the backlink/mention MATCH path; other query paths either parameterize or escape properly. Proof-of-concept confirmed a syntax error using keyword “a’b” and a stored with a single quote. The vulnerability allows cross-notebook read and write, and ATTACH databases, with no code execution in the default build (no load_extension). This is a critical severity flaw distinct from previously reported SQL injection sinks. The suggested fix is to parameterize the entire MATCH clause, binding both keyword and stored metadata as placeholders rather than concatenating.

DailyCVE Form:

Platform: SiYuan
Version: all pre‑patch
Vulnerability: SQL Injection
Severity: Critical
date: 2026-08-01

Prediction: 2026-08-15

What Undercode Say:

Detect vulnerable endpoint (anonymous first-order)
curl -X POST http://127.0.0.1:6808/api/ref/getBacklink2 \
-H "Content-Type: application/json" \
-d '{"id":"<existing_block_id>","k":"a'\''b","mk":""}'
Expected response: SQL parse error (confirms injection)
Create a malicious document with single-quoted (second-order)
Use SiYuan's internal API or UI to create a .sy file with "Test'Malicious"
Then trigger backlink lookup on a block referencing it

Exploit: (Educational Purposes!)

  • First‑order: Inject `’ OR 1=1; –` in the `k` parameter to alter query logic; stack statements like `’; DROP TABLE blocks; –` to write or `’; ATTACH DATABASE ‘/path/to/other’ AS other; –` to read other notebooks.
  • Second‑order: Import a `.sy` file whose metadata (e.g., ) contains ' OR 1=1; --. When that document becomes part of a backlink search (via any user’s kernel), the stored quote breaks the concatenated MATCH clause, executing the injected SQL.
  • Example payload for data exfiltration: `’ UNION SELECT sql FROM sqlite_master; –` (though this requires adjusting the SELECT columns to match the expected result set).
  • All queries run on the read‑write handle, enabling full database compromise.

Protection: from this CVE

  • Apply the vendor patch immediately when released (parameterization of backlink query).
  • If patch unavailable, disable public publish authentication (Publish.Auth.Enable = false) to block anonymous access, or restrict network access to the publish port (6808).
  • Avoid importing untrusted `.sy` or `.sy.zip` files from unknown sources.
  • Monitor for unusual SQL errors in logs that indicate attempted injection.

Impact:

  • First‑order: Anonymous readers can execute arbitrary SQL, reading all notebooks (including encrypted if key present), writing/deleting data, and attaching external databases—full database compromise.
  • Second‑order: Any kernel that syncs or imports a poisoned document becomes vulnerable; the attack can spread via shared notebooks, affecting multiple users without direct interaction.
  • The vulnerability is critical because it bypasses authentication tiers and operates on the primary writable database handle, with statement stacking enabling multi‑statement execution.

🎯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