Listen to this Post
The vulnerability in SiYuan Note 3.1.18 allows attackers to delete arbitrary files by exploiting an insecure file path handling issue in the `/api/history/getDocHistoryContent` endpoint. The application fails to properly sanitize user-supplied input, enabling directory traversal attacks. A crafted POST request with a malicious payload containing `../` sequences can manipulate file paths, leading to unauthorized file deletion. The flaw stems from insufficient validation before file operations, allowing attackers to bypass intended restrictions. The fix in commit `d9887ae` enforces strict path validation, ensuring only permitted files are accessed.
DailyCVE Form:
Platform: SiYuan Note
Version: 3.1.18
Vulnerability: Arbitrary File Deletion
Severity: Critical
Date: 05/14/2025
What Undercode Say:
Exploit:
- Craft a POST request to `/api/history/getDocHistoryContent` with a malicious path:
curl -X POST http://target/api/history/getDocHistoryContent -d '{"path":"../../etc/passwd"}'
- Use Burp Suite to intercept and modify the request, injecting traversal sequences.
Protection:
1. Update to SiYuan Note 3.1.19 or later.
2. Implement input sanitization:
def sanitize_path(user_input): return os.path.abspath(os.path.join("/safe_dir", user_input))
3. Restrict file operations to whitelisted directories.
Detection:
grep -r "getDocHistoryContent" /siyuan/install/path
Mitigation:
1. Apply patch from commit `d9887ae`.
2. Use WAF rules to block traversal patterns:
location /api/ { if ($args ~ "..") { return 403; } }
Analytics:
- Attack Vector: Network
- Complexity: Low
- Privileges Required: None
- User Interaction: None
References:
- GitHub Commit: d9887ae
- CVE Details: CVE-2025-21609
Sources:
Reported By: nvd.nist.gov
Extra Source Hub:
Undercode