GHSA-gw25-m53r-qh88: SiYuan: path traversal via /export/temp/ short-circuit branch (incomplete fix for the export-disclosure hardening, GHSA-6865-qjcf-286f)
SiYuan’s /export/ file handler was hardened against export disclosure (issue #12213) by adding an
IsSubPath(exportBaseDir, fullPath) check and an IsSensitivePath() check in commit bb481e1. These guards
were added only to the main branch of the handler. The handler begins with a short-circuit branch:
if strings.HasPrefix(c.Request.URL.Path, "/export/temp/") {
c.File(filepath.Join(util.TempDir, c.Request.URL.Path))
return
}
This branch joins the broader util.TempDir with the raw, percent-decoded request path and serves it with
neither IsSubPath nor IsSensitivePath. An authenticated request to
/export/temp/%2e%2e/.../etc/passwd traverses out of TempDir and reads arbitrary files - exactly the
sensitive-file disclosure the patch intended to prevent. Present in the latest master.
References
Code Behaviors & Features
Detect and mitigate GHSA-gw25-m53r-qh88 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →