Skip to content

SiYuan Vulnerable to Path Traversal in /export Endpoint Allows Arbitrary File Read and Secret Leakage

Critical severity GitHub Reviewed Published Mar 6, 2026 in siyuan-note/siyuan

Package

gomod github.com/siyuan-note/siyuan/kernel (Go)

Affected versions

<= 3.5.9

Patched versions

3.5.10

Description

Summary

A path traversal vulnerability in the /export endpoint allows an attacker to read arbitrary files from the server filesystem. By exploiting double‑encoded traversal sequences, an attacker can access sensitive files such as conf/conf.json, which contains secrets including the API token, cookie signing key, and workspace access authentication code.

Leaking these secrets may enable administrative access to the SiYuan kernel API, and in certain deployment scenarios could potentially be chained into remote code execution (RCE).

Details

File: serve.go, session.go
Lines: serve.go 303, 315, 320, 340, 955-957; session.go 292-295

Vulnerable Code:

// session.go
if localhost {
    if strings.HasPrefix(c.Request.RequestURI, "/assets/") || strings.HasPrefix(c.Request.RequestURI, "/export/") {
        c.Set(RoleContextKey, RoleAdministrator)
        c.Next()
        return
    }
}

// serve.go
filePath := strings.TrimPrefix(c.Request.URL.Path, "/export/")
decodedPath, err := url.PathUnescape(filePath)
fullPath := filepath.Join(exportBaseDir, decodedPath)
c.File(fullPath)

// CORS
c.Header("Access-Control-Allow-Origin", "*")

Points of Vulnerability:

  • /export/* trusts url.PathUnescape output and joins it without enforcing fullPath to stay under exportBaseDir.
  • Double-encoded traversal (%252e%252e) bypasses ServeFile dot-dot URL rejection but is decoded by app logic into ...
  • CheckAuth grants admin for localhost requests to /export/* when access auth code is set.
  • Global CORS Access-Control-Allow-Origin: * allows hostile web pages to read localhost responses.

PoC

Reproduction Steps:

  1. Send a GET request to /export/%252e%252e/%252e%252e/conf/conf.json or export/%252e%252e/%252e%252e/%252e%252e/%252e%252e/%252e%252e/%252e%252e/%252e%252e/etc/passwd

  2. If HTTP 200 is returned, inspect the response body for sensitive fields:

api.token
cookieKey
accessAuthCode

or

/etc/passwd
  1. (Optional) If api.token is present, test admin API access:
POST /api/system/getNetwork
Header: Authorization: Token <leaked token>
  1. Confirm that the response indicates administrative privileges.
    All steps can be performed with read-only HTTP requests; no Docker or local modifications are needed.

Impact

This vulnerability can lead to serious compromise of a SiYuan instance, including:

Arbitrary File Disclosure

  • Attackers can read files anywhere on the server filesystem, including system files such as /etc/passwd.

Exposure of Sensitive Secrets

  • Configuration files such as conf/conf.json contain sensitive information including:
  • API tokens
  • cookie signing keys
  • workspace authentication codes

Administrative API Access

  • Leaked tokens can allow attackers to interact with privileged SiYuan kernel APIs.

Cross‑Origin Localhost Data Exfiltration

  • Because the server sets Access-Control-Allow-Origin: *, a malicious website can exploit the vulnerability to read files from a victim's local SiYuan instance running on 127.0.0.1.

Potential Remote Code Execution (RCE)

  • Disclosure of authentication secrets and internal configuration may enable attackers to chain this vulnerability with other application features or APIs to achieve remote code execution or full system compromise.

References

@88250 88250 published to siyuan-note/siyuan Mar 6, 2026
Published to the GitHub Advisory Database Mar 7, 2026
Reviewed Mar 7, 2026

Severity

Critical

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
None
Availability
Low

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:L

EPSS score

Weaknesses

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. Learn more on MITRE.

Exposure of Sensitive Information to an Unauthorized Actor

The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. Learn more on MITRE.

Improper Authorization

The product does not perform or incorrectly performs an authorization check when an actor attempts to access a resource or perform an action. Learn more on MITRE.

CVE ID

No known CVE

GHSA ID

GHSA-2h2p-mvfx-868w

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.