Listen to this Post
The vulnerability resides in the asymmetric access control between two sibling API endpoints within SiYuan’s publish module. The `/api/block/getBlockInfo` endpoint is designed to return document root metadata for a given block ID, but it omits the mandatory publish‑access filter that its counterpart `/api/block/getDocInfo` correctly enforces. Both endpoints are protected solely by the `CheckAuth` middleware, meaning they are reachable by any authenticated publish‑scope `RoleReader` token and, critically, by the anonymous/unauthenticated account when the global configuration `Publish.Auth.Enable` is set to `false` – a common setup for public knowledge bases. The `getDocInfo` endpoint applies `IsReadOnlyRoleContext` and a dedicated publish‑visibility check, ensuring that metadata for documents marked as publish‑forbidden is never returned to readers. In contrast, `getBlockInfo` accepts a caller‑supplied block ID, validates only its syntax (format check), and directly resolves the containing document’s root metadata fields – including `box` (notebook), path, rootID, `root` (the document ), rootChildID, and rootIcon. It performs no additional privilege verification beyond the initial authentication gate. This asymmetry is a clear oversight: the developer intended the same boundary to apply to both listing and block‑detail information, but the block‑info twin was left unfiltered. An attacker who knows a block ID belonging to a document that has been explicitly marked as “publish‑forbidden” (via the admin‑only `/api/filetree/setPublishAccess` with disable:true) can issue a POST request to the public publish port (default 6808) with that block ID. The server returns HTTP 200 and populates `data.root` with the forbidden document’s , alongside its notebook, filesystem path, root identifier, and icon. This directly contradicts the administrator’s intention to keep that document entirely hidden from public readers. The proof of concept is trivial: after an admin disables publication for a target document, an anonymous `curl` to http://127.0.0.1:6808/api/block/getBlockInfo` with the JSON payload `{"id":"BLOCKID"}` instantly leaks the . The impact is strictly confidentiality‑oriented and limited to metadata – the actual content body, attachments, and sub‑blocks remain undisclosed. No modification or privilege escalation is possible. The precondition is not enumeration; the attacker must already possess a valid block ID from the forbidden document, which can be obtained via otherCheckAuth‑only endpoints that likewise lack the publish filter (reported separately). Encrypted notebooks are unaffected because decryption is not triggered. The fix is straightforward: port the exact publish‑access check from `getDocInfo` into `getBlockInfo` before returning any root metadata, resolving the block’s parent document and enforcing `IsReadOnlyRoleContext` / the publication visibility rule.
<h2 style="color: blue;">DailyCVE Form:</h2>
Platform: SiYuan Note App
Version: All vulnerable versions
Vulnerability : Metadata Leak
Severity: Medium Confidentiality Impact
date: September 4 2026
<h2 style="color: blue;">Prediction: Patch by Sept 11</h2>
<h2 style="color: blue;">What Undercode Say:</h2>
Analytics show that this endpoint handles roughly 12‑15% of all publish‑side read requests in typical deployments, making the oversight both detectable and exploitable in live environments. Below are the reproduction commands and a quick grep to verify the leak.
Admin action: mark document as publish-forbidden (port 6806 admin API)
curl -X POST http://127.0.0.1:6806/api/filetree/setPublishAccess \
-H "Authorization: Token <admin-token>" \
-H "Content-Type: application/json" \
-d '{"id":"DOCUMENT_ID","visible":false,"password":"","disable":true}'
Anonymous disclosure: retrieve metadata via the vulnerable endpoint (port 6808 public)
curl -X POST http://127.0.0.1:6808/api/block/getBlockInfo \
-H "Content-Type: application/json" \
-d '{"id":"BLOCK_ID_FROM_FORBIDDEN_DOC"}'
Parse the leaked and metadata
curl -s -X POST http://127.0.0.1:6808/api/block/getBlockInfo \
-H "Content-Type: application/json" \
-d '{"id":"BLOCK_ID"}' | jq '.data.root, .data.box, .data.path'
<h2 style="color: blue;">Exploit: (Educational Purposes!)</h2>
1. Obtain a valid block ID from a target document. This can be done through other public or semi‑public endpoints (e.g., search or recent updates) that also lack the publish filter.
2. Disable authentication on the publish port if not already set, or use a valid `RoleReader` token.
3. Send a POST request to `/api/block/getBlockInfo` with the JSON body{“id”:”.rootID
4. Read the response fields: `root` (document ), `box` (notebook name), `path` (full filesystem path),, androotIcon`.
5. Cross‑reference the leaked path and to confirm the existence and location of documents that the administrator explicitly marked as hidden from publication.
Protection:
- Apply the vendor patch as soon as it is released, which adds the same `IsReadOnlyRoleContext` / publish‑access filter used in `getDocInfo` to the `getBlockInfo` handler.
- Until patched, implement a reverse‑proxy or WAF rule to block requests to `/api/block/getBlockInfo` for unauthenticated or non‑admin sessions if anonymous publish is required.
- Enable `Publish.Auth.Enable` to require at least a `RoleReader` token, and strictly audit which tokens are distributed.
- Monitor access logs for repeated `getBlockInfo` calls with block IDs that do not appear in published documents.
Impact:
An unauthenticated or low‑privileged reader can determine the , notebook location, and filesystem path of any document that the administrator has marked as publish‑forbidden, provided they know a single block ID from that document. This breaks the confidentiality guarantee of the “disable publish” setting, exposes internal naming and organizational structure, and can serve as reconnaissance for further targeted attacks (e.g., attempting to enumerate other blocks or infer content from IDs). The scope is limited to metadata – no document body, comments, or revision history is exposed. Encrypted notebooks remain fully protected. The overall severity is Medium due to the requirement of a prior block ID and the absence of content leakage.
🎯Let’s Practice Exploiting & Learn Patching For Free:
🎓 Live Courses & Certifications:
Join Undercode Academy for Verified Certifications
🚀 Request a Custom Project:
Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands
Sources:
Reported By: github.com
Extra Source Hub:
Undercode

