Summary
SiYuan improperly applies publish-access checks when embedded block content is retrieved through specific endpoints. An attacker may use published blocks containing embed queries to access content from password-protected, hidden, or forbidden documents without the intended authorization.
Affected context
The issue occurs in SiYuan deployments where the getBlockDOMWithEmbed or getBlockDOMsWithEmbed endpoints process published blocks containing embedded content. Risk exists when embedded block resolution does not consistently enforce the publication, visibility, password, and permission rules applied to the referenced documents.
Exploit preconditions
- Attack surface: SiYuan HTTP endpoints that return block DOM content
- Required access: Ability to submit requests to the affected block retrieval endpoints; valid authentication may or may not be required depending on deployment exposure
- Trigger point: Processing a published block that contains an embed query
- Why exploitation is possible: Authorization checks for referenced embedded blocks are not adequately enforced before their content is returned
Why this happens
The underlying bug is an authorization enforcement gap. The application verifies that a requested block is available for publication but does not apply equivalent access-control checks to content pulled through embedded block queries. This behavior maps to CWE-862: Missing Authorization, where a protected resource can be accessed because the relevant permission decision is omitted or inconsistently applied.
Potential impact
- Unauthorized disclosure of content from protected documents
- Exposure of hidden or forbidden notes and blocks
- Circumvention of password or publication visibility controls
- Privacy, confidentiality, or compliance violations
- Further disclosure if exposed content contains sensitive references or credentials
General mitigation guidance
Mitigation generally focuses on making authorization checks consistent across direct and indirect content access paths.
Common defensive patterns include:
- Enforcing document- and block-level authorization for every embedded reference
- Applying publish, hidden, forbidden, and password-protection rules before content expansion
- Using a centralized authorization decision for direct and embedded resource retrieval
- Returning only content that the requesting principal is explicitly permitted to view
- Applying least-privilege service and document permissions
- Avoiding reliance on the visibility of the outer or containing block as proof of access to referenced content
How teams detect issues like this
Organizations can look for missing authorization through:
- Static analysis of endpoint handlers and embed-resolution code for inconsistent permission checks
- Code review signals where nested or referenced resources are returned without a second authorization decision
- Integration tests covering published, hidden, forbidden, and password-protected documents
- Audit-log analysis for requests that retrieve embedded content across document boundaries
- Policy enforcement requiring centralized authorization middleware for all content-returning endpoints
Automated security review tools may help identify endpoints that access related resources without corresponding access-control checks.

