Summary
SiYuan's /api/block/getDOMText endpoint can return cached OCR text for a referenced image without checking whether the caller is authorized to access that image. When publish authentication is disabled, an anonymous visitor who knows the path to an unpublished, non-encrypted asset may be able to retrieve its OCR text.
Affected context
The issue affects SiYuan releases described as 3.6.0 before 3.6.2 and 3.7.3 before 3.8.10. It occurs in the /api/block/getDOMText endpoint, which renders caller-supplied DOM that can reference image paths. The reported exposure depends on publish authentication being disabled and the referenced asset being unpublished, non-encrypted, and already associated with cached OCR text.
Exploit preconditions
- Attack surface: The
/api/block/getDOMTextendpoint - Required access: No authentication is required when publish authentication is disabled; the caller must know a qualifying asset path.
- Trigger point: The endpoint processes caller-supplied DOM containing a reference to that asset.
- Why exposure is possible: The endpoint does not check publish access for referenced image paths before returning cached OCR text.
Why this happens
The endpoint processes caller-supplied DOM and resolves referenced image paths without applying the access-control checks required for published content. This is a missing authorization check, mapped to CWE-862: Missing Authorization. The underlying insecure pattern is allowing a resource to be accessed through an indirect reference without verifying that the requester is permitted to view it.
Potential impact
- An anonymous visitor may retrieve cached OCR text associated with a known unpublished, non-encrypted asset.
- Sensitive information captured in that OCR text could be disclosed.
- The exposure may undermine confidentiality expectations for content not intended for publication.
General mitigation guidance
Defensive patterns focus on enforcing authorization consistently at the point where referenced resources are resolved.
- Check publish access for every referenced asset before returning content derived from it.
- Apply the same access policy to cached OCR results as to the underlying asset.
- Treat caller-supplied DOM and resource paths as untrusted, and resolve references only through controlled, validated mechanisms.
- Prefer secure-by-default publishing settings and avoid exposing content when authentication is disabled unless access is explicitly intended.
- Limit the data returned by the endpoint to the minimum required and ensure the service operates with only necessary privileges.
How teams detect issues like this
- Use static analysis and code review to find endpoint handlers that resolve caller-supplied resource paths without an authorization check.
- Review whether access checks are performed before cached or derived content is returned, including OCR results.
- Test requests involving unpublished assets under both authenticated and unauthenticated publishing configurations.
- Enforce policies requiring authorization checks for every resource lookup and cache retrieval.
- Automated security review tools may help identify missing checks in request-handling paths.

