CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-72811

CVE-2026-72811: Remote SQL Injection in SiYuan Backlink and Mention Search Engine

Amit Schendel
Amit Schendel
Senior Security Researcher

Sep 4, 2026·7 min read·2 visits

Executive Summary (TL;DR)

Unauthenticated remote SQL injection via unescaped string concatenation in SiYuan's SQLite FTS backlink query engine, remediated in v3.7.4.

A critical SQL Injection vulnerability exists in the SiYuan note-taking application (versions <= v3.7.2) due to improper neutralization of single quotes within the backlink and mention search queries. Because the application constructs SQLite Full Text Search (FTS) queries via direct string concatenation and uses a database driver that supports stacked query statements, remote unauthenticated attackers can execute arbitrary SQL commands on the master database, compromising all hosted notebooks. This issue has been fully remediated in version v3.7.4.

Vulnerability Overview

The target component is the backlink and mention search engine of the SiYuan note-taking application, specifically implemented in kernel/model/backlink.go. SiYuan utilizes an internal SQLite database (siyuan.db) to store, index, and organize document hierarchies, metadata, and block contents. The search engine allows users to query links and mentions of specific terms across different notebooks, serving as a critical mechanism for document relationship mapping.

This engine relies on SQLite's Full Text Search (FTS) extension to perform high-performance queries across structured blocks of text. The vulnerability, tracked as CVE-2026-72811, is classified under CWE-89 (SQL Injection) and carries a critical CVSS v3.1 base score of 10.0. The vulnerability surfaces because the application constructs dynamic SQL queries by appending client-supplied inputs and database-stored document titles directly into the SQLite MATCH statement string.

The attack surface is exposed directly through public-facing search endpoints, which are active when notebooks are published or when collaborative multi-user modes are enabled. Because the database driver supports statement stacking, a remote unauthenticated attacker can execute arbitrary SQL statements. This allows bypass of logical restrictions, write access to system tables, and potential system compromise beyond the application's sandbox context.

Root Cause Analysis

The root cause of CVE-2026-72811 lies in the flawed sanitization logic within searchBackmentionInBox in kernel/model/backlink.go. The system attempts to dynamically generate a SQLite FTS5 MATCH expression by manual string concatenation using a bytes.Buffer. The generated query template encapsulates the full FTS syntax inside single quotes, such as MATCH 'content:(...) '.

While building individual keyword constraints, the application tries to account for the double quotes used to denote specific phrases in FTS. It replaces double quotes with escaped double quotes ("") using strings.ReplaceAll(keyword, "\"", "\"\""). This replacement ensures the internal structure of the FTS query string remains intact and parses correctly as an FTS phrase.

