ZeroHour

CVE-2026-47727

moderate

Template injection via crafted import archive enables RCE in Trilium Notes

CVSS 4.0
8.6 high
EPSS
<1%p37
Published
()
Modified
AI analysis

Trilium Notes, an open-source self-hosted hierarchical note-taking application, fails before version 0.104.0 to treat the shareTemplate relation as dangerous, so its default-on "Safe import" filter does not disable that code-loading relation during import. An attacker who induces a victim to import a crafted archive can plant a server-side share template whose linked EJS code note is later passed raw into ejs.render when the victim publishes the imported note for sharing. Once the note is published, any unauthenticated request to the shared note executes the attacker's JavaScript in the server's Node process with full access to require, process, the filesystem, and the network, yielding remote code execution. Only Trilium deployments running versions prior to 0.104.0 are affected, and the flaw is fixed in 0.104.0. No public proof-of-concept, CISA KEV listing, or confirmed in-the-wild exploitation is known, with EPSS currently estimating a 0.4% probability of exploitation within 30 days.

What to do: Upgrade Trilium to version 0.104.0 or later. Until upgraded, import note archives only from trusted sources, avoid publishing newly imported notes, and audit existing shared notes for shareTemplate relations pointing to code notes you did not create; restrict public internet exposure of Trilium servers where feasible.

Affected
Trilium Notes (open-source project) Triliumall versions prior to 0.104.0
Estimated exposure
moderatelikely tens of thousands of total self-hosted users, with plausibly only low thousands of internet-exposed servers that have sharing enabled (estimate) — Trilium is a niche self-hosted personal/team note app whose community popularity (tens of thousands of GitHub stars) suggests an installed base in the tens of thousands, but most instances run locally or behind a VPN and only a fraction…

Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.

Description

Trilium is an open-source hierarchical note-taking application. In versions prior to 0.104.0, the default-on "Safe import" filter fails to neutralize the shareTemplate relation because that relation is not marked as dangerous, allowing an attacker-supplied import archive to plant a server-side template that leads to remote code execution. The relation is omitted from the built-in list of dangerous attributes, so unlike other code-loading relations it is not disabled on import, and when the victim later publishes the imported note the public share renderer feeds the linked EJS code note's raw bytes into ejs.render, which compiles them in the server's Node process. An unauthenticated request to the shared note then executes the attacker's JavaScript with full access to require, process, the filesystem, and the network. This issue is fixed in version 0.104.0.

Weakness
CWE-94, CWE-1336
Vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

In the news

No ingested article mentions this CVE yet.