CVE-2026-72807 Overview
CVE-2026-72807 is a second-order SQL injection vulnerability in SiYuan, an open-source personal knowledge management application. Versions before v3.7.4 expose the queryBlocks function through attribute-view template columns. The function executes raw SQL using string substitution rather than parameterized queries. Attackers can distribute malicious SiYuan documents or packages containing crafted template columns. When a victim imports and renders the package, arbitrary SQL executes on the victim's kernel, enabling read and write access across notebooks. The flaw is categorized under CWE-89 (Improper Neutralization of Special Elements used in an SQL Command).
Critical Impact
Importing an untrusted SiYuan document can grant an attacker arbitrary read and write access across all notebooks on the victim's kernel.
Affected Products
- SiYuan personal knowledge management application
- All SiYuan versions prior to v3.7.4
- Kernel component handling attribute-view template rendering
Discovery Timeline
- 2026-08-12 - CVE-2026-72807 published to the National Vulnerability Database (NVD)
- 2026-08-12 - Last updated in NVD database
Technical Details for CVE-2026-72807
Vulnerability Analysis
SiYuan supports attribute views with template columns that can reference internal query functions. The queryBlocks function is exposed to these templates and executes user-controlled SQL. Instead of binding parameters, the implementation concatenates or substitutes values directly into the SQL string, allowing SQL syntax injection.
Because the injection triggers when a document is imported and rendered rather than at initial input, it qualifies as a second-order (stored) SQL injection. The attacker persists a malicious payload in a shareable artifact, and execution occurs later on the victim's kernel. This significantly reduces the effort required for exploitation, since community-shared notes and packages are a normal distribution channel for SiYuan users.
Root Cause
The root cause is unsafe SQL construction inside the template-exposed queryBlocks path. Query fragments are assembled through string substitution, bypassing the parameterized query interfaces provided by the underlying database driver. Any template value that reaches the query builder is treated as trusted SQL syntax rather than as data.
Attack Vector
An attacker crafts a SiYuan document, notebook, or package containing an attribute view whose template column embeds SQL metacharacters. The attacker publishes the artifact through community channels, direct sharing, or supply-chain-style distribution. When a victim imports the package and SiYuan renders the attribute view, the crafted template invokes queryBlocks and the injected SQL executes against the victim's local kernel database. The attacker can read data from other notebooks and issue write operations, corrupting or exfiltrating content across the workspace.
No authentication is required against a remote service; the attack relies on user interaction (importing and rendering a hostile document). Refer to the GitHub Security Advisory GHSA-x67c-8pwr-m8g3 and the VulnCheck SQL Injection Advisory for additional technical context.
Detection Methods for CVE-2026-72807
Indicators of Compromise
- Imported .sy.zip packages or notebook exports from untrusted sources containing attribute views with unusual template column expressions.
- Attribute-view template columns that reference queryBlocks with SQL metacharacters such as --, ;, UNION, or nested quotes.
- Unexpected modifications to blocks or notebooks that were not opened or edited by the user.
- Kernel process activity involving unexpected reads or writes to conf.db or the workspace SQLite store shortly after a package import.
Detection Strategies
- Inspect attribute-view definitions in shared packages for template columns that embed SQL fragments before importing.
- Enable file integrity monitoring on the SiYuan workspace directory to identify anomalous writes following document imports.
- Review SiYuan kernel logs for query errors or unusually long SQL statements originating from the template rendering path.
Monitoring Recommendations
- Track process execution and file writes performed by the SiYuan kernel binary through endpoint telemetry.
- Alert on newly imported SiYuan packages sourced from external URLs or removable media.
- Correlate document import events with subsequent bulk changes to notebook content to surface suspicious template execution.
How to Mitigate CVE-2026-72807
Immediate Actions Required
- Upgrade SiYuan to version v3.7.4 or later on every workstation that runs the kernel.
- Do not import SiYuan documents, notebooks, or packages received from untrusted sources until the upgrade is complete.
- Audit existing workspaces for attribute-view template columns that reference queryBlocks and remove any that were sourced from third parties.
Patch Information
The SiYuan maintainers addressed the vulnerability in version v3.7.4 by removing unsafe SQL construction from the template-exposed query path. Details of the fix are published in the GitHub Security Advisory GHSA-x67c-8pwr-m8g3. All prior versions are affected and should be upgraded.
Workarounds
- Refuse imports of .sy.zip packages and notebook archives from unverified authors until patched.
- Operate SiYuan under a restricted user account to limit the blast radius of arbitrary database writes.
- Back up the workspace directory before importing any external content so tampered data can be restored.
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

