GHSA-778G-GQ49-FXXJ
Publish reader reads password-protected and publish-disabled database rows via /api/export/preview
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-778G-GQ49-FXXJ divulgada · CVSS 7.5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
A publish reader can read the full contents of database (attribute-view) rows whose bound documents the owner marked password-protected or publish-disabled. The publish endpoint `POST /api/export/preview` (registered with only `CheckAuth` in `kernel/api/router.go`) builds a Markdown export of the requested document, and its attribute-view branch serializes every table row and cell without any publish-access redaction. When a publish-accessible document embeds a database that aggregates rows bound to protected documents, those protected rows are emitted verbatim in the returned HTML, even though the parallel `renderAttributeView` API path already filters exactly these rows for the same reader. No additional privilege beyond publish-reader access is required, and in a publish deployment that does not enable Basic Auth the reader is anonymous.
Root Cause
The publish-access confidentiality boundary is enforced in the API layer, not in the export layer. The export code path never applies any publish-access filter, so any reader-reachable route that reaches the attribute-view walk leaks protected rows. The attribute-view branch of `exportTree` reads the database table directly from the parsed attribute-view store and applies only display-level view filtering and sorting (which is user configuration, not access control) before emitting every row and cell value. The reader/publish-access context is never threaded into this walk, and the per-block access checker built by the handler is passed only to embed-block resolution, never to the attribute-view branch.
kernel/api/router.go:415 POST /api/export/preview -> CheckAuth only (no admin/readonly gate)
kernel/api/export.go:1107 exportPreview: builds accessChecker for readers, calls ExportPreview
kernel/model/export.go:3325 exportTree: accessChecker used ONLY in resolveEmbedR (embed blocks)
kernel/model/export.go:3634 attribute-view walk: getAttrViewTable + av.FilterWithContext/av.Sort,
kernel/model/export.go:3704 then emits every table.Rows cell (e.g. cell.Value.Block.Content
kernel/model/export.go:3735 at 3735-3737) with NO publish-access redaction
kernel/api/export.go:1145 FilterContentByPublishAccess: gates only the host document, not rowsThe negative control is the patched render path: `renderAttributeView` (`kernel/api/av.go:1374`) applies `FilterAttributeViewByPublishAccess`, which runs `FilterViewByPublishAccess` (`kernel/model/publish_access.go:565`) plus the relation/rollup redaction, dropping every row whose bound block resolves to `PublishAccessPasswordRequired` or `PublishAccessDenied`. The export path applies neither.
Impact
An attacker who is a publish reader (anonymous when the publish service runs without Basic Auth, otherwise any authenticated reader account) obtains the primary-key block text and every other cell value (text, template-rendered values, URLs, asset names and paths) of database rows that belong to password-protected or publish-disabled documents. The precondition is a common published-index-over-private-notes pattern: a public document embeds a database view that aggregates rows bound to blocks living in protected documents. The leaked cell content is a stored snapshot in the attribute-view data, so the reader receives it even without live access to the protected documents. This is a read-only confidentiality breach; it does not by itself modify data or affect availability.
Proof of Concept
`A running SiYuan kernel (v3.8.3) with the publish service enabled. Owner state: one publish-accessible document HOST that embeds a database view, and one password-protected or publish-disabled document SECRET that contributes at least one row to that view. The request context resolves to role reader (anonymous when publish Basic Auth is disabled).`
- As a publish reader, send the negative-control request to the patched render path and confirm the SECRET-bound row is absent.
- Send the export-preview request for HOST and observe the SECRET-bound row present in the returned HTML.
### 1) Negative control: the patched render path filters the protected row
POST http://127.0.0.1:6806/api/av/renderAttributeView
Content-Type: application/json
{"id":"<AV_ID>","blockID":"<HOST_DATABASE_BLOCK_ID>","pageSize":-1}
### 2) Exploit: the export-preview path renders every row unfiltered
POST http://127.0.0.1:6806/api/export/preview
Content-Type: application/json
{"id":"<HOST_DOCUMENT_ID>"}Step 1 response: "view".rows does NOT contain the SECRET-bound row (filtered).
Step 2 response: .data.html contains the database <table> INCLUDING the SECRET-bound
row (primary-key text plus all cell values), disclosed to the reader.Attack Chain
- Exposure: The publish reverse proxy (`kernel/server/proxy/publish.go`) forwards all paths to the backend with the publish account token and applies no API-path allowlist, so `/api/export/preview` is reachable by publish readers; when publish Basic Auth is disabled the anonymous account token is used.
- Control: The attacker supplies the document id of a publish-accessible host document that embeds a database view aggregating rows bound to protected documents.
- Path: `CheckAuth` (`kernel/model/session.go`) admits role reader (no `CheckReadonly` or `CheckAdminRole` on this route); `exportPreview` calls `ExportPreview` then `exportTree`, whose attribute-view walk builds the full table and iterates `table.Rows`.
- Guard: The reader-mode access checker is wired only into embed-block resolution (`resolveEmbedR`), never into the attribute-view walk; the post-processing `FilterContentByPublishAccess` evaluates only the host document pair and returns the host content verbatim because the host is accessible, so it never inspects embedded rows.
- Primitive: The attribute-view branch serializes every row and cell of the database, including rows bound to password-protected or publish-disabled documents, into the exported HTML.
- Result: The publish reader receives the primary-key text and all cell values of protected database rows that the render path denies to the same reader.
Bypass Evidence
Two protections were examined and both fail to block this vector. First, the response-level filter `FilterContentByPublishAccess` (`kernel/api/export.go:1145`, implemented at `kernel/model/publish_access.go:1297-1347`) gates only the single host document; on denial it replaces the entire HTML with a lock/deny placeholder, and on allow it returns the content unchanged; it never walks embedded database rows, so the accessible host carries the protected rows through untouched. Second, the reader access checker built in the handler is threaded only into `resolveEmbedR` (`kernel/model/export.go:3325`) for embed blocks; the attribute-view walk (`kernel/model/export.go:3634-3978`) contains no reference to it.
The strongest disproof attempts were carried out and failed to break the chain: a whole-file search of `kernel/model/export.go` for any publish-access token (`PublishAccess`, `FilterView`, `checkAttributeViewItem`, `IsReadOnlyRole`, `FilterContentByPublish`) returns no matches, confirming the export layer applies no access control of any kind; the current release (v3.8.3) already contains the prior embed-block fix associated with GHSA-8wx4-fvqw-f5f8 yet still lacks any attribute-view filter, so that fix demonstrably does not cover this path; and the display-level `av.FilterWithContext`/`av.Sort` are user-configured view settings that do not key on publish access and cannot be relied on to drop protected rows. The parallel render path `renderAttributeView` filters the identical row for the identical reader (GHSA-6mcf-g667-w3qv hardened that path in v3.7.4), which isolates the export path as the defect rather than a reformat of already-public data.
Affected Versions
- `Ecosystem: go`
- `Package: github.com/siyuan-note/siyuan/kernel`
- `Confirmed affected range: <= 3.8.3`
- `Latest release checked: v3.8.3 (commit 8641553a1f07374001902d3ce773285db1292b2d); Go module proxy pseudo-version v0.0.0-20260907031051-8641553a1f07`
- `Fix status: not fixed`
The vulnerable path was positively verified present in the exact v3.8.3 artifact. No fix exists on the latest examined release, so the upper bound is open at the current release. The introduction boundary is not proven: the reviewed checkout is a shallow clone, so the earliest affected release cannot be established from history. The attribute-view export walk predates the two publish-access hardening changes on adjacent paths (the render-path row filter and the embed-block access checker), neither of which modified this walk, so earlier publish-capable releases are very likely affected, but the earliest affected version is left unstated rather than guessed.
Suggested Fix
Enforce the publish-access confidentiality boundary inside the export layer, not only in the API handlers. Thread the reader/publish-access context into `exportTree` and, in the attribute-view branch, apply the per-row `FilterViewByPublishAccess` filter plus the relation/rollup redaction (mirroring `FilterAttributeViewByPublishAccess` on the `renderAttributeView` path) before serializing `table.Rows`, gated on the reader-role context. The remediation must cover both reader-reachable callers of this walk: `POST /api/export/preview` and `POST /api/lute/copyStdMarkdown`. As an interim mitigation, operators can restrict the publish service (enable Basic Auth and limit reader accounts) and avoid embedding databases that aggregate protected documents into publicly published documents. Add regression coverage for a publish-accessible document that embeds a database containing a password-protected or publish-disabled row.
Reported by zx (GitHub: @manus-pi).
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Gogithub.com/siyuan-note/siyuan/kernel |
Sin parche | — | — | — |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/siyuan-note/siyuan/security/advisories/GHSA-778g-gq49-fxxjLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
