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-72812

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

Amit Schendel
Amit Schendel
Senior Security Researcher

Sep 4, 2026·6 min read·2 visits

Executive Summary (TL;DR)

Unauthenticated attackers can abuse /api/ref/refreshBacklink in public mode to bypass authorization filters, trigger heavy CPU/disk usage, and exploit a secondary SQL injection flaw in the recursive query engine.

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.

Vulnerability Overview

SiYuan is an open-source, local-first personal knowledge management platform designed to organize structured notes using a block-based architecture. To support distributed collaborative scenarios, the platform supports a Publish mode where designated notebooks are rendered readable to public visitors. Under this layout, certain back-end endpoints are exposed to facilitate reading views without requiring administrative authentication.\n\nThe vulnerability designated as CVE-2026-72812 exists within the handling of the /api/ref/refreshBacklink endpoint, which is used to rebuild connection trees between referenced notes. In versions prior to v3.7.4, this route lacked administrative checks and read-only environmental validations. Consequently, any anonymous reader on a public instance can trigger recursive query execution and subsequent transaction flushes to disk.\n\nBeyond the access control failure, the application's core backlink-resolution logic suffers from a secondary vulnerability involving unsafe string formatting during parent-child structural evaluations. By combining the authorization bypass with the injection of crafted block identifiers, an adversary can influence SQL execution paths inside the SQLite database engine. This combination elevates the severity of the vulnerability from basic resource consumption to remote database manipulation.

Root Cause Analysis

The primary flaw stems from incomplete access control controls inside kernel/api/router.go. The routing definition mapped /api/ref/refreshBacklink strictly to the model.CheckAuth middleware instead of enforcing the more restrictive model.CheckAdminRole or checking the read-only flag via the model.CheckReadonly check. The model.CheckAuth middleware only checks if a session is present or if the application is running in read-only public publish mode, which maps anonymous guests to the RoleReader role.\n\nWhen a guest initiates a request, the router allows execution to proceed to the refreshBacklink handler in kernel/api/ref.go. This controller takes a block identifier string directly from the input JSON object without input format sanitization. It passes this string directly to model.RefreshBacklink(), which triggers background transaction management routines including model.FlushTxQueue() to flush memory queues into disk storage.\n\nThe secondary SQL injection vulnerability occurs in kernel/sql/block_ref_query.go inside the QueryRefsByDefID function. When executing nested lookups for child block structures, the function fetches child block IDs via Go slice routines and attempts to join them into an SQL IN statement. The implementation does this by enclosing each block ID string in raw double-quotes and executing raw string concatenation: SELECT * FROM refs WHERE def_block_id IN ( + strings.Join(params, ",") + ). This direct integration of unescaped string outputs inside structural queries permits an injection payload to escape the quoted literal wrapper.

Code Analysis

To understand the vulnerable logic, examine the way the query construction historically concatenated values within kernel/sql/block_ref_query.go:\n\ngo\n// Vulnerable code in block_ref_query.go\nif containChildren {\n blockIDs := queryBlockChildrenIDs(defBlockID)\n var params []string\n for _, id := range blockIDs {\n params = append(params, "\""+id+"\"")\n }\n rows, err = query("SELECT * FROM refs WHERE def_block_id IN (" + strings.Join(params, ",") + ")")\n}\n\n\nBecause there was no escaping mechanism, if an attacker successfully seeded a custom block ID containing nested double-quotes, SQL injection occurred. In the patch, this code pattern was deleted entirely and replaced with a relational, database-side recursion using a Common Table Expression (CTE):\n\ngo\n// Patched code utilizing recursive CTE and parameterization\nconst queryRefsByDefIDWithChildren = `WITH RECURSIVE child_ids(id) AS (\n\tSELECT ?\n\tUNION\n\tSELECT blocks.id FROM blocks JOIN child_ids ON blocks.parent_id = child_ids.id\n)\nSELECT refs.* FROM refs JOIN child_ids ON refs.def_block_id = child_ids.id`\n\n\nThe application now binds the root parameter defBlockID via standard prepared parameter replacement (?). By doing so, the query engine processes input values strictly as string literals, rendering injection payloads harmless. Additionally, the route protection check in kernel/api/router.go was patched to append validation layers:\n\ngo\n// Patched routing rule in router.go\nginServer.Handle("POST", "/api/ref/refreshBacklink", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, refreshBacklink)\n\n\nAdding both model.CheckAdminRole and model.CheckReadonly prevents non-admin users and users in read-only publish mode from invoking this transactional route, eliminating the unauthenticated write vector.

Exploitation and Attack Methodology

