# CVE-2026-39311: Trilium Notes: Stored XSS Leads to Unauthorized Remote Code Execution (RCE) via Unsanitized SVG Attachments

- Severity: Medium 6.8 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:L/I:L/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.29%, higher than 22% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-05-20T19:13:00.524Z
- Modified: 2026-07-23T12:10:00.110Z
- Weaknesses: CWE-79, CWE-94
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial
- Assigned by: GitHub_M

## Description

Trilium Notes is a cross-platform, hierarchical note taking application focused on building large personal knowledge bases. Versions 0.102.1 and prior contain a critical security flaw where lack of SVG sanitization combined with a disabled Content Security Policy (CSP) and a publicly reachable backend execution API results in an unauthenticated Remote Code Execution (RCE). The vulnerability arises from an insecure-by-design architecture: Trilium serves SVG attachments with the image/svg+xml MIME type without any sanitization, and it explicitly disables Helmet's Content Security Policy middleware, removing the primary defense against script execution in served assets. Because the malicious SVG runs under the Same-Origin Policy, it can issue a fetch('/') to extract the csrfToken from the document body. With that token, it can send a signed request to /api/script/exec to execute arbitrary Node.js code on the server. An attacker can compromise the entire server instance simply by tricking an authenticated user into viewing a shared SVG attachment. The issue has been fixed in version 0.102.2.

(As written by CVE List.)

## Affected

- TriliumNext Trilium: < 0.102.2

## References

- <https://github.com/TriliumNext/Trilium/security/advisories/GHSA-p837-cxw3-m964> (exploit)
- <https://github.com/TriliumNext/Trilium/releases/tag/v0.102.2>

## Sources

- CVE List: [CVE-2026-39311](https://www.cve.org/CVERecord?id=CVE-2026-39311), CVE Terms of Use, modified 2026-05-20
- NVD: [CVE-2026-39311](https://nvd.nist.gov/vuln/detail/CVE-2026-39311), Public domain, modified 2026-07-23

---

Page: https://cve.day/CVE-2026-39311 · Whole record: https://cve.day/CVE-2026-39311.json · Rebuilt by cve.day 2026-11-25T22:59:22.064Z
