SiYuan has an arbitrary file deletion vulnerability
Description
SiYuan is self-hosted, open source personal knowledge management software. SiYuan Note version 3.1.18 has an arbitrary file deletion vulnerability. The vulnerability exists in the POST /api/history/getDocHistoryContent endpoint. An attacker can craft a payload to exploit this vulnerability, resulting in the deletion of arbitrary files on the server. Commit d9887aeec1b27073bec66299a9a4181dc42969f3 fixes this vulnerability and is expected to be available in version 3.1.19.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
github.com/siyuan-note/siyuan/kernelGo | >= 0 | — |
Affected products
1- Range: = 3.1.18
Patches
1d9887aeec1b2:lock: Arbitrary file deletion vulnerability https://github.com/siyuan-note/siyuan/issues/13709
1 file changed · +9 −2
kernel/model/history.go+9 −2 modified@@ -18,6 +18,7 @@ package model import ( "encoding/json" + "errors" "fmt" "io/fs" "math" @@ -148,6 +149,13 @@ func ClearWorkspaceHistory() (err error) { } func GetDocHistoryContent(historyPath, keyword string, highlight bool) (id, rootID, content string, isLargeDoc bool, err error) { + if !util.IsAbsPathInWorkspace(historyPath) { + msg := "Path [" + historyPath + "] is not in workspace" + logging.LogErrorf(msg) + err = errors.New(msg) + return + } + if !gulu.File.IsExist(historyPath) { logging.LogWarnf("doc history [%s] not exist", historyPath) return @@ -163,8 +171,7 @@ func GetDocHistoryContent(historyPath, keyword string, highlight bool) (id, root luteEngine := NewLute() historyTree, err := filesys.ParseJSONWithoutFix(data, luteEngine.ParseOptions) if err != nil { - logging.LogErrorf("parse tree from file [%s] failed, remove it", historyPath) - os.RemoveAll(historyPath) + logging.LogErrorf("parse tree from file [%s] failed: %s", historyPath, err) return } id = historyTree.Root.ID
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
4- github.com/advisories/GHSA-8fx8-pffw-w498ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2025-21609ghsaADVISORY
- github.com/siyuan-note/siyuan/commit/d9887aeec1b27073bec66299a9a4181dc42969f3ghsax_refsource_MISCWEB
- github.com/siyuan-note/siyuan/security/advisories/GHSA-8fx8-pffw-w498ghsax_refsource_CONFIRMWEB
News mentions
0No linked articles in our index yet.