Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS04Zng4LXBmZnctdzQ5OM4ABC8f
SiYuan has an arbitrary file deletion vulnerability
Summary
A arbitrary file deletion vulnerability has been identified in the latest version of Siyuan Note. 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.
Details
The vulnerability can be reproduced by sending a crafted request to the /api/history/getDocHistoryContent
endpoint.
Sending a request to the /api/history/getDocHistoryContent
like:
curl "http://127.0.0.1:6806/api/history/getDocHistoryContent" -X POST -H "Content-Type: application/json" -d '{"historyPath":"<abs_filepath_of_a_file>"}'
Replace <abs_filepath_of_a_file>
with the absolute file path of the target file you wish to delete.
The historyPath
parameter in the payload is processed by the func getDocHistoryContent
in api/history.go:133
.
In turn, historyPath
is passed to the func GetDocHistoryContent
located in model/history.go:150
, which is the slink of the vulnerability.
if historyPath
exists and does not satisfy the filesys.ParseJSONWithoutFix
, then it will be deleted by os.RemoveAll
func GetDocHistoryContent(historyPath, keyword string, highlight bool) (id, rootID, content string, isLargeDoc bool, err error) {
if !gulu.File.IsExist(historyPath) {
logging.LogWarnf("doc history [%s] not exist", historyPath)
return
}
data, err := filelock.ReadFile(historyPath)
if err != nil {
logging.LogErrorf("read file [%s] failed: %s", historyPath, err)
return
}
isLargeDoc = 1024*1024*1 <= len(data)
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)
return
}
...
}
PoC
curl "http://127.0.0.1:6806/api/history/getDocHistoryContent" -X POST -H "Content-Type: application/json" -d '{"historyPath":"<abs_filepath_of_a_file>"}'
Impact
arbitrary file deletion vulnerability
Permalink: https://github.com/advisories/GHSA-8fx8-pffw-w498JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS04Zng4LXBmZnctdzQ5OM4ABC8f
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: 5 days ago
Updated: 5 days ago
EPSS Percentage: 0.00043
EPSS Percentile: 0.11007
Identifiers: GHSA-8fx8-pffw-w498, CVE-2025-21609
References:
- https://github.com/siyuan-note/siyuan/security/advisories/GHSA-8fx8-pffw-w498
- https://github.com/siyuan-note/siyuan/commit/d9887aeec1b27073bec66299a9a4181dc42969f3
- https://nvd.nist.gov/vuln/detail/CVE-2025-21609
- https://github.com/advisories/GHSA-8fx8-pffw-w498
Blast Radius: 1.0
Affected Packages
go:github.com/siyuan-note/siyuan/kernel
Dependent packages: 0Dependent repositories: 0
Downloads:
Affected Version Ranges: < 0.0.0-20250103014808-d9887aeec1b2
No known fixed version
All affected versions: 0.0.0-20220905142016-d4334c773dad, 0.0.0-20221027152605-fe60b22d536d, 0.0.0-20230103113146-145243e0583b, 0.0.0-20230111025530-cdb6077c3f00, 0.0.0-20230117023040-d0f011b1a5b1, 0.0.0-20230321012606-1a6fddc44111, 0.0.0-20230321035213-f83a07fb0626, 0.0.0-20230404073044-cbddfb196259, 0.0.0-20230411020541-41873799c846, 0.0.0-20230411032044-a1e389df19df, 0.0.0-20230418060053-0929e98dee27, 0.0.0-20230425032235-9e9b43392e30, 0.0.0-20230509095923-c7b43df2d829, 0.0.0-20230704012107-073e73838942, 0.0.0-20230725120217-1c2422cf6d73, 0.0.0-20230801023826-ae576633c12e, 0.0.0-20230808040815-95c095573538, 0.0.0-20230815124756-a516f8da2cf1, 0.0.0-20230821131106-e08133ea88ff, 0.0.0-20230829032438-2349b080db59, 0.0.0-20230905014358-830c8b55cf1f, 0.0.0-20230908022656-147d08377047, 0.0.0-20230912012204-38bb73810b5a, 0.0.0-20230919025405-cd94ce9fb132, 0.0.0-20231003053625-642d04151389, 0.0.0-20231004050336-811bac942ddb, 0.0.0-20231011065714-eb93255cf327, 0.0.0-20231115012049-99b3c7e1920a, 0.0.0-20231205010704-20881abfe2f8, 0.0.0-20231214085135-4d5f5380088e, 0.0.0-20231214121959-554b1f77694c, 0.0.0-20231219004102-fd0e44fbf0ef, 0.0.0-20231226025913-171b91513423, 0.0.0-20240102022946-cb6a843cd957, 0.0.0-20240109001922-343c7679e74b, 0.0.0-20240110090555-2b6dc096a8e7, 0.0.0-20240116030803-f6651fbc0ffd