/

CVE-2026-87807

Severity:

HIGH RISK

(7.5)

SQL Injection (CWE-89) in Siyuan Full-Text Search

CVE-2026-87807

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Unauthorized data disclosure and access-control bypass

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Siyuan versions before v3.8.2 contain an authenticated SQL injection vulnerability in the fullTextSearchBlock endpoint when the method=1 query parameter is processed. An attacker with valid access may inject SQL expressions to read document blocks and sensitive attributes beyond intended publish-access controls.

Affected context

The vulnerability occurs in Siyuan's full-text block search functionality when the fullTextSearchBlock endpoint handles the method=1 query parameter. It becomes risky when authenticated users can influence query-related input and the application incorporates that input into database statements without sufficient parameterization or equivalent controls. The exposed data may include document content and attributes from the blocks table.

Exploit preconditions

  • Attack surface: The authenticated fullTextSearchBlock application endpoint
  • Required access: A valid authenticated account capable of invoking the affected search functionality
  • Trigger point: Processing the method=1 query parameter
  • Why exploitation is possible: User-controlled input can influence SQL statement structure, allowing query manipulation and retrieval of records outside normal publish-access restrictions

Why this happens

The underlying bug is SQL injection, mapped to CWE-89. The application appears to treat request-controlled search input as part of database query syntax rather than as data bound through a parameterized interface. This insecure pattern can allow injected query clauses, including set-based retrieval logic, to alter the intended database operation and expose records that authorization checks would otherwise restrict.

Potential impact

  • An attacker may read document content from the blocks table.
  • Sensitive block attributes may be disclosed.
  • Publication or visibility controls could be bypassed during data retrieval.
  • Stolen content could enable privacy breaches, intellectual property loss, or targeted follow-on attacks.
  • Database information may be used to identify additional sensitive application data.

General mitigation guidance

Mitigation generally focuses on removing user-controlled SQL syntax from database operations and preserving authorization boundaries.

Common defensive patterns include:

  • Using parameterized queries, prepared statements, or carefully maintained query builders for all search inputs.
  • Applying allowlisted validation for supported search modes and query operators.
  • Enforcing document-level authorization after query execution and before returning results.
  • Limiting database credentials to the minimum read permissions required by the search feature.
  • Avoiding broad result projections and returning only fields necessary for the request.
  • Keeping sensitive data separated from query paths that are available to ordinary authenticated users.

How teams detect issues like this

Organizations commonly detect SQL injection risks through:

  • Static analysis rules identifying string concatenation or interpolation in SQL construction.
  • Code review checks for request parameters passed directly into database APIs.
  • Dynamic testing of search endpoints with harmless query-manipulation cases and authorization-boundary tests.
  • Database monitoring for unusual UNION, comment, or schema-enumeration patterns in application-generated queries.
  • Policy enforcement requiring parameterized query APIs and security tests for authenticated data-access endpoints.

Automated application-security and code-review tools may help identify unsafe query construction, but findings should be validated against the application's authorization model.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-336w-67gx-gx2h
vulncheck.comvulncheck.com/advisories/siyuan-before-3.8.2-sql-injection-via-fulltextsearchblock

Frequently asked

questions

It may be exploitable remotely through the Siyuan search endpoint when that endpoint is reachable by an attacker who has authenticated access.

The vulnerability is described as authenticated, so an attacker generally needs a valid account and sufficient permission to invoke the affected full-text search operation. The required role may depend on deployment-specific access controls.

The safest pattern is to use parameterized database queries or a trusted query builder, validate search modes with an allowlist, and enforce authorization on every returned record.

Combine secure database APIs with code review rules, static analysis, endpoint-level security testing, least-privilege database accounts, and monitoring for anomalous query behavior.

Find out what's already
exploitable in your codebase.