{"id":"CVE-2026-72796","aliases":["CVE-2026-72796","GHSA-fgmr-7w36-9qfq","GO-2026-6423"],"related":[],"kind":"vulnerability","state":"published","title":"SiYuan before v3.7.4 Access Control Bypass via Static Routes","summary":"SiYuan before v3.7.4 contains an access control bypass vulnerability where static-file routes in the server mux bypass publish-access controls enforced on the REST API. Attackers with publish reader tokens or anonymous access in disabled-auth mode can read templates, snippets, and export artifacts by directly accessing static routes that lack the same restrictions as their REST API counterparts.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"SiYuan before v3.7.4 contains an access control bypass vulnerability where static-file routes in the server mux bypass publish-access controls enforced on the REST API. Attackers with publish reader tokens or anonymous access in disabled-auth mode can read templates, snippets, and export artifacts by directly accessing static routes that lack the same restrictions as their REST API counterparts.","source":"cvelist"},{"lang":"en","text":"**CVE:** This vulnerability corresponds to [CVE-2026-72796](https://nvd.nist.gov/vuln/detail/CVE-2026-72796).\n\n### Summary\n\nSeveral static-file routes in the server mux (`kernel/server/serve.go`) are registered with `CheckAuth` only and serve directories directly, without the publish-access checks, sensitive-path blocklist, or `refuseToAccess` rules that the REST API applies to the same data. They are therefore reachable by the publish `RoleReader` token and by the anonymous account when `Publish.Auth.Enable` is `false`.\n\nMost notably, `/templates/` serves `data/templates` a directory the REST file API explicitly refuses to serve to non-administrators.\n\n### Details\n\n| Route | Registration | Guard | Exposed to a reader |\n|---|---|---|---|\n| `/templates/*` (line 424) | `Group(\"/templates/\", model.CheckAuth).Static(\"\", data/templates)` | none beyond path cleaning | the templates directory |\n| `/snippets/*` (line 434) | `CheckAuth` | blocks only `conf.json` | any snippet's JS/CSS content by name |\n| `/widgets/`, `/plugins/`, `/emojis/` (409/414/419) | `Group(CheckAuth).Static(dir)` | none | whole directory trees |\n| `/export/*` (line 320) | `Group(\"/export/\", CheckAuth)` | traversal, sensitive-path and DEK guards: **no publish check** | export artifacts (PDF/HTML/DOCX/CSV) |\n\n**`/templates/` directly contradicts an existing control.** The REST file path runs `refuseToAccess` (`kernel/api/file.go:551-553`), which explicitly returns 403 for `data/templates/` to non-administrators the project has already decided readers must not read templates. The `/templates/` static route serves that same directory to any `RoleReader`, with no `IsSensitivePath` check, no publish-access check, and no `refuseToAccess`. Templates are user-authored Markdown documents containing template/Sprig syntax and are not covered by publish-access controls. `gin`'s `.Static` disables directory listing, so a filename is required but the contradiction with `refuseToAccess` is the defect.\n\n**`/export/` versus `/assets/`.** `/assets/*path` (line 692) correctly gates non-administrators via `CheckAbsPathAccessableByPublishAccess`, plus `IsSensitivePath` and encrypted-asset handling. `/export/` carries traversal, sensitive-path and DEK guards but no publish-access check, so a reader can retrieve export artifacts of arbitrary documents, including private ones. Artifact naming is mixed, some use a random export ID, but code and CSV exports use the document name (`export/code/<name>`, `export/csv/<name>/<name>.csv`), which a reader can derive from `listDocsByPath` titles while the artifact exists. This path is therefore conditional.\n\n**Confirmed correctly gated, for contrast:** `/assets/*` (publish-gated), `/history/*` and `/repo/diff/*` (`CheckAdminRole`), `/debug/pprof/*` (disabled in production builds), `/public/` (intentionally public).\n\nAll four routes above were verified to carry `CheckAuth` only, no `CheckReadonly`, no `CheckAdminRole`.\n\n### Proof of Concept\n\nPrecondition: publish mode enabled (default port 6808), anonymous when `Publish.Auth.Enable` is `false`, otherwise any publish reader account.\n\n**Templates: served despite the REST API refusing them:**\n```\nGET http://127.0.0.1:6808/templates/<template-file>.md\n→ 200, template content\n```\nThe equivalent REST request is refused:\n```\nPOST http://127.0.0.1:6808/api/file/getFile\n{\"path\":\"data/templates/<template-file>.md\"}\n→ 403 (refuseToAccess)\n```\nThe same reader session obtains the file through the static route.\n\n**Snippets:**\n```\nGET http://127.0.0.1:6808/snippets/<snippet-name>.js\n→ 200, snippet source\n```\n\n**Export artifacts (conditional on a predictable name while the artifact exists):**\n```\nGET http://127.0.0.1:6808/export/csv/<doc-name>/<doc-name>.csv\n→ 200, exported content of a document the reader has no publish access to\n```\n\n### Impact\n\nAn anonymous reader (publish mode with auth disabled) or any publish `RoleReader` can read user-authored template documents that the REST API explicitly withholds from non-administrators, snippet source (JS/CSS), and the contents of the widgets, plugins and emoji directories. Where an export artifact exists under a derivable name, they can additionally retrieve exported content of documents outside their publish scope. Confidentiality-only.\n\n### Suggested fix\n\nApply the same treatment these routes' REST counterparts already receive: for non-administrator roles, enforce publish-access scoping plus `IsSensitivePath` and the `refuseToAccess` blocklist on the static routes, mirroring `/assets/*`. Alternatively, block `/templates/`, non-public `/snippets/`, and `/export/` for reader roles entirely.","format":"markdown","source":"ghsa"},{"lang":"en","text":"SiYuan: Static-file routes bypass the publish-access controls enforced on the REST API, exposing templates, snippets and export artifacts to anonymous readers in github.com/siyuan-note/siyuan/kernel","format":"markdown","source":"go"},{"lang":"es","text":"SiYuan antes de la v3.7.4 contiene una vulnerabilidad de omisión de control de acceso donde las rutas de archivos estáticos en el multiplexor del servidor eluden los controles de acceso de publicación aplicados en la API REST. Atacantes con tokens de lector de publicación o acceso anónimo en modo de autenticación deshabilitada pueden leer plantillas, fragmentos y artefactos de exportación accediendo directamente a rutas estáticas que carecen de las mismas restricciones que sus contrapartes de la API REST.","source":"nvd"}],"published":"2026-08-12T19:07:43.068Z","modified":"2026-10-24T15:10:00.190Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:L/SI:N/SA:N","score":6.9,"rating":"MEDIUM"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:L/SI:N/SA:N","score":6.9,"rating":"MEDIUM"},{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N","score":5.8,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N","score":5.8,"rating":"MEDIUM"}],"cwes":["CWE-862"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"3.7.4","status":"affected"},{"type":"semver","version":"3.7.4","status":"unaffected"}],"vendor":"siyuan-note","product":"siyuan","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.0.0-20260725122641-34be6c0bb073"}],"ecosystem":"Go","package":"github.com/siyuan-note/siyuan/kernel","purl":"pkg:golang/github.com/siyuan-note/siyuan/kernel","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.0.0-20260725122641-34be6c0bb073"}],"ecosystem":"Go","package":"github.com/siyuan-note/siyuan/kernel","purl":"pkg:golang/github.com/siyuan-note/siyuan/kernel","source":"go"}],"references":[{"url":"https://github.com/siyuan-note/siyuan/security/advisories/GHSA-fgmr-7w36-9qfq","tags":["advisory","vendor-advisory","web"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://www.vulncheck.com/advisories/siyuan-before-access-control-bypass-via-static-routes","tags":["third-party-advisory","web"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-72796","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/siyuan-note/siyuan/commit/34be6c0bb0739d5b8e99ecc0cbfb474abb16230d","tags":["web"],"sources":["ghsa","go"]},{"url":"https://github.com/siyuan-note/siyuan","tags":["package"],"sources":["ghsa"]}],"credits":["Shirshakhtml"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-08-12T19:47:52.179Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-72796","url":"https://www.cve.org/CVERecord?id=CVE-2026-72796","licence":"CVE Terms of Use","modified":"2026-08-14T16:52:04.498Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-fgmr-7w36-9qfq","url":"https://github.com/advisories/GHSA-fgmr-7w36-9qfq","licence":"CC-BY-4.0","modified":"2026-09-10T15:25:50.670Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-6423","url":"https://pkg.go.dev/vuln/GO-2026-6423","licence":"CC-BY-4.0","modified":"2026-09-10T15:15:15.615Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-72796","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-72796","licence":"Public domain","modified":"2026-10-24T15:10:00.190Z"}],"updatedAt":"2026-11-25T22:59:32.632Z","epss":{"score":0.00257,"percentile":0.18496,"date":"2026-12-01T12:00:22.000Z"}}