/

CVE-2026-54066

Severity:

HIGH RISK

(7.5)

Path Traversal (CWE-22) in SiYuan /assets Route

CVE-2026-54066

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22, CWE-23, CWE-1188

Impact:

Sensitive File Disclosure and Configuration Leakage

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

A path traversal flaw in SiYuan's /assets/*path HTTP route allows attackers to bypass directory restrictions by using double URL encoding of .. segments.

In publish mode, an unauthenticated remote attacker can read sensitive files within the workspace directory, including configuration, database, and log files.

Affected context

This vulnerability occurs in SiYuan instances running in publish mode, which exposes an anonymous read-only HTTP endpoint (default port 6808).

It affects the /assets/*path route when path components are insufficiently validated, allowing traversal outside the intended asset subdirectory using double-encoded .. segments.

The issue is limited to files located under the configured WorkspaceDir, but this directory commonly contains configuration secrets, local databases, and detailed logs.

Exploit preconditions

  • Attack surface: Public HTTP endpoint for publish mode (typically http://host:6808/).
  • Required access: No authentication; any remote client that can reach the publish endpoint.
  • Trigger point: HTTP requests to the /assets/*path route containing double URL-encoded directory traversal sequences (e.g., encoded .. path segments).
  • Why exploitation is possible: The path normalization and sanitization logic does not correctly decode and validate multiple layers of URL encoding, allowing attacker-controlled paths to resolve to files outside the intended assets directory inside WorkspaceDir.

Why this happens

The root cause is incomplete path validation and canonicalization when resolving user-supplied paths in the /assets/*path route.

The code attempts to restrict access to a specific directory but fails to correctly handle double-encoded special segments like .., so the effective filesystem path can traverse to arbitrary locations under WorkspaceDir.

This maps primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, and is related to CWE-23: Relative Path Traversal and CWE-1188: Insecure Default Initialization of Resource, because the publish endpoint exposes a broad attack surface with insufficiently constrained resource access.

Potential impact

  • An attacker may read conf/conf.json, exposing hashed access codes, API tokens, and sync keys.
  • An attacker could access temp/siyuan.db and temp/blocktree.db, potentially extracting user content, metadata, and structural information.
  • An attacker can read siyuan.log, which may reveal internal paths, debug data, and other sensitive operational details.
  • An attacker could enumerate other files in WorkspaceDir that may contain proprietary notes, documents, or configuration data.
  • Disclosure of secrets may enable follow-on attacks, such as API misuse or unauthorized synchronization actions.

General mitigation guidance

Effective mitigation focuses on robust path handling and reducing the exposure of sensitive files through public endpoints.

Recommended patterns include:

  • Performing strict canonicalization of requested paths after fully decoding URL components, then enforcing that the resolved path stays within a defined asset directory.
  • Rejecting any request containing .. or other traversal indicators after decoding, rather than attempting partial sanitization.
  • Separating workspace storage for public assets from internal configuration, database, and logs, minimizing the blast radius if an asset route is misconfigured.
  • Limiting the data stored in publicly reachable workspaces and avoiding co-location of secrets with user content.
  • Applying defense-in-depth controls such as access control layers, environment-based configuration, and least-privilege filesystem permissions to reduce the risk of sensitive file exposure.

How teams detect issues like this

Detection can rely on both preventative and retrospective techniques:

  • Static analysis rules that flag any use of user-controlled path segments in filesystem operations (open, readFile, etc.) without canonicalization and explicit directory bounds checks.
  • Code review checklists that require verification of URL decoding order, rejection of traversal sequences, and confinement to a dedicated assets directory for any HTTP file-serving routes.
  • Runtime monitoring and logging to detect suspicious requests with URL-encoded .. segments or anomalies in asset requests that resolve to non-asset files.
  • Security tests and CI/CD checks that include automated path traversal test cases against file-serving endpoints.
  • Periodic configuration audits to ensure publish mode is only enabled in intended environments and that workspace directories do not contain unnecessary sensitive artifacts.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-p4m3-mgmm-c664

Frequently asked

questions

Yes. In publish mode, any remote attacker who can reach the SiYuan publish endpoint can send crafted HTTP requests to the /assets/*path route and attempt to read files under WorkspaceDir.

No authentication is required. The vulnerability is reachable via the anonymous read-only publish endpoint, so basic network access to port 6808 (or the configured publish port) is sufficient.

The most robust fix is to strictly canonicalize and validate paths after decoding, enforcing that all file accesses remain within a dedicated assets directory, and to reject any request that contains traversal patterns or resolves outside the allowed base path.

Developers should adopt standardized file-serving helpers that encapsulate safe path handling, isolate public assets from internal data, perform security-focused code reviews for all routes that touch the filesystem, and add automated tests specifically targeting traversal via single and double URL encoding.

Find out what's already
exploitable in your codebase.