Sep 4, 2026·6 min read·3 visits
Unauthenticated remote attackers can execute arbitrary SQL commands on SiYuan's SQLite database via the full-text search endpoint, resulting in complete exposure or modification of indexed documents and application metadata.
An unauthenticated SQL injection and SQL execution vulnerability in SiYuan allows remote attackers to compromise the integrity and confidentiality of the asset database. The flaw exists due to string concatenation in regular expression searches and a complete lack of authorization checks on raw SQL querying pathways under default configurations. Attackers can leverage this vulnerability to exfiltrate database contents, manipulate index records, or access cross-notebook contents without any valid credentials.
SiYuan is a local-first personal knowledge management platform written in Go. Under typical deployments, it opens an HTTP API to coordinate search requests, asset indexing, and remote document synchronization. The vulnerability is located in the backend application handler responsible for full-text search processes, specifically routed to the endpoint path /api/search/fullTextSearchAssetContent. This endpoint constitutes a major attack surface because it is accessible to unauthenticated remote callers by default.
Under default configuration states where the variable Conf.AccessAuthCode is not defined or is left blank, the application architecture automatically elevates all external requests to the privilege level of an administrator. This architecture allows unauthenticated remote actors on accessible networks to interact directly with the underlying SQLite database engine. Because the database handle operates with read-write privileges, the vulnerability class corresponds to improper neutralization of special elements in an SQL command (CWE-89).
A deep technical analysis of the application codebase reveals two distinct software flaws operating inside the asset search API module. In the case of method 3 (regular expression searches), incoming parameters are processed through the controller function fullTextSearchAssetContentByRegexp within kernel/model/asset_content.go. This module generates dynamic SQL queries by interpolating user-supplied search parameters directly into a string literal pattern.
The dynamic construction is managed by the helper function assetContentFieldRegexp which appends raw user input without applying character escaping or escaping quote characters. A single quote character within the query input successfully escapes the string boundary within the REGEXP SQL condition, allowing arbitrary command insertion. This is a classic implementation error where raw user input is treated as executable code by the database parser.
In the case of method 2 (raw SQL search mode), the application passes the request payload directly to searchAssetContentBySQL. This controller function passes the entire query string straight to the raw database executor without invoking authorization checks or command validation logic. Unlike neighboring endpoints designed for similar metadata indexing tasks, this function entirely omitted access control validation, allowing any caller to execute any SQLite command string directly.
Analyzing the codebase prior to the 3.7.3 release highlights the vulnerable code path in kernel/model/asset_content.go. The following snippet illustrates how the unsafe regular expression string was constructed:
// Vulnerable string construction in method 3
func assetContentFieldRegexp(exp string) string {
buf := bytes.Buffer{}
buf.WriteString("(name REGEXP '")
buf.WriteString(exp)
buf.WriteString("' OR content REGEXP '")
buf.WriteString(exp)
buf.WriteString("')")
return buf.String()
}The resulting string from assetContentFieldRegexp is directly interpolated into the parent SQL query template:
stmt := "SELECT * FROM `asset_contents_fts_case_insensitive` WHERE " + fieldFilter + " AND ext IN " + typeFilterIn the patched codebase (commit cf42dd5680c8f2d50cebfada5d639c8d59faf50e), the dynamic string concatenation was replaced entirely by safe parameter-binding APIs. The patch isolates variables from the executable statement structure:
// Patched parameterized structure
func assetContentFieldRegexp(exp string) (clause string, args []any) {
clause = "(name REGEXP ? OR content REGEXP ?)"
args = []any{exp, exp}
return
}Additionally, the patch introduced an authorization validation step within kernel/api/search.go to block non-administrator access to the raw SQL querying path (method 2):
if method == 2 && !model.IsAdminRoleContext(c) {
ret.Code = -1
ret.Msg = "SQL search requires administrator privileges"
return
}An attack begins by probing the target endpoint to verify if authentication requirements are absent on port 6806. Once confirmed, the attacker can submit a crafted HTTP POST request to the target path /api/search/fullTextSearchAssetContent containing a payload designed to target method 3. By inserting a single quote, trailing commands, and an inline comment characters sequence, the attacker manipulates the parser logic.
A sample JSON exploit payload targeting the REGEXP engine is constructed as follows:
{
"query": "xyz') OR 1=1 -- ",
"types": {},
"method": 3,
"orderBy": 0,
"page": 1,
"pageSize": 64
}When processed by the database backend, the query is parsed as SELECT * FROM asset_contents_fts_case_insensitive WHERE (name REGEXP 'xyz') OR 1=1 -- .... The trailing comment characters sequence -- instructs the SQLite compiler to drop all subsequent filter assertions. This returns every record stored inside the full-text search asset database table directly within the response payload. Alternatively, attackers can send direct SQL commands using method 2 payloads to alter system metadata or query indexed records.
The security implications of CVE-2026-69083 are critical. An unauthorized attacker can read all indexed notebooks, text segments, synchronization logs, and document assets. The confidentiality of all data assets managed within the application is compromised.
In addition, because the database handler operates with read-write capabilities on SQLite, an attacker can modify index files or delete stored assets, disrupting indexing integrity. Since SQLite features the capability to attach external storage structures via advanced query syntax (e.g., ATTACH DATABASE), there is a risk that attackers can execute arbitrary code on the hosting environment if specific filesystem write permissions are present.
This vulnerability is particularly severe because the application is designed to store personal knowledge assets, which frequently include sensitive elements such as system credentials, network topology descriptions, and personal identifying information. The CVSS vector reflects a critical impact across confidentiality and integrity vectors.
Remediation requires upgrading the SiYuan application to version 3.7.3 or later. This update enforces parameterized data input across search controllers and adds mandatory validation checks on administrative endpoints.
For instances where immediate updates are not possible, administrators must configure a non-empty administrative access authentication key. Specifying the Conf.AccessAuthCode parameter in the environment configuration enforces authentication, preventing unauthenticated callers from obtaining automatic administrative privileges.
To detect and block exploit attempts at the perimeter, network security operators can deploy custom Web Application Firewall (WAF) filters. Rules should target incoming POST requests directed to /api/search/fullTextSearchAssetContent and flag payloads that contain single quotes or comments within the search string while method parameters are set to 2 or 3.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
SiYuan siyuan-note | < 3.7.3 | 3.7.3 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-89 |
| Attack Vector | Network (AV:N) |
| CVSS Score | 10.0 (Critical) |
| EPSS Score | 0.0035 (27.97th percentile) |
| Exploit Status | Functional PoC Available |
| CISA KEV Status | Not Listed |
The software constructs an SQL command using input from an upstream component, but does not neutralize or incorrectly neutralizes special elements that can modify the SQL command.
A prototype pollution vulnerability exists in the toml-node library (by BinaryMuse) in versions prior to 4.1.2. The flaw arises from inconsistent internal tracking of parsed paths (comma-joined vs. dot-joined serialization) combined with lack of object ownership validation during recursive dictionary descent (scalar descent). This allows unauthenticated remote attackers to modify base object structures by crafting malicious TOML documents containing conflicting duplicate table paths or nested references.
CVE-2026-68587 is a critical authorization bypass vulnerability in SiYuan, an open-source personal knowledge management workspace. When deployed in publish mode, specific transaction endpoints fail to perform administrative role validation. This omission enables unauthenticated remote readers to retrieve the rendered Document Object Model (DOM) of publish-disabled (private) documents by supplying a target heading block identifier. Upgrading to version v3.7.3 or later resolves this issue by applying appropriate routing middleware constraints.
SiYuan is a privacy-first personal knowledge management system. In versions prior to v3.7.3, the application fails to apply publish-access filters to the getBacklinkDoc and getBackmentionDoc content endpoints (/api/ref/getBacklinkDoc and /api/ref/getBackmentionDoc). While the corresponding backlink list endpoints correctly filter out publish-forbidden documents, the content endpoints, which are only gated by high-level route authorization checks via CheckAuth, do not. Consequently, a user with low-privilege read access, or an anonymous reader when publish Basic Auth is disabled, can directly invoke these endpoints using a known publish-forbidden document's ID to retrieve its rendered DOM content or determine whether it references a specific target block.
A metadata disclosure vulnerability exists in SiYuan prior to version v3.7.3. The /api/block/getBlockInfo endpoint fails to validate authorization boundaries in publish mode, allowing anonymous readers to access private document metadata.
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.
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.