Summary
SiYuan has an information disclosure vulnerability in document search that can let unauthenticated visitors bypass per-document passwords. A broad regular-expression search may return protected document text in an unfiltered response field.
Affected context
The issue affects SiYuan versions from 3.6.0 to before 3.8.9 when the publishing interface exposes the /api/filetree/getDoc endpoint. The risk arises when regex search results include protected body text in the keywords field without applying the per-document password restriction to that returned content.
Exploit preconditions
- Attack surface: The published document search API at
/api/filetree/getDoc - Required access: No authentication is required for an unauthenticated publish visitor
- Trigger point: A POST request using
queryMethod3 and a broad regular-expression query - Why exploitation is possible: The response can contain protected document text in an unfiltered
keywordsfield, bypassing the expected per-document password check
Why this happens
The search response does not consistently enforce document-level access restrictions on all returned fields. In particular, body text can be included in the keywords field even when the document is password-protected. This is an information exposure issue mapped to CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Potential impact
- Unauthenticated visitors may read text from password-protected documents
- Sensitive or private information in document bodies could be exposed
- Exposed content could be copied or shared outside the intended audience
General mitigation guidance
Defensive patterns focus on applying authorization and password checks consistently to search queries and every field in their responses.
- Filter or omit protected document content before constructing search results
- Use secure-by-default response schemas that include only fields necessary for the caller
- Treat search expressions and other request parameters as untrusted input, and constrain their scope and complexity
- Limit anonymous access to search functionality and apply least-privilege access to published content
How teams detect issues like this
Review search handlers for authorization checks that occur after result construction or that apply only to selected response fields. Static analysis and code review can look for sensitive document fields flowing into API responses without access-control checks. Policy tests can verify that protected content remains absent from responses across search modes, including regex searches, and monitoring can flag unusual broad search requests.

