Summary
SiYuan before v3.7.4 lacks authorization checks on multiple block metadata and content endpoints. An anonymous reader in publish mode may use these endpoints to disclose private block-derived text, structural metadata, or whether arbitrary blocks exist when the identifiers are known.
Affected context
The vulnerability occurs in SiYuan's block API handlers in kernel/api/block.go, including endpoints such as getRefText, checkBlockExist, and getBlockBreadcrumb. Deployments are at risk when publish-mode readers can reach these handlers and the endpoints rely on basic authentication without applying authorization checks that distinguish public content from private workspace data.
Exploit preconditions
- Attack surface: HTTP block metadata and content endpoints exposed by the SiYuan service
- Required access: Access as an anonymous publish-mode reader; valid authentication beyond that may not be required
- Trigger point: Requests to affected endpoints using block identifiers
- Why exploitation is possible: The handlers perform basic authentication checks but do not consistently enforce publish-access permissions before returning block-derived information
Why this happens
The underlying bug is a missing authorization decision in sensitive API handlers. Authentication establishes that a request can reach the service, but the affected endpoints do not adequately verify whether the requester is permitted to access the referenced block or its derived metadata. This maps to CWE-862: Missing Authorization, where access-control enforcement is omitted or insufficient for a protected resource.
Potential impact
- Private block-derived text could be disclosed
- Workspace structure and block relationships could be revealed
- Attackers could determine whether arbitrary block identifiers exist
- Exposed metadata could support targeted discovery of sensitive content
- Privacy boundaries between published and private workspace data could be weakened
General mitigation guidance
Mitigation generally focuses on enforcing authorization at every endpoint that returns block content or metadata.
Common defensive patterns include:
- Applying publish-access filtering before retrieving or returning block data
- Centralizing authorization checks so individual handlers cannot omit them
- Defaulting unclassified or inaccessible blocks to deny
- Avoiding disclosure of existence information for unauthorized resources
- Limiting service and workspace permissions according to least privilege
- Testing anonymous and publish-mode access separately from authenticated workspace access
How teams detect issues like this
Organizations can identify similar issues through:
- Static analysis and code review rules requiring authorization checks on sensitive handlers
- Reviews of routes that accept object or block identifiers
- Endpoint matrices that compare authentication requirements with resource-level permissions
- Integration tests for anonymous, publish-mode, and authorized workspace users
- Policy checks ensuring private content and existence metadata are denied by default
- Neutral automated security review tools that flag handlers returning protected data without an explicit authorization decision

