Executive brief
SiYuan is a note-taking and knowledge management application. An unauthenticated attacker or any reader in publish mode can exploit two SQL flaws in the asset content search endpoint to execute arbitrary SQL queries, read sensitive data across all notebooks, and modify database records. The vulnerability bypasses authentication and permission checks, allowing unauthorized access to content that should be restricted from public viewing.
Technical details
The vulnerability comprises two SQL injection attack paths in the `/api/search/fullTextSearchAssetContent` endpoint. Method 2 accepts client-controlled SQL statements and passes them directly to `assetContentDB.Query()` without single-statement or read-only validation, and without the admin-role check that its sibling `fullTextSearchBlock` applies. Method 3 concatenates user-supplied REGEXP expressions into SQL without quote-escaping (unlike the parallel block-search builder), allowing SQL breakout via `'` characters. Both paths operate on a read-write SQLite handle with statement-stacking capability and ATTACH support, spanning cross-notebook asset-content storage. The endpoint requires only `CheckAuth` (satisfied by anonymous access when auth is disabled or any publish reader token), and post-hoc permission filtering runs after query execution, providing no defense. Patched in commit cf42dd5680c8.
Affected products
- siyuan-note siyuan before 0.0.0-20260721004815-cf42dd5680c8
Timeline
- 2026-09-03: advisory
- 2026-07-21: disclosed