/

CVE-2026-60084

Severity:

HIGH RISK

(8.7)

Path Traversal (CWE-22) in SiYuan Template Endpoint

CVE-2026-60084

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File and Directory Deletion

Severity:

HIGH RISK

(8.7)

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 contains an arbitrary file deletion vulnerability in the template removal API because a user-controlled path is passed directly to a recursive filesystem deletion function. An authenticated administrator may use this behavior to delete files or directories that the SiYuan process has permission to remove.

Affected context

The vulnerability occurs in SiYuan deployments where the /api/search/removeTemplate endpoint is reachable and accepts a path parameter without sufficient validation. Risk is greatest when an authenticated administrator can influence that parameter and the application process has broad filesystem permissions, allowing the deletion operation to affect locations beyond the intended template directory.

Exploit preconditions

  • Attack surface: The /api/search/removeTemplate HTTP API endpoint
  • Required access: Authenticated administrator privileges
  • Trigger point: Processing of the endpoint's path parameter
  • Why exploitation is possible: The supplied path is passed to a recursive removal operation without reliably restricting it to an approved template directory
  • Environmental dependency: The target files or directories must be accessible to the operating-system account running the SiYuan process

Why this happens

The underlying bug is improper restriction of filesystem paths, mapping to CWE-22: Improper Limitation of a Pathname to a Restricted Directory. The endpoint treats caller-controlled path data as a trusted filesystem location and passes it directly to a recursive deletion API. Without canonicalization, allowlisting, and enforcement of a fixed storage boundary, absolute or otherwise escaping paths may resolve outside the intended application directory.

Potential impact

  • An attacker may delete application data, configuration files, or user content.
  • The service may become unavailable if required runtime files are removed.
  • Data loss or corruption could occur across directories accessible to the process.
  • Security controls or logs may be weakened if the process can remove related files.
  • Follow-on compromise could become possible if deletion affects operational or startup files.

General mitigation guidance

Mitigation generally focuses on making deletion operations operate only within a narrowly defined storage boundary.

Common defensive patterns include:

  • Accepting opaque template identifiers rather than caller-supplied filesystem paths.
  • Resolving and canonicalizing paths before authorization checks.
  • Enforcing an allowlisted template directory and rejecting absolute paths or traversal outside that boundary.
  • Applying authorization checks to the resolved target, not only to the submitted string.
  • Using narrowly scoped deletion operations instead of recursive removal where possible.
  • Running the service with a dedicated, least-privileged operating-system account and minimizing writable directories.
  • Preserving backups and recovery controls for important application data.

How teams detect issues like this

Organizations can assess for this class of issue through:

  • Static analysis rules that identify user-controlled values flowing into file deletion APIs such as os.RemoveAll.
  • Code review checks for filesystem operations that lack canonicalization, boundary validation, or authorization.
  • API policy tests using absolute paths, traversal sequences, symlink scenarios, and paths outside the intended storage root.
  • Runtime monitoring for unexpected recursive deletion activity or access to sensitive filesystem locations.
  • Automated security review tools that flag path parameters reaching destructive filesystem functions.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-w938-w7m4-qrj8
vulncheck.comvulncheck.com/advisories/siyuan-before-arbitrary-file-deletion-via-removetemplate

Frequently asked

questions

Exploitation generally requires an authenticated SiYuan administrator who can reach the affected API endpoint and influence its path parameter.

It may delete files or directories outside the intended template location when the SiYuan process has permission to remove them. Operating-system permissions still limit the reachable scope.

Treat template references as identifiers, resolve them server-side within an allowlisted directory, and authorize the canonicalized target before performing a narrowly scoped deletion.

Minimize process privileges, avoid accepting raw filesystem paths from clients, enforce canonical path boundaries, and test destructive file APIs against out-of-directory and symlink-based inputs.

Find out what's already
exploitable in your codebase.