Summary
Trilium's public share-search endpoint may expose titles, hierarchical paths, identifiers, and content from notes protected by per-note sharing controls. An unauthenticated visitor who can access a published ancestor may be able to enumerate protected notes and infer or recover their contents through search responses.
Affected context
The issue occurs in Trilium deployments using the public share-search functionality when a published subtree contains notes with individual share-password or tree-visibility controls. The endpoint authorizes the supplied ancestor note but may not independently enforce each matching note's shareCredentials and shareHiddenFromTree settings before returning search results.
Exploit preconditions
- Attack surface: Public share-search functionality exposed by a Trilium instance
- Required access: No authenticated account may be required; access to a published ancestor or share context may be sufficient
- Trigger point: A full-text search request against a shared note subtree
- Why exploitation is possible: Authorization is applied to the requested ancestor without consistently rechecking access controls for every matching descendant note
Why this happens
The underlying bug is an authorization boundary failure. The search operation treats authorization for an ancestor note as sufficient for returning results from descendant notes, rather than evaluating each result against its own sharing and visibility settings. This behavior maps primarily to CWE-863: Incorrect Authorization and can produce CWE-200: Exposure of Sensitive Information when protected metadata or content is disclosed.
Potential impact
- An unauthenticated visitor may enumerate protected note titles and tree paths
- Search responses could reveal share identifiers or other note metadata
- Attackers could use content matching as a boolean oracle
- Protected note contents may be inferred or recovered
- Confidential project, operational, or personal information could be disclosed
General mitigation guidance
Mitigation generally focuses on enforcing authorization at the individual resource level throughout search and response generation.
Common defensive patterns include:
- Rechecking each matching note's share-password and visibility controls before including it in results
- Applying the same authorization policy to search, navigation, previews, and direct content retrieval
- Returning only fields that the requesting principal is authorized to view
- Separating public indexes from protected note data and excluding restricted content from public search
- Reducing information leakage through result counts, paths, identifiers, and content-matching behavior
- Using least-privilege service permissions and maintaining conservative default visibility settings
How teams detect issues like this
Organizations can assess this class of issue through:
- Static analysis and code review of search handlers for ancestor-only authorization checks
- Tests that place protected and hidden notes beneath publicly searchable ancestors
- Authorization matrix testing across direct access, search, navigation, previews, and exported results
- Monitoring for repeated content-probing queries and unusual enumeration of share identifiers or paths
- Policy enforcement requiring per-resource access checks before serialized search results are returned
- Automated security review tools that flag data access performed outside the resource's authorization boundary

