GHSA-gw25-m53r-qh88: SiYuan Path Traversal Vulnerability

MODERATE
CVSS 6.5
CWE-22
Published
Advisory Summary

GHSA-gw25-m53r-qh88 is a MODERATE (CVSS 6.5) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting SiYuan libraries in the Go ecosystem. The issue involves path traversal via /export/temp/ short-circuit branch (incomplete fix for the export-disclosure hardening, ghsa-6865-qjcf-286f). Remediation is available by upgrading affected packages to version 0.0.0-20260510110132-b763d787d1f2.

GHSA-gw25-m53r-qh88 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-gw25-m53r-qh88
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product SiYuan
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix GHSA-gw25-m53r-qh88

To remediate this vulnerability, upgrade all affected SiYuan dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/siyuan-note/siyuan/kernel fixed: 0.0.0-20260510110132-b763d787d1f2
Upgrade github.com/siyuan-note/siyuan/kernel to 0.0.0-20260510110132-b763d787d1f2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/siyuan-note/siyuan/kernel

How to Check if You Are Affected

To determine whether your application is affected by GHSA-gw25-m53r-qh88, inspect your project dependencies for SiYuan:

inspect dependencies for github.com/siyuan-note/siyuan/kernel

Analyze the terminal output to locate any version of SiYuan in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.0-20260510110132-b763d787d1f2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In SiYuan, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary 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: ```go 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. ## Affected - From commit `bb481e1` (the hardening) through the latest master. - Requires SiYuan access authorization (`model.CheckAuth`) - but the patch's stated goal is to deny sensitive-file export even to authorized callers. ## Root cause `kernel/server/serve.go` `serveExport()`: the main branch has `IsSubPath` + `IsSensitivePath`; the `/export/temp/` short-circuit branch (above it) has neither and uses `util.TempDir` as its root. `c.Request.URL.Path` is percent-decoded by net/http, so `%2e%2e` becomes `..` and `filepath.Join` collapses it. ## Incomplete-fix lineage - Export disclosure (issue #12213; CVE-2026-30869) -> fix `bb481e1` / `d68bd5a` (GHSA-6865-qjcf-286f): guards on the main branch + `IsSensitivePath` extended to `*.db`/`*.log`. - Follow-up CVE-2026-41894 (GHSA-hjh7-r5w8-5872) in the same `/export` path family. - The `/export/temp/` short-circuit branch was never covered by the guards (this report). ## Proof of concept (benign) 1. Authenticate (access auth code). 2. `GET /export/<sensitive>` (main branch) -> 401/403 (guards work). 3. `GET /export/temp/%2e%2e/%2e%2e/.../tmp/<planted-marker>` (or `/etc/hostname`) -> 200 + file content, demonstrating the unguarded traversal. The PoC reads only a planted marker / `/etc/hostname`; no credentials. ## Impact Authenticated arbitrary file read bypassing the sensitive-file protection: `/etc/passwd`, `~/.ssh/*`, SiYuan `*.db` workspace data, `*.log`. ## Remediation - Apply `IsSubPath` + `IsSensitivePath` to the `/export/temp/` branch (or restrict its root to `TempDir/temp` with an `IsSubPath` check). - `filepath.Clean` the request path and reject `..`. - Merge both branches into one guarded file-serving function. ## References - Hardening advisory: https://github.com/siyuan-note/siyuan/security/advisories/GHSA-6865-qjcf-286f (commit d68bd5a); issue #12213. - CVE chain: CVE-2026-30869 -> CVE-2026-41894 (GHSA-hjh7-r5w8-5872). - serve.go guards commit: https://github.com/siyuan-note/siyuan/commit/bb481e1290c4a34255652ede85a546504505d2a7 - Residual source (master): `kernel/server/serve.go` `serveExport()` lines 308-312.

GHSA-gw25-m53r-qh88 Affected SiYuan Versions

1 component(s)
Fixed Versions:
0.0.0-20260510110132-b763d787d1f2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/siyuan-note/siyuan/kernel
Go
< 0.0.0-20260510110132-b763d787d1f2
0.0.0-20260510110132-b763d787d1f2

References

Frequently Asked Questions

What is GHSA-gw25-m53r-qh88?
GHSA-gw25-m53r-qh88 is a security vulnerability in SiYuan involving path traversal via /export/temp/ short-circuit branch (incomplete fix for the export-disclosure hardening, GHSA-6865-qjcf-286f) under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which SiYuan versions are affected?
Affected versions include releases prior to 0.0.0-20260510110132-b763d787d1f2 across affected packages: github.com/siyuan-note/siyuan/kernel.
What version fixes GHSA-gw25-m53r-qh88?
Upgrading to 0.0.0-20260510110132-b763d787d1f2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/siyuan-note/siyuan/kernel affected?
Yes, github.com/siyuan-note/siyuan/kernel is affected in releases prior to 0.0.0-20260510110132-b763d787d1f2. Upgrade your dependency to 0.0.0-20260510110132-b763d787d1f2 or later.
What is the CVSS score of GHSA-gw25-m53r-qh88?
GHSA-gw25-m53r-qh88 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with GHSA-gw25-m53r-qh88?
GHSA-gw25-m53r-qh88 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check Go dependencies for GHSA-gw25-m53r-qh88?
Run the dependency tree command: 'inspect dependencies for github.com/siyuan-note/siyuan/kernel'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-gw25-m53r-qh88",
  "modified" : "2026-09-03T14:56:31Z",
  "published" : "2026-09-03T14:56:31Z",
  "aliases" : [ ],
  "summary" : "SiYuan: path traversal via /export/temp/ short-circuit branch (incomplete fix for the export-disclosure hardening, GHSA-6865-qjcf-286f)",
  "details" : "## Summary\nSiYuan's `/export/` file handler was hardened against export disclosure (issue #12213) by adding an\n`IsSubPath(exportBaseDir, fullPath)` check and an `IsSensitivePath()` check in commit `bb481e1`. These guards\nwere added only to the main branch of the handler. The handler begins with a short-circuit branch:\n```go\nif strings.HasPrefix(c.Request.URL.Path, \"/export/temp/\") {\n    c.File(filepath.Join(util.TempDir, c.Request.URL.Path))\n    return\n}\n```\nThis branch joins the **broader** `util.TempDir` with the raw, percent-decoded request path and serves it with\n**neither** `IsSubPath` **nor** `IsSensitivePath`. An authenticated request to\n`/export/temp/%2e%2e/.../etc/passwd` traverses out of `TempDir` and reads arbitrary files - exactly the\nsensitive-file disclosure the patch intended to prevent. Present in the latest master.\n\n## Affected\n- From commit `bb481e1` (the hardening) through the latest master.\n- Requires SiYuan access authorization (`model.CheckAuth`) - but the patch's stated goal is to deny sensitive-file\n  export even to authorized callers.\n\n## Root cause\n`kernel/server/serve.go` `serveExport()`: the main branch has `IsSubPath` + `IsSensitivePath`; the\n`/export/temp/` short-circuit branch (above it) has neither and uses `util.TempDir` as its root.\n`c.Request.URL.Path` is percent-decoded by net/http, so `%2e%2e` becomes `..` and `filepath.Join` collapses it.\n\n## Incomplete-fix lineage\n- Export disclosure (issue #12213; CVE-2026-30869) -> fix `bb481e1` / `d68bd5a` (GHSA-6865-qjcf-286f): guards on\n  the main branch + `IsSensitivePath` extended to `*.db`/`*.log`.\n- Follow-up CVE-2026-41894 (GHSA-hjh7-r5w8-5872) in the same `/export` path family.\n- The `/export/temp/` short-circuit branch was never covered by the guards (this report).\n\n## Proof of concept (benign)\n1. Authenticate (access auth code).\n2. `GET /export/<sensitive>` (main branch) -> 401/403 (guards work).\n3. `GET /export/temp/%2e%2e/%2e%2e/.../tmp/<planted-marker>` (or `/etc/hostname`) -> 200 + file content,\n   demonstrating the unguarded traversal. The PoC reads only a planted marker / `/etc/hostname`; no credentials.\n\n## Impact\nAuthenticated arbitrary file read bypassing the sensitive-file protection: `/etc/passwd`, `~/.ssh/*`, SiYuan\n`*.db` workspace data, `*.log`. \n\n## Remediation\n- Apply `IsSubPath` + `IsSensitivePath` to the `/export/temp/` branch (or restrict its root to `TempDir/temp` with\n  an `IsSubPath` check).\n- `filepath.Clean` the request path and reject `..`.\n- Merge both branches into one guarded file-serving function.\n\n## References\n- Hardening advisory: https://github.com/siyuan-note/siyuan/security/advisories/GHSA-6865-qjcf-286f (commit d68bd5a); issue #12213.\n- CVE chain: CVE-2026-30869 -> CVE-2026-41894 (GHSA-hjh7-r5w8-5872).\n- serve.go guards commit: https://github.com/siyuan-note/siyuan/commit/bb481e1290c4a34255652ede85a546504505d2a7\n- Residual source (master): `kernel/server/serve.go` `serveExport()` lines 308-312.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/siyuan-note/siyuan/kernel"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.0-20260510110132-b763d787d1f2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/siyuan-note/siyuan/security/advisories/GHSA-gw25-m53r-qh88"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/siyuan-note/siyuan/commit/b763d787d1f2b862c577049e4ee147c5857fe413"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/siyuan-note/siyuan"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-09-03T14:56:31Z",
    "nvd_published_at" : null
  }
}