/

CVE-2026-74798

Severity:

HIGH RISK

(8.7)

Path Traversal (CWE-22) in SiYuan database_clean MCP Tool

CVE-2026-74798

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Read and Arbitrary File 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's database_clean MCP tool does not adequately validate its id parameter before using it to construct a filesystem path. An authenticated MCP client may exploit path traversal sequences to copy an arbitrary file readable by the kernel into the history directory and delete the original file.

Affected context

The vulnerability occurs in SiYuan kernel deployments where the database_clean MCP tool is enabled and accepts requests from authenticated MCP clients. The MCP path does not sufficiently enforce SiYuan's node-ID format before RemoveUnusedAttributeView builds a filesystem path, allowing specially crafted identifiers to influence filesystem locations.

Exploit preconditions

  • Attack surface: The SiYuan MCP interface and its database_clean tool
  • Required access: An authenticated MCP client with permission to invoke the tool
  • Trigger point: Processing of the id parameter by RemoveUnusedAttributeView
  • Why exploitation is possible: The parameter is checked only for emptiness and is not constrained to a valid node-ID format before being passed to filesystem path construction

Why this happens

The underlying flaw is insufficient validation of a user-controlled path component. The tool treats the id value as a trusted identifier after only checking whether it is empty, while filepath.Join can resolve traversal components into locations outside the intended directory. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, because attacker-influenced input can escape the expected filesystem boundary and affect arbitrary process-readable paths.

Potential impact

  • An attacker may read files accessible to the SiYuan process
  • An attacker may cause readable files to be copied into SiYuan's history directory
  • An attacker may delete original files that the process can modify
  • Sensitive application, configuration, or credential data could be exposed
  • Data integrity and service availability could be affected

General mitigation guidance

Mitigation generally focuses on treating MCP parameters as untrusted input and enforcing filesystem boundaries before any file operation occurs.

Common defensive patterns include:

  • Accepting only identifiers that match a strict node-ID schema rather than permitting arbitrary path text
  • Rejecting traversal markers, absolute paths, separators, and other unexpected path syntax
  • Resolving candidate paths and verifying that they remain within the intended base directory
  • Applying the same validation and boundary checks consistently across HTTP and MCP callers
  • Running the kernel with the least filesystem privileges needed for its workload
  • Restricting MCP tool exposure and using narrowly scoped authentication and authorization
  • Avoiding deletion or copying when validation, canonicalization, or authorization checks fail

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis rules identifying user-controlled values passed to path-joining, file-copy, or file-deletion APIs
  • Code review checks for empty-string-only validation of path-like identifiers
  • Tests using traversal sequences, absolute paths, encoded separators, and platform-specific path syntax
  • Runtime monitoring for unusual MCP calls, unexpected history-directory contents, and file operations outside approved roots
  • Policy enforcement requiring canonical-path containment checks and authorization before filesystem mutation

Automated security review tools may help identify unsafe data flows from MCP parameters to filesystem APIs.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-43jx-gxq4-jpjc
vulncheck.comvulncheck.com/advisories/siyuan-kernel-path-traversal-via-database-clean-mcp-tool

Frequently asked

questions

It can be exploitable through the MCP interface when that interface is reachable by an authenticated client and the client is authorized to invoke the affected tool.

The attacker needs authenticated MCP access with sufficient permission to call database_clean; unauthenticated network access alone is not necessarily sufficient.

Validate the identifier against a strict allowlisted format and enforce canonical-path containment before performing any copy or deletion operation.

Treat all API and MCP parameters as untrusted, apply consistent validation across every caller, restrict process filesystem privileges, and monitor file operations and tool usage.

Find out what's already
exploitable in your codebase.