/

CVE-2026-25992

Severity:

HIGH RISK

(7.5)

Path Traversal / Improper Path Restriction in SiYuan getFile

CVE-2026-25992

Analyzed

Vulnerability type

Category:

Path Traversal / Improper Path Restriction

CWE:

CWE-22

Impact:

Unauthorized File Read / Information Disclosure

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 /api/file/getFile endpoint previously relied on case-sensitive string comparison to block access to sensitive files.

On case-insensitive file systems like Windows, attackers could craft mixed-case paths to bypass these checks and read protected configuration files.

Affected context

This issue affects SiYuan instances running on case-insensitive file systems, primarily Windows, where filesystem path matching does not distinguish between upper and lower case.

The vulnerable behavior occurs in the /api/file/getFile HTTP endpoint, which attempts to prevent access to sensitive files (such as configuration or internal application files) using case-sensitive string equality checks on the requested path.

When the underlying OS treats file names as case-insensitive, these checks can be bypassed by varying the letter casing in the request path, allowing access to files that were intended to be blocked.

Exploit preconditions

  • Attack surface: Network-accessible /api/file/getFile HTTP endpoint.
  • Required access: Ability to send HTTP requests to the SiYuan instance (e.g., local network or exposed web interface).
  • Deployment context: SiYuan running on a case-insensitive filesystem (e.g., Windows NTFS in default mode).
  • Trigger point: Submission of a crafted file path with mixed or altered casing that maps to a protected file on disk.
  • Why exploitation is possible: The application enforces access control using case-sensitive string checks, while the underlying filesystem resolves paths in a case-insensitive manner, causing a mismatch between the intended access policy and actual file resolution.

Why this happens

The root cause is improper restriction of filesystem paths (CWE-22) due to trusting simple, case-sensitive string comparisons to enforce file access restrictions.

Instead of normalizing and validating paths in a way that reflects the semantics of the underlying filesystem, the endpoint checks for sensitive targets using exact-case string equality (for example, blocking "config.json" but not "Config.json").

On case-insensitive filesystems, both variations resolve to the same file, so the application's logical filters diverge from the OS's path resolution behavior.

This design flaw illustrates a broader bug class where application-layer path checks do not account for platform-specific filename and path normalization rules, resulting in unauthorized file access.

Potential impact

  • Attackers may read protected configuration files that were intended to be inaccessible.
  • Sensitive information such as API keys, access tokens, or database credentials could be exposed.
  • Internal application settings and environment details can be revealed, aiding further attacks.
  • User-related data stored in configuration or support files could be disclosed depending on deployment.
  • Reconnaissance value for attackers, enabling more targeted exploitation of the system or adjacent services.

General mitigation guidance

Mitigation generally focuses on aligning application-level path validation with filesystem behavior and minimizing direct file exposure:

  • Normalize and canonicalize requested paths before authorization checks, including resolving case, dot-segments (../, ./), and symbolic links where applicable.
  • Implement allowlist-based file serving (e.g., mapping logical IDs or aliases to specific, pre-approved files) instead of accepting arbitrary user-supplied paths.
  • Use OS-appropriate APIs or libraries that enforce canonical paths and provide secure abstractions over direct filesystem access.
  • Centralize path validation logic to avoid ad-hoc string checks scattered across the codebase.
  • Restrict the file-serving component to a dedicated, non-sensitive directory and ensure that configuration and secrets are stored outside of any web-accessible tree.
  • Apply least-privilege filesystem permissions so that the application process can only read files strictly required for serving user content.

How teams detect issues like this

Effective detection combines code-level analysis with behavioral testing:

  • Static analysis and code review:
  • Search for direct use of user-controlled paths in file access APIs (e.g., open/read operations) within request handlers such as /api/file/getFile.
  • Flag string-based path filters or blacklist/denylist checks that rely on exact-case comparison or simple substring matching.
  • Review for absence of path normalization routines (e.g., canonicalization) before authorization checks.
  • Dynamic and behavioral testing:
  • Fuzz file-serving endpoints with mixed-case paths and variants of known sensitive filenames to identify case-based bypasses.
  • Attempt to access configuration or internal files outside the intended document root using casing variations.
  • Policy and tooling:
  • Enforce secure coding guidelines that require canonical path validation for all filesystem access.
  • Integrate security-focused linters or SAST tools configured with rules for CWE-22 and path traversal patterns into CI pipelines.
  • Use application security tests that explicitly consider platform differences (Windows vs. Unix-like systems) in path handling.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/releases/tag/v3.5.5
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-f72r-2h5j-7639

Frequently asked

questions

It can be remotely exploitable if the SiYuan instance exposes the /api/file/getFile endpoint over a network interface accessible to the attacker. No local shell access is required; the attacker only needs the ability to send crafted HTTP requests.

The attacker needs network access to the running SiYuan service and the ability to reach the /api/file/getFile endpoint. No prior authentication may be required if the endpoint is accessible without login, but the exact requirement depends on the deployment's access controls.

The most robust fix is to avoid serving arbitrary filesystem paths altogether and instead implement an allowlist or ID-based abstraction over files. Additionally, always canonicalize paths and perform access control checks on the canonical form using logic consistent with the underlying filesystem's case sensitivity and path semantics.

Adopt a secure design for file handling that includes path canonicalization, allowlist-based access, and isolation of sensitive files from any web-accessible directory. Combine this with coding standards that forbid ad-hoc string-based path checks, automated static analysis for CWE-22 patterns, and platform-aware security testing that exercises endpoints on both case-sensitive and case-insensitive filesystems.

Find out what's already
exploitable in your codebase.