/

CVE-2026-23850

Severity:

HIGH RISK

(7.5)

Path Traversal / Local File Disclosure in SiYuan Markdown

CVE-2026-23850

Analyzed

Vulnerability type

Category:

Path Traversal / Local File Disclosure

CWE:

CWE-22

Impact:

Local File 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 markdown feature performs unrestricted server-side HTML rendering in affected versions, allowing crafted content to reference arbitrary files on the server.

Under certain conditions, an attacker who can influence markdown content may trigger local file disclosure (LFD), exposing sensitive server-side data.

Affected context

This vulnerability affects SiYuan deployments where markdown documents are rendered on the server and the resulting HTML is delivered to clients.

It is most relevant when:

  • Users can create or modify markdown content that is then processed server-side
  • The markdown-to-HTML pipeline can resolve file paths or embed local resources
  • The server process has access to sensitive files (e.g., configuration, user data, system files)

The issue does not depend on a specific operating system but on how the application resolves file references during HTML rendering.

Exploit preconditions

  • Attack surface: SiYuan instances that render markdown to HTML on the server.
  • Required access: Ability to supply or modify markdown content (e.g., authenticated user, shared workspace contributor, or any integration that feeds markdown into the system).
  • Trigger point: Rendering of maliciously crafted markdown that causes the server-side renderer to resolve file paths or include local resources.
  • Why exploitation is possible: The HTML rendering pipeline does not sufficiently constrain which filesystem paths can be referenced, enabling traversal beyond intended directories and disclosure of arbitrary local files readable by the SiYuan process.

Why this happens

The core issue is insufficient restriction of file path resolution during server-side HTML rendering of markdown.

When markdown is converted to HTML, certain constructs (such as links, embedded resources, or HTML elements) can cause the application to access the local filesystem.

Because path validation and normalization are missing or incomplete, an attacker-controlled path may escape the intended content directory and reach arbitrary locations.

This aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where untrusted input influences filesystem paths without robust checks.

Potential impact

  • Disclosure of application configuration files that may contain secrets or tokens
  • Exposure of user data or workspace content not intended to be shared
  • Access to system files readable by the SiYuan process, potentially aiding further attacks
  • Leakage of internal implementation details that can be used to refine subsequent exploits

General mitigation guidance

Effective mitigation focuses on strictly controlling how file paths are derived and which resources server-side rendering is allowed to access.

Common defensive patterns include:

  • Enforcing a whitelist of allowed directories for any file access performed during markdown or HTML rendering
  • Normalizing and validating paths before use, rejecting any that traverse outside designated content roots
  • Disabling, restricting, or sandboxing markdown features that can directly reference local files or arbitrary URLs when rendered on the server
  • Running the application with least-privilege filesystem permissions so that even if path traversal occurs, sensitive files remain inaccessible
  • Treating user-supplied markdown as untrusted input and designing the rendering pipeline to avoid implicit trust in embedded paths or raw HTML

How teams detect issues like this

Organizations can approach detection by:

  • Reviewing the markdown rendering code for any file access driven by user-controlled paths, especially where relative paths or raw HTML are supported
  • Using static analysis rules that flag filesystem APIs when their arguments originate from markdown content or template variables
  • Implementing runtime logging for file-access operations during rendering and monitoring for unexpected paths (e.g., /etc, system configuration, or parent directory traversal patterns like "../")
  • Incorporating security-focused code review checklists that explicitly cover path normalization, directory whitelisting, and markdown/HTML feature restrictions

Automated code review or SAST tools can assist in identifying unvalidated path usage and risky file inclusion patterns in the rendering pipeline.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/blob/master/kernel/model/file.go#L1035
github.comgithub.com/siyuan-note/siyuan/blob/v3.4.2/kernel/api/filetree.go#L799-L886
github.comgithub.com/siyuan-note/siyuan/commit/b2274baba2e11c8cf8901b0c5c871e5b27f1f6dd
github.comgithub.com/siyuan-note/siyuan/commit/f8f4b517077b92c90c0d7b51ac11be1b34b273ad
github.comgithub.com/siyuan-note/siyuan/issues/16860
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-cv54-7wv7-qxcw

Frequently asked

questions

It can be, if a remote user or integration can supply markdown that the server renders to HTML. In such deployments, a remote actor may trigger local file disclosure without needing direct filesystem access.

The attacker generally needs the ability to create, edit, or inject markdown content that is processed on the server. This may correspond to a standard authenticated user role or any upstream system that feeds markdown into SiYuan.

The most robust fix is to strictly confine all file access during rendering to a small set of approved directories and to normalize and validate paths against that allowlist. Disabling or heavily restricting features that can directly reference local files from markdown also reduces risk.

Design rendering pipelines under a "zero trust" model for content: treat all markdown/HTML as untrusted, avoid direct file access based on user-controlled values, validate and sanitize all paths, and use code reviews and automated checks to enforce strong path-handling and sandboxing practices.

Find out what's already
exploitable in your codebase.