/

CVE-2026-30869

Severity:

CRITICAL RISK

(9.3)

Path Traversal in SiYuan /export Endpoint Exposing Secrets

CVE-2026-30869

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Read and Potential Privilege Escalation

Severity:

CRITICAL RISK

(9.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A path traversal vulnerability in SiYuan's /export endpoint allows attackers to read arbitrary files from the server filesystem by abusing double-encoded traversal sequences.

If sensitive configuration files such as conf/conf.json are exposed, an attacker may obtain API tokens and signing keys, potentially escalating to administrative control of the SiYuan kernel API and, in some deployments, chaining the issue towards remote code execution.

Affected context

This vulnerability affects SiYuan instances that expose the /export HTTP endpoint and process user-supplied paths or resource identifiers to generate exports.

It becomes relevant when:

  • The application is reachable over a network (e.g., self-hosted personal instances, shared servers, or cloud deployments), and
  • The server process has access to sensitive configuration files such as conf/conf.json and other local data.

Installations running with default or broad filesystem access are more likely to expose high-value secrets when file paths are insufficiently constrained and canonicalized.

Exploit preconditions

  • Attack surface: Network-exposed /export endpoint of a running SiYuan instance.
  • Required access: Ability to send HTTP requests to the SiYuan server (often unauthenticated or low-privilege, depending on deployment configuration).
  • Trigger point: The server handling an export request that incorporates user-controlled path components, which are insufficiently sanitized and resolved.
  • Why exploitation is possible: Double-encoded directory traversal sequences (e.g., encoded "../" patterns) bypass path validation or normalization logic, allowing the handler to resolve paths outside the intended export directory and read arbitrary files readable by the SiYuan process.

Why this happens

The core issue is an improper restriction of relative path traversal in file system operations, aligning with CWE-22.

The /export endpoint appears to treat user input as a relative path or resource identifier without fully normalizing and validating it against an allow-listed base directory.

By double-encoding traversal characters, attackers bypass shallow validation checks that only look for literal "../" substrings or assume single-decoding semantics.

Conceptually, the bug is an insecure pattern where user-supplied path segments are concatenated or mapped directly to filesystem paths without robust canonicalization, enforcement of a fixed root, and rejection of any traversal outside the permitted tree.

Potential impact

  • Exposure of conf/conf.json, revealing the API token, cookie signing key, and workspace access authentication code.
  • Administrative access to the SiYuan kernel API using stolen tokens or secrets.
  • Impersonation of legitimate users and bypass of authentication or authorization controls tied to leaked keys.
  • Access to other sensitive local files readable by the application process (e.g., documents, notes, logs, or OS-level configuration files).
  • In some deployment scenarios, potential chaining into remote code execution if the attacker can use the obtained secrets to invoke powerful administrative or plugin-related actions.

General mitigation guidance

Effective mitigation centers on strict path handling, least-privilege configuration, and reduction of secret exposure:

  • Enforce a fixed, canonical base directory for all /export operations and ensure all resolved paths are confined within that directory after normalization.
  • Normalize and decode user-supplied paths exactly once, then resolve them to an absolute canonical path and reject any that include traversal outside the expected root.
  • Use an explicit allow list for exportable resources (e.g., mapping logical identifiers to file paths) rather than accepting arbitrary path segments from clients.
  • Avoid storing high-value secrets (tokens, signing keys) in locations that are accessible to web-facing components; segregate configuration with strict filesystem permissions.
  • Apply the principle of least privilege to the SiYuan process user so it has minimal filesystem access necessary to function, reducing the blast radius of any file disclosure.
  • Rotate and compartmentalize secrets so that compromise of one secret does not automatically grant broad administrative or system-level control.

How teams detect issues like this

Detection can leverage both code-centric and operational techniques:

  • Static analysis and code review:
  • Search for handlers that accept user input and pass it into file operations (open, read, export) without robust canonicalization or base-path checks.
  • Flag logic that performs only superficial string checks on "../" or uses naive concatenation of user input with filesystem paths.
  • Establish secure coding guidelines and linting rules for safe path handling, including mandatory use of helper functions that enforce root confinement.
  • Dynamic testing and security scanning:
  • Implement automated tests and DAST tools that inject encoded and double-encoded traversal sequences into path parameters of endpoints like /export.
  • Monitor for unexpected reads of configuration files, secrets, or files outside the intended export directories during testing.
  • Operational monitoring:
  • Log all /export requests with normalized, resolved paths and alert on attempts that resolve outside the expected directory tree.
  • Track anomalous access to sensitive configuration files or spikes in export-related activity indicative of reconnaissance.

Automated code review tools and CI-integrated security scanners can help consistently enforce path validation policies across endpoints with filesystem access.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-2h2p-mvfx-868w

Frequently asked

questions

Yes, in typical deployments where the SiYuan /export endpoint is accessible over the network, an attacker who can send HTTP requests to the service can attempt to exploit the path traversal without local system access.

The attacker generally needs only network-level access to the SiYuan instance. Depending on configuration, this could be unauthenticated or require low-privileged access; once reachable, the attacker can craft export requests using traversal sequences to read arbitrary files.

Implement strict path normalization and confinement: decode user input once, compute the canonical absolute path, and verify that it resides within a predefined export root. Reject any request that attempts to navigate outside this directory, and prefer mapping logical resource IDs to known safe paths rather than trusting raw user-supplied path strings.

Adopt a defensive design for all filesystem interactions exposed via HTTP: treat all path input as untrusted, centralize path resolution in well-reviewed utilities, enforce allow-listed roots, and combine this with secret minimization and strong filesystem permissions. Integrate static analysis rules, code review checklists, and automated tests that specifically target encoded and double-encoded traversal attempts on any file-related endpoints.

Find out what's already
exploitable in your codebase.