/

CVE-2026-66012

Severity:

CRITICAL RISK

(10.0)

Missing Authorization (CWE-862) in SiYuan MCP Endpoint

CVE-2026-66012

Deferred

Vulnerability type

Category:

Missing Authorization

CWE:

CWE-862

Impact:

Remote Workspace Compromise and Privilege Escalation

Severity:

CRITICAL RISK

(10.0)

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 /mcp kernel endpoint lacks proper authorization, allowing only a generic authentication check without enforcing admin or read-only roles.

When the Publish server is exposed in anonymous mode, a remote unauthenticated attacker can gain file-level access across the workspace, steal secrets, and plant malicious plugins that execute with high privileges.

Affected context

The vulnerability appears in SiYuan deployments where the MCP kernel endpoint (POST /mcp) is reachable and only guarded by a broad CheckAuth call, without role-based enforcement.

It becomes particularly dangerous when the Publish server is enabled in anonymous mode (Conf.Publish.Enable=true and Conf.Publish.Auth.Enable=false), because the reverse proxy transparently injects a RoleReader JWT for proxied requests.

In this configuration, remote users accessing the Publish interface can indirectly access MCP tools that operate on the entire workspace file system, even though they are not authenticated as administrators.

Exploit preconditions

  • Attack surface: Network-accessible SiYuan Publish server with MCP endpoint reachable behind its reverse proxy.
  • Required access: No prior authentication when Publish is in anonymous mode; the proxy issues a RoleReader JWT automatically.
  • Trigger point: Sending crafted POST /mcp requests that invoke exposed MCP tools, including file operations.
  • Why exploitation is possible: The MCP endpoint relies only on a generic model.CheckAuth check and does not enforce strict role-based authorization or read-only constraints, so Reader-level tokens can invoke powerful file tools.

Why this happens

The core issue stems from missing fine-grained authorization checks on a sensitive kernel endpoint.

While a general authentication helper (model.CheckAuth) is present, it does not verify that the caller holds an admin or privileged role before granting access to MCP tools that can read, write, delete, or copy files across the workspace.

This maps to CWE-862: Missing Authorization, where a security-sensitive operation (workspace file management and configuration access) is exposed because the system assumes that any authenticated or semi-trusted context is sufficiently privileged.

The Publish reverse proxy design further amplifies this by automatically attaching a RoleReader JWT for anonymous visitors, unintentionally granting them access to powerful MCP actions.

Potential impact

  • Remote attackers could read sensitive configuration files (e.g., conf/conf.json) and extract secrets such as accessAuthCode, api.token, and cookieKey.
  • Attackers may write, modify, rename, or delete arbitrary files within the workspace, including user content and application resources.
  • Malicious plugins can be planted into data/plugins/ that execute with nodeIntegration:true and no contextIsolation upon next desktop launch, enabling arbitrary code execution.
  • Full administrator account takeover is possible through stolen tokens and execution of attacker-controlled code in the desktop environment.
  • Persistent compromise of the SiYuan environment and potential pivoting into adjacent systems that trust the leaked credentials.

General mitigation guidance

Effective mitigation focuses on tightening authorization boundaries and minimizing implicit trust in intermediate components such as reverse proxies.

Common defense patterns include:

  • Enforcing strict role-based access control on kernel and management endpoints, ensuring only admin-equivalent roles can invoke file and configuration tools.
  • Treating reader or anonymous roles as read-only and explicitly denying any write, delete, or plugin-deployment capabilities from those contexts.
  • Using defense-in-depth on high-impact endpoints by checking both authentication and explicit authorization claims for each MCP tool invocation.
  • Reducing exposure of administrative interfaces like the MCP endpoint by restricting them to trusted networks, authenticated sessions, or dedicated admin channels.
  • Segmenting secrets and configuration so that runtime tokens and keys are not directly readable via generic file operations.
  • Applying secure plugin-loading practices, such as disabling dangerous runtime options by default and requiring explicit user consent for new plugins.

How teams detect issues like this

Organizations can detect this type of issue through a combination of code-centric and operational controls:

  • Static analysis rules that flag security-sensitive endpoints lacking explicit role or permission checks, especially around file and configuration operations.
  • Code review checklists that require developers to document and verify authorization logic for each MCP tool and kernel API.
  • Configuration linting or policy-as-code that rejects deployments where anonymous publish access and privileged kernel endpoints coexist without additional guards.
  • Centralized logging of MCP tool usage, including caller identity and action type, with alerts for suspicious file operations or plugin deployments from non-admin roles.
  • Periodic security assessments that test anonymous and low-privilege paths (like the Publish server) for unintended access to administrative functions.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/commit/c72ca4cd09019e5f64afdee8f8c6ec5ef34858db
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-cvhv-7xhj-xjp8
vulncheck.comvulncheck.com/advisories/siyuan-before-unauthenticated-administrator-takeover-via-mcp

Frequently asked

questions

Yes. When the Publish server is enabled in anonymous mode and proxies requests to /mcp, a remote attacker can exploit the issue without prior authentication, leveraging the automatically attached RoleReader JWT.

The attacker needs only network access to the exposed Publish interface in the vulnerable configuration.

No valid user credentials are required, as the reverse proxy handles token injection on their behalf.

The most robust fix pattern is to enforce strict, per-endpoint authorization that limits high-impact MCP tools (especially file operations and plugin management) to admin roles, while ensuring reader or anonymous roles cannot perform any write or configuration-related actions.

Additionally, treat Publish as a separate, least-privileged surface rather than reusing internal kernel privileges.

Preventive measures include adopting a default-deny authorization model for kernel APIs, explicitly mapping roles to allowed actions, and validating that any reverse proxies or publish mechanisms cannot elevate low-privilege users.

Regular security reviews, automated checks for missing authorization on sensitive endpoints, and consistent separation of admin and public interfaces help avoid similar vulnerabilities.

Find out what's already
exploitable in your codebase.