CVE-2026-40259: SiYuan: Publish Reader Can Arbitrarily Delete Attribute View Files via `/api/av/removeUnusedAttributeView`
Summary An authenticated publish-service reader can invoke /api/av/removeUnusedAttributeView and cause persistent deletion of arbitrary attribute view (AV) definition files from the workspace. The route is protected only by generic CheckAuth, which accepts publish RoleReader requests.
Published Apr 10, 2026 · Updated Apr 24, 2026
Affected packages
github.com/siyuan-note/siyuan/kernel
- Ecosystem
- Go
- Affected
- < 0.0.0-20260407035653-2f416e5253f1
- Fixed in
- 0.0.0-20260407035653-2f416e5253f1
- Check
go list -m github.com/siyuan-note/siyuan/kernel
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
An authenticated publish-service reader can invoke /api/av/removeUnusedAttributeView and cause persistent deletion of arbitrary attribute view (AV) definition files from the workspace.
The route is protected only by generic CheckAuth, which accepts publish RoleReader requests. The handler forwards a caller-controlled id directly into a model function that deletes data/storage/av/<id>.json without verifying either:
- that the caller is allowed to perform write/destructive actions; or
- that the target AV is actually unused.
This is a persistent integrity and availability issue reachable from the publish surface.
Root Cause
1. Publish users are issued a RoleReader JWT
- [kernel/model/auth.go](/root/audit/siyuan/kernel/model/auth.go#L105)
ClaimsKeyRole: RoleReader,2. The publish reverse proxy forwards that token upstream
- [kernel/server/proxy/publish.go](/root/audit/siyuan/kernel/server/proxy/publish.go#L131)
- [kernel/server/proxy/publish.go](/root/audit/siyuan/kernel/server/proxy/publish.go#L186)
3. CheckAuth accepts RoleReader
- [kernel/model/session.go](/root/audit/siyuan/kernel/model/session.go#L201)
if role := GetGinContextRole(c); IsValidRole(role, []Role{
RoleAdministrator,
RoleEditor,
RoleReader,
}) {
c.Next()
return
}4. The route is exposed with CheckAuth only
- [kernel/api/router.go](/root/audit/siyuan/kernel/api/router.go#L507)
ginServer.Handle("POST", "/api/av/removeUnusedAttributeView", model.CheckAuth, removeUnusedAttributeView)There is no CheckAdminRole and no CheckReadonly.
5. The handler forwards attacker-controlled id directly to the delete sink
- [kernel/api/av.go](/root/audit/siyuan/kernel/api/av.go#L32)
avID := arg["id"].(string)
model.RemoveUnusedAttributeView(avID)6. The model deletes the AV file unconditionally
- [kernel/model/attribute_view.go](/root/audit/siyuan/kernel/model/attribute_view.go#L49)
func RemoveUnusedAttributeView(id string) {
absPath := filepath.Join(util.DataDir, "storage", "av", id+".json")
if !filelock.IsExist(absPath) {
return
}
...
if err = filelock.RemoveWithoutFatal(absPath); err != nil {
...
return
}
IncSync()
}Crucially, this function does not verify that the supplied AV is actually unused. The name of the function suggests a cleanup helper, but the implementation is really "delete AV file by id if it exists".
Attack Prerequisites
- Publish service enabled
- Attacker can access the publish service
- If publish auth is enabled, attacker has valid publish-reader credentials
- Attacker knows an
avID
Obtaining avID
avID is not secret. It is exposed extensively in frontend markup as data-av-id.
Examples:
- [app/src/protyle/render/av/render.ts](/root/audit/siyuan/app/src/protyle/render/av/render.ts#L117)
- [app/src/protyle/render/av/layout.ts](/root/audit/siyuan/app/src/protyle/render/av/layout.ts#L120)
- [app/src/protyle/render/av/groups.ts](/root/audit/siyuan/app/src/protyle/render/av/groups.ts#L52)
Any publish-visible database/attribute view can therefore disclose a valid avID to the attacker.
Exploit Path
- Attacker browses published content containing an attribute view.
- Attacker extracts the
data-av-idvalue from the page/DOM. - Attacker sends a POST request to
/api/av/removeUnusedAttributeViewthrough the publish service. - Publish proxy injects a valid
RoleReadertoken. CheckAuthaccepts the request.- The handler passes the attacker-controlled
avIDtomodel.RemoveUnusedAttributeView. - The backend deletes
data/storage/av/<avID>.json.
Proof of Concept
Request:
POST /api/av/removeUnusedAttributeView HTTP/1.1
Host: <publish-host>:<publish-port>
Content-Type: application/json
Authorization: Basic <publish-account-creds-if-enabled>
{
"id": "<exposed-data-av-id>"
}Expected result:
- HTTP 200
- backend increments sync state
- the target attribute view file is removed from
data/storage/av/ - published and local workspace behavior for that AV becomes broken until restored from history or recreated
Impact
This gives a low-privileged publish reader a destructive persistent write primitive against workspace data.
Practical consequences include:
- deletion of live attribute view definitions
- corruption/breakage of published database views
- breakage of local workspace rendering and AV-backed relationships
- operational disruption until restore or manual repair
The bug affects integrity and availability, not merely UI state.
Recommended Fix
At minimum:
- Block publish/read-only users from this route.
- Require admin/write authorization.
- Re-validate that the target AV is actually unused before deletion.
Safe router fix:
ginServer.Handle("POST", "/api/av/removeUnusedAttributeView",
model.CheckAuth,
model.CheckAdminRole,
model.CheckReadonly,
removeUnusedAttributeView,
)And inside the model or handler, reject deletion unless the target id is present in UnusedAttributeViews(...).
Credited to ch1nhpd.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Go vulnerabilities
All Go entriesCVE-2026-60083
SiYuan: MCP file tool's blocklist is incomplete relative to the HTTP file API it claims to align with, exposing publish-mode passwords and other sensitive workspace files
medium4.9Oct 27, 2026CVE-2026-62204
SiYuan: Missing consistency check between packageName and repoURL/repoHash in bazaar package install allows overwriting an existing, trusted plugin
medium6.6Oct 23, 2026CVE-2026-73049
SiYuan: The publish filter for database backlinks consults the forbidden list instead of the visibility list, disclosing hidden-tier documents to anonymous readers
medium5.8Oct 23, 2026CVE-2026-73054
SiYuan: A parser differential between the WebSocket keepalive exemption and the session quarantine allows unauthenticated access to the broadcast event stream
high7.5Oct 23, 2026CVE-2026-73630
SiYuan: authFilePublishAccess distinguishes hidden and forbidden documents from public and nonexistent ones, and issues a publish-auth cookie for documents it reports as forbidden
medium5.8Oct 23, 2026GHSA-xp3q-r38w-vgqm
SiYuan: The publish filter for local storage returns the administrator's entire storage map with only three keys sanitized
medium5.8Oct 23, 2026
