Executive brief
SiYuan is a note-taking and knowledge management application that stores user documents in a local database. An authenticated attacker can exploit a SQL injection vulnerability in the full-text search endpoint to read all document content and metadata, bypassing publish-access controls that normally restrict what content anonymous readers can view. This exposes sensitive notes, API tokens, and other confidential information stored in the database.
Technical details
The vulnerability is a SQL injection in the POST /api/search/fullTextSearchBlock endpoint's method=1 query branch (kernel/model/search.go:2416). The attacker-controlled query string is concatenated directly into an FTS5 MATCH SQL clause without escaping single quotes: "SELECT ... WHERE ... MATCH '...:(...query...)'" . The query is passed only through filterQueryInvisibleChars() which does not escape quotes. Method=1 is accessible to any authenticated user, including anonymous publish-mode readers, unlike method=2 (admin-gated raw SQL). An attacker can inject a UNION SELECT statement followed by -- to extract all columns from the blocks table. The patched version 3.8.2 escapes the FTS5 operand or binds it as a parameter. Attack vector is network, requires authentication (but anonymous publish readers qualify), and can achieve full read-only disclosure of the database.
Affected products
- SiYuan SiYuan < 3.8.2
Timeline
- 2026-08-26: disclosed
- 2026-08-26: patched: v3.8.2 released
- 2026-09-09: advisory