Summary
Trilium Desktop's Clipper API disables its authentication middleware when it detects an Electron environment, leaving note-related endpoints exposed on the local network.
An attacker on the same network can discover the listening port and interact with the Clipper API without any password, token, or CSRF protection, potentially accessing or manipulating user data and abusing the host system.
Affected context
This vulnerability occurs in Trilium Desktop deployments where the application is running in an Electron environment and exposes its Clipper API on a network-accessible interface.
In this configuration, the authentication middleware is explicitly disabled for Clipper routes, leaving endpoints such as /api/clipper/notes and the handshake endpoint reachable without credentials.
It primarily affects users on shared or semi-trusted networks (e.g., corporate LANs, home networks with multiple users, or public Wi-Fi) where other devices can scan and reach high-range ports that Trilium binds to.
Exploit preconditions
- Attack surface: Network-exposed Clipper API listening on a high-range port (e.g., around 37840) from a Trilium Desktop instance.
- Required access: Presence on the same network segment as the victim host (e.g., same Wi-Fi, same LAN) with the ability to initiate TCP connections to arbitrary ports.
- Trigger point: Sending unauthenticated HTTP requests to the Clipper handshake and note-related endpoints once the listening port is discovered (through port scanning or host enumeration).
- Why exploitation is possible: The application disables authentication middleware when running under Electron, resulting in missing authentication (CWE-306) and overly permissive authorization (CWE-284) for Clipper API endpoints, even when they are reachable from other machines.
Why this happens
The underlying issue is a design decision that trusts the runtime environment (Electron) as an implicit security boundary and consequently turns off explicit authentication checks for the Clipper API.
Instead of enforcing authentication and authorization for all network-exposed routes, the implementation relies on the assumption that only the local user or browser extension will reach these endpoints.
This maps to CWE-306: Missing Authentication for Critical Function, because sensitive note operations are exposed without any credential check, and CWE-284: Improper Access Control, as there is no restriction on which network clients may call these endpoints.
The insecure pattern is environment-based trust without transport or identity verification, allowing any network peer that can discover the port to act as an authenticated client.
Potential impact
- Unauthorized reading of notes, including potentially sensitive or confidential information stored in the knowledge base.
- Unauthorized creation, modification, or deletion of notes, tags, and structures within the personal knowledge base.
- Use of maliciously crafted notes or links to facilitate phishing, credential harvesting, or social engineering targeting the user.
- Potential abuse of note content or integration hooks to pivot into local system compromise (e.g., tricking the user into executing malicious content).
- Privacy violations through exposure of personal knowledge graphs, internal documentation, or corporate information stored in Trilium.
General mitigation guidance
Effective mitigation centers on enforcing authentication and limiting the trust placed in local runtime environments and network exposure:
- Require authentication for all Clipper API endpoints, even when running under Electron or other desktop shells; avoid disabling middleware based solely on environment checks.
- Prefer secure-by-default binding strategies, such as listening only on localhost or loopback interfaces, unless the user explicitly opts into network sharing.
- Introduce explicit allowlists or origin checks for any local API intended to be used by browser extensions or local tools.
- Apply least-privilege principles to API capabilities: separate read and write operations and restrict high-risk actions to authenticated, user-confirmed flows.
- Provide clear configuration options that let users control exposure of local APIs and document the security implications of enabling network-accessible endpoints.
These patterns help ensure that sensitive desktop APIs remain protected, even on shared or untrusted networks.
How teams detect issues like this
Detection can focus on both source-level review and runtime behavior:
- Static analysis and code review:
- Flag conditional logic that disables authentication or access control based on environment detection (e.g., "if Electron then skip auth").
- Identify routes under
/api/clipper/or similar namespaces that handle sensitive data but lack authentication or CSRF protections. - Look for server listeners that bind to all interfaces (0.0.0.0) without corresponding access controls.
- Configuration and policy enforcement:
- Enforce secure defaults via security guidelines requiring authentication on all network-exposed APIs.
- Use CI pipelines or automated code review tools to block merges when route handlers are registered without authentication middleware.
- Runtime and network monitoring:
- Monitor for unexpected inbound traffic to high-range ports on desktop systems.
- Use endpoint protection or host firewalls to alert on processes exposing HTTP services on nonstandard ports.
Combining these approaches makes it easier to catch similar missing-authentication issues early in development and during deployment.

