GHSA-4vpg-gwqq-w44c: High severity go/github.com/siyuan-note/siyuan/kernel vulnerability

Published Oct 2, 2026
·
Updated

Same CWE-862 family, found via an automated bulk sweep of every /api/block/ handler in kernel/api/block.go for the presence of any access-check reference (IsReadOnlyRoleContext, checkBlockPublishAccess, GetPublishAccess) anywhere in the function body. 17 of 28 candidate endpoints have none. Cross-checked against the file's own sibling functions (getBlockInfo, getBlockDOM, getRefIDs, etc.), which correctly implement the check, confirming this is a real, uneven gap rather than a deliberate design choice for the whole file.

Summary 17 handlers in kernel/api/block.go, all gated only by model.CheckAuth with no admin-role requirement, return block content-derived text, structural metadata, or existence information for any block ID supplied, with no access check anywhere in the handler or, for the ones checked in detail, the model functions they call. This is CWE-862 (Missing Authorization), the same class as the companion advisories from this review round, found in a different file via a systematic bulk check rather than manual inspection of each function individually.

Details Confirmed via automated extraction of every function body between func NAME(c gin.Context) { and the next such declaration, then searching each for any of IsReadOnlyRoleContext, checkBlockPublishAccess, GetPublishAccess, or PublishAccess. The following contain none of these, at all:

| Endpoint | What it discloses | |---|---| | getRefText | The block's actual reference-display text, derived from its content, for any ID (kernel/api/block.go:564) | | getBlockBreadcrumb | The block's breadcrumb/title path (:?) | | getBlockDefIDsByRefText | Which block IDs a given reference text resolves to | | getRefIDsByFileAnnotationID | Block IDs referencing a given PDF/file annotation | | getBlockIndex / getBlocksIndexes | A block's position/index within its document | | getTreeStat | Structural statistics for a document tree | | getBlocksWordCount / getContentWordCount | Word/character counts for arbitrary content | | checkBlockExist / checkBlocksExist | Existence oracle for any block ID | | getUnfoldedParentID | The nearest unfolded ancestor of a block | | checkBlockFold | Whether a block is currently folded | | getBlockSiblingID | A block's sibling in document order | | getBlockRelevantIDs | IDs of blocks related to a given block | | getBlockTreeInfos | Block tree metadata for a set of IDs | | checkBlockRef | Whether a block is referenced elsewhere |

The clearest, most severe example, getRefText (POST /api/block/getRefText, kernel/api/router.go:238): go func getRefText(c gin.Context) { ... id := arg["id"].(string) if util.InvalidIDPattern(id, ret) { return } var refText string if notebook, ok := arg["notebook"].(string); ok && notebook != "" && model.IsEncryptedBox(notebook) { refText = model.GetBlockRefTextInBox(id, notebook) } else { refText = model.GetBlockRefText(id) } ... ret.Data = refText } model.GetBlockRefText(id) resolves the actual display text used wherever this block is referenced, ordinarily derived from the block's real content, for any id in the workspace, with no scoping.

For contrast, sibling functions in the same file correctly implement the check, e.g. getRefIDs (kernel/api/router.go:235) and getBlockInfo/getBlockDOM/getBlockKramdown all contain if model.IsReadOnlyRoleContext(c) { ... } guards. This confirms the 17 above are an inconsistency within the file, not an intentional decision that the whole file is exempt from this control.

Step-by-step reproduction bash id: a block inside a document that was never published, or is Disable=true in publish access curl -s -X POST http://<target>:6806/api/block/getRefText \ -H "Content-Type: application/json" -d '{"id":"<private-block-id>"}' Returns the block's actual reference text with no session, no AccessAuthCode, no publish password.

curl -s -X POST http://<target>:6806/api/block/checkBlockExist \ -H "Content-Type: application/json" -d '{"id":"<guessed-block-id>"}' Confirms or denies existence of any guessed ID workspace-wide. Repeat against any of the other 15 endpoints in the table above, substituting their expected arguments, each returns data with no access check.

Impact Any published SiYuan workspace discloses block-level content-derived text, structural metadata, and existence information for the entire workspace, not just published notebooks, to any anonymous internet visitor. getRefText in particular discloses real content text, not just metadata, for any block ID. The existence-oracle endpoints (checkBlockExist/checkBlockRef) combine with the companion advisory's getIDsByHPath title-guessing primitive to let an attacker efficiently probe for and confirm private content without ever needing legitimate access.

Affected products

| Field | Value | |---|---| | Ecosystem | Go | | Package name | github.com/siyuan-note/siyuan/kernel | | Affected versions | Present at current HEAD (commit eef1056/1673b75, reviewed 2026-08-03) | | Patched versions | (none yet, leave blank until a fix is released) |

Severity

| Field | Value | |---|---| | Vector string | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N | | Score | 7.5 (High). Network vector, low complexity, no privileges or user interaction required, high confidentiality impact via getRefText's real content-text disclosure plus the combined structural/existence oracle from the other 16, no integrity/availability impact since all 17 are read-only. |

Weaknesses (CWE)

- CWE-862: Missing Authorization (primary) - CWE-204: Observable Response Discrepancy (contributing, via the existence-oracle endpoints)

Notes for filing - Same CWE-862 family as the two companion advisories from this review round (asset/attribute-view listing, and path/title resolution). Recommend the maintainers treat all three as one remediation pass: grep every /api/ handler for the literal presence of IsReadOnlyRoleContext and manually audit every one that lacks it, rather than fixing endpoint-by-endpoint, since the pattern has now recurred across three separate files. - Suggested fix: add if model.IsReadOnlyRoleContext(c) { ... } guards matching the pattern already correctly used by this file's own getBlockInfo/getBlockDOM/getRefIDs functions.

Affected Software

1 affected componentFixes available
go/github.com/siyuan-note/siyuan/kernel<0.0.0-20260804015139-bd067a4fe9b2
0.0.0-20260804015139-bd067a4fe9b2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade go/github.com/siyuan-note/siyuan/kernel to a version that resolves this vulnerability.

    Fixed in 0.0.0-20260804015139-bd067a4fe9b2
  2. Compensating control

    Add model.IsReadOnlyRoleContext(c) authorization guards, following the pattern used by sibling functions, to getRefText and the other affected /api/block handlers lacking this check, including the block existence-oracle endpoints; audit all 17 affected handlers.

Event History

Oct 2, 2026
Advisory Published
via GitHub·11:05 PM
Data Sourced
via GitHub·11:05 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Does exploitation require administrator privileges?

No. The affected handlers are gated by model.CheckAuth, but they do not enforce an admin-role or block publish-access check. An authenticated user can supply a block ID to query the affected endpoints.

2

What information could an unauthorized caller obtain?

The affected handlers can return block content-derived text, structural metadata, or information indicating whether a supplied block ID exists. The reported impact is confidentiality loss; no integrity or availability impact is identified.

3

Is this limited to a single block API handler?

No. The review identified 17 of 28 candidate handlers in kernel/api/block.go without an access-check reference. Sibling functions such as getBlockInfo, getBlockDOM, and getRefIDs were noted as correctly implementing access checks, indicating uneven enforcement.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203