/

CVE-2026-33476

Severity:

HIGH RISK

(7.5)

Directory Traversal / Path Traversal in SiYuan

CVE-2026-33476

Modified

Vulnerability type

Category:

Directory Traversal / Path Traversal

CWE:

CWE-22, CWE-73

Impact:

Unauthenticated Arbitrary File Read

Severity:

HIGH RISK

(7.5)

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

SiYuan's kernel exposes an unauthenticated file-serving endpoint under /appearance/*filepath that insufficiently sanitizes user-supplied paths, enabling directory traversal.

An attacker can craft requests that escape the intended appearance directory and read arbitrary files accessible to the SiYuan server process, all without valid credentials.

Affected context

This vulnerability affects SiYuan deployments where the kernel HTTP interface is exposed over a network or accessible to untrusted users.

The affected endpoint /appearance/*filepath is meant to serve theme or appearance-related files, but due to improper path handling, it can be abused to read files outside the intended directory.

The issue is limited to files that the SiYuan server process can access under its OS-level permissions, and exploitation assumes network reachability to the kernel endpoint.

Exploit preconditions

  • Attack surface: HTTP interface of the SiYuan kernel, specifically the /appearance/*filepath endpoint.
  • Required access: Network or local access sufficient to send HTTP requests to the SiYuan kernel; no authentication or user account is required.
  • Trigger point: A crafted request where the *filepath parameter includes traversal sequences (for example, moving up directories) or equivalent mechanisms to escape the intended appearance directory.
  • Why exploitation is possible: The server trusts the filepath parameter without robust normalization and validation, and the authentication middleware explicitly exempts this endpoint, allowing arbitrary paths to be resolved and served directly by the file system.

Why this happens

The core bug is incomplete validation and normalization of user-controlled file paths before they are resolved on the server's file system.

Instead of constraining *filepath to a fixed base directory and rejecting traversal patterns, the implementation allows relative path components to influence the final resolved path.

This aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory, where external input is used to build file paths without proper canonicalization or boundary checks.

The unauthenticated nature of the endpoint further amplifies the impact by removing any access control barriers around the vulnerable path resolution logic.

Potential impact

  • Attackers could read configuration files that may contain sensitive data such as paths, tokens, or integration secrets.
  • Attackers could access user content, notes, or documents managed by SiYuan, leading to confidentiality breaches.
  • Attackers could discover environment details (e.g., logs, system files within the accessible permission scope) that facilitate further attacks.
  • Attackers could leverage disclosed information to plan targeted exploitation of other services or components on the same host.

General mitigation guidance

Effective mitigations focus on strict path handling and reducing the trust boundary around file-serving endpoints:

  • Enforce canonicalization and normalization of incoming paths, then verify that the resolved path remains inside a designated base directory before serving any file.
  • Implement explicit allowlists for served resources (e.g., limiting to known theme or asset subdirectories) instead of dynamically mapping arbitrary user-supplied paths.
  • Apply uniform authentication and authorization checks to all file-serving endpoints unless there is a well-justified reason to make them public and anonymous.
  • Run the SiYuan process with least-privilege OS permissions so that, even if traversal occurs, the accessible data set is minimized.
  • Place sensitive configuration and secrets outside of directories that might be exposed to file-serving logic, and avoid co-locating private assets with user-facing static content.

How teams detect issues like this

Detection can be approached through both code-focused and operational techniques:

  • Static analysis: Flag uses of user-controlled path segments that are concatenated with base directories and passed to file I/O APIs without canonicalization or path boundary checks. Look for manual string concatenation of file paths and direct use of HTTP parameters in file operations.
  • Code review signals: Pay attention to public or "unauthenticated" endpoints that read from the file system; verify that they enforce directory constraints and reject traversal sequences. Review middleware configuration to ensure there are no unintended exclusions from authentication.
  • Runtime monitoring: Analyze HTTP access logs for suspicious patterns such as repeated requests containing directory traversal sequences or references to configuration, key, or system files.
  • Security testing: Incorporate automated web security scanners or custom test harnesses that systematically attempt path traversal on all file-serving routes as part of continuous integration and pre-release testing.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/commit/009bb598b3beccc972aa5f1ed88b3b224326bf2a
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-hhgj-gg9h-rjp7

Frequently asked

questions

Yes. Any party that can reach the SiYuan kernel's HTTP interface and invoke the /appearance/*filepath endpoint can attempt to exploit the vulnerability, even without authentication.

No. The endpoint in question is explicitly excluded from authentication checks, so no login or valid account is required to perform path traversal attempts.

The most robust pattern is to canonicalize the requested path, enforce that it remains within a designated base directory, and apply consistent authentication and authorization controls to file-serving endpoints. Reject any request where the normalized path attempts to escape the allowed directory.

Adopt a standard file-access utility that centralizes path validation, avoid constructing file system paths directly from HTTP parameters, and ensure that security reviews and automated tests specifically cover static file-serving routes and any code that maps user input to file system operations.

Find out what's already
exploitable in your codebase.