The vulnerability is an authorization bypass in the SiYuan Note application, specifically in the /api/search/fullTextSearchBlock API endpoint. The root cause is the lack of proper authorization middleware (CheckAdminRole and CheckReadonly) on this endpoint's definition in kernel/api/router.go. This allows any authenticated user, including those with a read-only Reader role, to access the endpoint.
The vulnerability is triggered when a request is sent to this endpoint with the method parameter set to 2. This directs the application to treat the query parameter as a raw SQL statement. The user-supplied SQL query is passed through a chain of functions, starting with api.fullTextSearchBlock, then to model.FullTextSearchBlock, model.searchBySQL, sql.SelectBlocksRawStmt, and finally to sql.query, which executes the statement using the standard db.Query function. At no point in this chain is the user's role checked or the SQL statement sanitized to prevent non-SELECT queries. This allows a low-privileged user to execute arbitrary SQL, leading to a complete compromise of the application's data confidentiality, integrity, and availability.