A pre-authentication SQL injection in SiYuan's backlink/mention search appears to allow anonymous attackers to execute arbitrary SQL against the main notebook database, scoring a CVSS 3.1 base of 10.0.
What Is It
SiYuan versions <= v3.7.2 contain a SQL injection vulnerability (CWE-89) in the backlink/mention search query implemented in kernel/model/backlink.go. The code concatenates stored block metadata, title, name, alias, and anchor text, along with the client-supplied keyword directly into a SQL MATCH/search statement. It escapes only the double-quote character and does not escape the single quote.
A single quote breaks out of the string literal along two paths:
- First-order: supplied in the client keyword, reachable by an anonymous or RoleReader user on the publish surface.
- Second-order: stored in document metadata and later re-concatenated into the query.
Because the query executes on the main read-write siyuan.db handle through a driver that supports statement stacking, an attacker would likely be able to execute arbitrary SQL, plausibly enabling cross-notebook read and write.
Why It Matters
The flaw is remotely reachable over the network with low attack complexity, no privileges, and no user interaction. VulnCheck assigns a CVSS 3.1 base score of 10.0 (CRITICAL, AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N), with scope marked as changed. The CVSS 4.0 score is 9.9 (CRITICAL), reflecting high confidentiality and integrity impact to both the vulnerable system and downstream subsequent systems.
Because the injection lands on the read-write database handle rather than a read-only replica, the impact is unlikely to be limited to data disclosure; writes across notebook boundaries are a realistic consequence.
Neither advisory reports active exploitation, and CVSS exploit maturity is Not Defined.
What's Vulnerable
- Vendor/product: siyuan-note / siyuan
- Package:
pkg:golang/github.com/siyuan-note/siyuan/kernel - Affected versions: all versions before 3.7.4 (semver); descriptions specifically cite <= v3.7.2
- Unaffected: 3.7.4 and later
- Component:
kernel/model/backlink.go, backlink/mention search query - Exposure: the publish surface, reachable by anonymous or RoleReader users
Patch Status
Fixed in SiYuan v3.7.4. Upgrade to v3.7.4 or later. Instances exposing the publish surface to untrusted networks should be prioritized, given the vulnerability requires no authentication.