Skip to content
Threat Feed
high advisory

Second-Order SSTI in SiYuan via Attribute-View Template Columns

SiYuan kernel is vulnerable to a second-order SSTI via the queryBlocks template function, allowing attackers to achieve arbitrary SQL execution upon rendering imported malicious content.

CVE search metadata

CVE search record: CVE-2026-72807. Severity: high. CVSS: 8.0. EPSS: 0.20%. KEV: no. Product: kernel (< 0.0.0-20260723035036-0a176345e02a). Brief: Second-Order SSTI in SiYuan via Attribute-View Template Columns. Brief link: https://feed.craftedsignal.io/briefs/2026-09-siyuan-ssti/

SiYuan note-taking software is susceptible to a second-order Server-Side Template Injection (SSTI) vulnerability, tracked as CVE-2026-72807. The vulnerability exists within Attribute-View (AV) template columns, which are live-evaluated during rendering. The queryBlocks template function, intended for database interaction, fails to use parameterized queries, instead performing raw string substitution into SQL statements.

While AV creation is restricted to administrators, the injection is delivered as a second-order threat. An attacker can craft a document or an AV package containing a malicious template column. When a victim imports this package and renders the associated Attribute-View, the malicious template executes arbitrary SQL against the application's read-write database handle. This allows for unauthorized data access across notebooks and potential write operations via statement stacking. The vulnerability affects the SiYuan kernel prior to version 0.0.0-20260723035036-0a176345e02a.

Attack Chain

  1. Attacker constructs a SiYuan document or AV package containing a template column using the queryBlocks function.
  2. The attacker injects malicious SQL commands as an argument to queryBlocks (e.g., .action{range queryBlocks "SELECT * FROM blocks..."}).
  3. The malicious document or AV package is distributed to a victim via file import.
  4. The victim imports the document into their local SiYuan instance.
  5. The victim triggers the rendering of the Attribute-View (e.g., via POST /api/av/renderAttributeView).
  6. The SiYuan kernel evaluates the template, substituting the malicious SQL string directly into the database query.
  7. The SQLite engine executes the arbitrary SQL commands, potentially exfiltrating data or modifying the database.

Impact

Successful exploitation leads to unauthorized access to the victim's local SiYuan database. Because the queryBlocks function operates on a read-write database handle, an attacker can bypass access controls to read sensitive notes or perform write operations if statement stacking is supported by the SQLite implementation. The severity is bounded by the requirement for victim interaction (importing and rendering content).

Recommendation

  1. Upgrade the SiYuan kernel to version 0.0.0-20260723035036-0a176345e02a or later to resolve CVE-2026-72807.
  2. Implement strict input validation and sanitization for all imported document content and AV templates.
  3. Replace raw string substitution in the queryBlocks function with proper parameterized query bindings.
  4. Review and restrict the set of template functions available within Attribute-View columns to prevent access to dangerous primitives.

Immediate actions

Upgrade SiYuan kernel to version 0.0.0-20260723035036-0a176345e02a.

IT Operations 48h

Mitigations

Upgrade kernel to 0.0.0-20260723035036-0a176345e02a or later

immediate IT Operations

CVE-2026-72807