Exploitation of the authorization bypass is conducted through a single HTTP POST payload targeting the /api/ref/refreshBacklink route. Because public instances exposing notes in read-only publish mode allow access to the handler, an attacker does not require any credentials. The only prerequisite is harvesting a valid block ID, which is exposed in the page structure of public notes.\n\nThe secondary SQL injection payload requires injecting a corrupted block ID into the blocks database table. This can be achieved through other vector interfaces such as syncing malicious notes or using notebook import functions. Once the malicious block ID is present (for example, carrying a payload like 20260723000000-injection" OR (SELECT 1 FROM (SELECT UPPER(HEX(RANDOMBLOB(10000000)))))) --), invoking the backlink refresh endpoint on its parent triggers the vulnerable query builder.\n\nmermaid\ngraph LR\n Attacker["Attacker (Anonymous Reader)"] -->|1. POST /api/ref/refreshBacklink| WebRouter["Web Router (No Admin Filter)"]\n WebRouter -->|2. Invoke Handlers| QueryHandler["QueryRefsByDefID (Unsafe Concatenation)"]\n QueryHandler -->|3. Read Malicious Block ID| SQLite["SQLite Database Engine (SQL Injection)"]\n SQLite -->|4. High Resource Consumption| Crash["Service Outage / DoS"]\n\n\nThis diagram illustrates the execution flow. The unauthenticated request successfully bypasses the router, leverages the unsafe query construction on the backend, and causes SQLite to execute expensive procedures, leading to Denial-of-Service conditions.

Impact Assessment

The impact of CVE-2026-72812 varies depending on whether the primary authorization bypass is executed alone or chained with the secondary SQL injection vulnerability. On its own, the authorization bypass allows read-only users to force write-queue flushes (FlushTxQueue) and backlink recalculations. In shared personal knowledge workspaces, this leads to CPU spikes, high disk write overhead, and localized denial-of-service.\n\nWhen chained with the SQL injection flaw, the impact escalates. Because the SQL execution context is SQLite, arbitrary database execution remains confined to database-accessible commands. However, attackers can leverage SQL injection to read sensitive notebook databases, retrieve application configurations, or exhaust server system resources through recursive calculations such as generating large random blobs in memory.\n\nThe CVSS 3.1 base score is 6.5, with an environmental vector of CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L. This score reflects that while the access control vulnerability is unauthenticated and simple to exploit, the resulting write impact is restricted compared to remote shell access.

Mitigation and Remediation

The definitive resolution for this issue is upgrading the SiYuan container, application binary, or package deployment to version v3.7.4 or higher. This release integrates both the route-level authorization checks and the database CTE query parameterized replacements, resolving both components of the vulnerability.\n\nFor deployments where immediate updates are not possible, administrators must implement network-level mitigations. Ensure that access to the default API port 6806 is restricted to local interfaces (127.0.0.1 or localhost). If running public publish modes, configure an upfront reverse proxy (such as Nginx or Caddy) to drop incoming external HTTP traffic targeting /api/ endpoints.\n\nNetwork-based intrusion detection systems can inspect payload metrics to identify abuse patterns. For example, monitoring high frequencies of requests to /api/ref/refreshBacklink from non-administrative IP addresses can expose exploit attempts. Similarly, database transaction logging can be used to track unvalidated string patterns inside block query executions.

Official Patches

SiYuanThe official fix commit restricting the refreshBacklink endpoint and adding recursive CTE SQL syntax.

Fix Analysis (1)

Technical Appendix

CVSS Score
6.5/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L
EPSS Probability
0.27%
Top 81% most exploited

Affected Systems

SiYuan personal knowledge management system running versions prior to v3.7.4

Affected Versions Detail

Product
Affected Versions
Fixed Version
SiYuan
SiYuan
< v3.7.4v3.7.4
AttributeDetail
CWE IDCWE-862
Attack VectorNetwork (AV:N)
CVSS v3.1 Score6.5
EPSS Score0.00275
ImpactBypass Write Protections, Secondary SQL Injection, Denial of Service
Exploit StatusPoC (Proof of Concept) available
KEV StatusNot listed

MITRE ATT&CK Mapping

T1068Exploitation for Privilege Escalation
Privilege Escalation
CWE-862
Missing Authorization

The product does not perform an authorization check when an actor attempts to access a resource or perform an action.

Known Exploits & Detection

GitHub Security AdvisoryGHSA documentation outlining the vulnerability mechanics and fix details.

Vulnerability Timeline

Vulnerability identified and fixed in commit 7d273c271ce193b9d3ee5751b596b8093ba84ada
2026-07-23
CVE-2026-72812 and GHSA-wgwx-479j-23vq published
2026-08-14
Technical report compiled detailing missing authorization and secondary SQLi chain
2026-09-03

References & Sources

  • [1]GitHub Security Advisory GHSA-wgwx-479j-23vq
  • [2]Vendor Patch Commit 7d273c2
  • [3]VulnCheck Technical Advisory
  • [4]CVE-2026-72812 Record

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

•16 minutes ago•CVE-2026-68585
5.8

CVE-2026-68585: Metadata Disclosure via Missing Authorization in SiYuan API

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.

Alon Barad
Alon Barad
0 views•8 min read
•about 2 hours ago•CVE-2026-72811
10.0

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

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.

Amit Schendel
Amit Schendel
3 views•7 min read
•about 3 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 4 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 5 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 6 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