However, the system completely fails to sanitize or escape single quotes (') within either the client-submitted keywords or the document metadata loaded from the database. Because the entire MATCH parameter is enclosed in single quotes, injecting a single quote inside a keyword or title prematurely terminates the string literal boundary of the FTS expression. An attacker can then inject arbitrary SQL commands following the closed single quote.

The vulnerability is further worsened because the Go database driver used by SiYuan allows stacked queries separated by semicolons (;). SQLite compiles and executes sequential statements within a single query execution block on the active connection. This design behavior allows an attacker to pivot from a simple FTS query breakout to full read and write operations on the siyuan.db database.

Code-Level Analysis of Vulnerability and Fix

Prior to the patch, the searchBackmentionInBox function constructed raw SQL statements directly in memory. The application concatenated unsanitized parameters into a local buffer. This process can be modeled visually to understand the data flow from source to sink.

The critical vulnerability resides in how the system built the query inside backlink.go. Below is the vulnerable segment of code demonstrating the raw concatenation logic:

// Vulnerable raw query construction (Pre-patch)
buf.WriteString("SELECT * FROM " + table + " WHERE " + table + " MATCH '" + columnFilter() + ":(")
for i, mentionKeyword := range mentionKeywords {
    mentionKeyword = strings.ReplaceAll(mentionKeyword, "\"", "\"\"")
    buf.WriteString("\"" + mentionKeyword + "\"")
    // ... OR operators are written
}
buf.WriteString(")")
if "" != keyword {
    keyword = strings.ReplaceAll(keyword, "\"", "\"\"")
    buf.WriteString(" AND (\"" + keyword + "\")")
}
buf.WriteString("'") // Closes the FTS single-quote block
buf.WriteString(" AND root_id != '" + rootID + "'")

In the patched code (Commit 1a5b3431d5ab3036b19c1cc79486fedd6906fb57), the developers introduced complete parameterization. They decoupled the structure of the SQL query from the values being filtered.

// Patched secure query construction (Post-patch)
func buildBackmentionQuery(matchExpression, rootID string, limit int) (query string, args []any) {
    query = "SELECT * FROM blocks_fts WHERE blocks_fts MATCH ? AND root_id != ?" +
        " AND type IN ('d', 'h', 'p', 't') ORDER BY id DESC LIMIT ?"
    args = []any{matchExpression, rootID, limit}
    return
}
 
func quoteFTSPhrase(phrase string) string {
    return "\"" + strings.ReplaceAll(phrase, "\"", "\"\"") + "\""
}

This structural shift completely eliminates the possibility of SQL injection. The FTS expression itself is parameterized as a single bound parameter ?, which the database engine treats strictly as a data literal, preventing any injection of SQL syntax.

Exploitation and Attack Methodology

Exploitation of CVE-2026-72811 can be achieved through two primary attack vectors depending on the attacker's level of access. The first vector is first-order exploitation, which targets public-facing search endpoints. An unauthenticated remote attacker issues a HTTP POST request to the backlink search API.

POST /api/backlink/search HTTP/1.1
Host: target-siyuan.local
Content-Type: application/json
 
{
  "keyword": "exploit') ; ATTACH DATABASE '/tmp/pwn.db' AS pwn; --"
}

The system processes the request and maps the keyword parameter directly into the SQLite search engine. Since the single quote is not escaped, the backend executes the ATTACH DATABASE statement, allowing the attacker to construct arbitrary files on the local filesystem where the application runs.

The second vector is a second-order exploitation approach that occurs when malicious payloads are stored in the database. An attacker with write access creates a block containing a crafted document title with embedded SQL statements. When another user views a document that references this block, the server fetches the document title to search for mentions. The unescaped title is concatenated directly into the FTS engine, executing the payload in the context of the active user session.

Comprehensive Security Impact

The security impact of CVE-2026-72811 is rated as Critical with a CVSS v3.1 score of 10.0. A successful exploitation allows full read and write access to the underlying SQLite database file siyuan.db. This database houses critical application configurations, access tokens, integration keys, and full text contents of all private notebooks.

Because the SQLite connection supports statement stacking, attackers can run arbitrary SQL commands. This capability bypasses any application-level authorization limits. An attacker can extract system configuration parameters, modify document contents, or introduce cross-site scripting (XSS) payloads into notebook pages that execute when other users synchronize or read the affected notebooks.

Additionally, although SQLite does not naturally support standard external system shells, features such as ATTACH DATABASE can be used to write arbitrary files to specific locations on the server, depending on user permissions. In environments running with elevated privileges, this primitive can be leveraged to write local configuration files, leading to remote code execution.

Remediation and Defense-in-Depth

The primary and recommended mitigation for CVE-2026-72811 is to upgrade the SiYuan application to version v3.7.4 or higher. The patch fully mitigates the vulnerability by transitioning the dynamic query construction process into a parameterized SQL statement. This ensures all user-supplied inputs are securely bound as parameter values rather than raw SQL command elements.

If an immediate upgrade is not feasible, several temporary workarounds should be applied to reduce the attack surface. Administrators should immediately disable any public-facing publish mode capabilities on the instance. Restricting the network availability of the SiYuan container or server to local loopback or a secure VPN prevents external threat actors from reaching the affected endpoint.

Deploying Web Application Firewall (WAF) rules can help detect and block exploitation attempts before they reach the application. A custom WAF rule can monitor the request body of search endpoints for unescaped single quotes combined with SQL keywords. This validation layer serves as an effective defense-in-depth measure while the core application is scheduled for an update.

Official Patches

siyuan-noteOfficial fix commit implementing parameterized search in backlink.go

Fix Analysis (1)

Technical Appendix

CVSS Score
10.0/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N
EPSS Probability
0.25%
Top 84% most exploited

Affected Systems

SiYuan Note-Taking Application

Affected Versions Detail

Product
Affected Versions
Fixed Version
SiYuan
siyuan-note
<= v3.7.2v3.7.4
AttributeDetail
CWE IDCWE-89 (Improper Neutralization of Special Elements used in an SQL Command)
Attack VectorNetwork (Unauthenticated, Remote)
CVSS v3.1 Score10.0 (Critical)
EPSS Score0.0025 (Percentile: 16.27%)
ImpactArbitrary Database Read/Write and System Configuration Alteration
Exploit StatusProof-of-Concept (PoC) documented in research
KEV StatusNot Listed in CISA Known Exploited Vulnerabilities

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')

The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to the database.

Vulnerability Timeline

Official fix commit authored in the siyuan-note/siyuan repository
2026-07-23
GitHub Security Advisory GHSA-q2vg-7qgx-x5fc published
2026-08-14
CVE-2026-72811 published by VulnCheck
2026-08-14
Vulnerability details updated in the National Vulnerability Database (NVD)
2026-08-26

References & Sources

  • [1]GitHub Security Advisory GHSA-q2vg-7qgx-x5fc
  • [2]SiYuan Parameterization Commit
  • [3]VulnCheck Security Advisory
  • [4]NVD Entry for CVE-2026-72811
  • [5]CVE Record on CVE.org

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•12 minutes ago•CVE-2026-72812
6.5

CVE-2026-72812: Broken Access Control and SQL Injection in SiYuan

A critical authorization bypass vulnerability exists in SiYuan personal knowledge management system before v3.7.4. The /api/ref/refreshBacklink endpoint lacks administrative role verification, enabling unauthenticated users to initiate database transactions and disk operations. When combined with an unsafe SQL generation pattern in nested backlink queries, an attacker can exploit a secondary SQL injection vulnerability to compromise local databases or cause denial-of-service conditions.

Amit Schendel
Amit Schendel
1 views•6 min read
•about 2 hours ago•CVE-2026-72810
8.6

CVE-2026-72810: Publish-Boundary Bypass and Real-Time Data Leakage via WebSocket Session Pollution in SiYuan

CVE-2026-72810 is a critical publish-boundary bypass vulnerability in the SiYuan personal knowledge management system before version 3.7.4. The flaw lies in the backend real-time WebSocket broadcast mechanism. When configured in public publish mode, the system fails to differentiate between unauthenticated public reader sessions and authorized administrative sessions within its global connection pool. This architectural oversight allows unauthenticated remote attackers connecting to the public WebSocket endpoint on port 6808 to passively receive real-time, raw workspace modification events, including keystroke logs, block updates, and content from protected or forbidden documents.

Amit Schendel
Amit Schendel
3 views•7 min read
•about 3 hours ago•CVE-2026-72809
8.0

CVE-2026-72809: Authentication Bypass in SiYuan via Localhost Trust Spoofing

An authentication bypass vulnerability exists in the SiYuan personal knowledge management system (versions <= v3.7.2). The flaw occurs because the kernel's authorization validation handler trusts loopback connection origins blindly, allowing remote network attackers to gain administrative privileges via an exposed local reverse proxy.

Alon Barad
Alon Barad
4 views•6 min read
•about 4 hours ago•CVE-2026-72808
6.9

CVE-2026-72808: Unauthorized PDF Annotation Access in SiYuan Knowledge Management System

An information disclosure vulnerability in the SiYuan knowledge management system versions up to and including v3.7.2 allows remote unauthorized attackers to retrieve PDF annotations via the /api/asset/getFileAnnotation endpoint due to missing authorization checks.

Alon Barad
Alon Barad
8 views•6 min read
•about 5 hours ago•CVE-2026-72807
8.8

CVE-2026-72807: Second-Order SQL Injection via Attribute View Templates in SiYuan

CVE-2026-72807 is a second-order SQL injection vulnerability in SiYuan versions prior to v3.7.4. It resides in the dynamic evaluation of Attribute View (AV) template columns, which expose unsafe template functions. An attacker can exploit this by distributing a malicious SiYuan package that executes arbitrary SQL queries on the victim's local database.

Amit Schendel
Amit Schendel
5 views•7 min read
•about 6 hours ago•CVE-2026-72806
5.8

CVE-2026-72806: Missing Authorization in SiYuan Attribute View Rendering Leads to Information Disclosure

An authorization bypass vulnerability in SiYuan prior to v3.7.4 allows unauthenticated remote attackers to access rows, block IDs, and custom attributes of password-protected documents via the attribute view rendering endpoint.

Alon Barad
Alon Barad
3 views•7 min read