/

CVE-2026-135686

Severity:

HIGH RISK

(7.4)

SQL Injection (CWE-89) in Trilium Sync Update Handler

CVE-2026-135686

Received

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Unauthorized database access and modification

Severity:

HIGH RISK

(7.4)

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

Trilium's sync update handling can interpret crafted entity names and column keys as SQL, rather than treating them strictly as data. A malicious sync partner who can submit data to the affected sync endpoints may be able to read sensitive database records or write arbitrary rows.

Affected context

The vulnerability affects Trilium through version 0.107.0 in the updateNormalEntity() sync update path. It may arise when data submitted through /api/sync/changed or PUT /api/sync/update is used to construct database queries without safely separating SQL syntax from supplied entity names and column keys.

Exploit preconditions

  • Attack surface: Trilium synchronization API endpoints
  • Required access: The ability to submit sync data as a partner; the exact authentication requirements depend on deployment configuration
  • Trigger point: Processing crafted entity names or column keys during a sync update
  • Why exploitation is possible: If supplied values are incorporated into SQL structure without safe parameterization or strict validation, they may alter the resulting query

Why this happens

This is an SQL injection flaw mapped to CWE-89: Improper Neutralization of Special Elements used in an SQL Command. The underlying insecure pattern is building or modifying SQL statements using externally supplied identifiers or values without safely constraining them to expected database fields and binding values as parameters.

Potential impact

  • An attacker may be able to read sensitive records, including session, API-token, or user-data information
  • Database rows could be created or modified without authorization
  • Application data integrity and confidentiality could be compromised
  • Changes to stored data could disrupt synchronization or application behavior

General mitigation guidance

Mitigation generally focuses on preventing untrusted sync data from influencing SQL syntax.

Common defensive patterns include:

  • Using parameterized queries for all user-controlled values
  • Mapping permitted entity and column names through strict allowlists, since SQL parameters do not safely substitute identifiers
  • Validating sync records against explicit schemas before database operations
  • Limiting sync-partner permissions and database privileges to the minimum required
  • Treating data from connected or trusted partners as untrusted at the database boundary

How teams detect issues like this

Detection approaches may include:

  • Static analysis for SQL statements assembled through string concatenation or interpolation
  • Code review of sync handlers, especially uses of entity names and column keys in query construction
  • Tests that verify malformed or unexpected identifiers are rejected and values cannot alter query structure
  • Policy checks requiring parameterized SQL and allowlisted database identifiers
  • Monitoring sync requests and database activity for unexpected query patterns or changes to sensitive tables

Sources

SourceLink
github.comgithub.com/TriliumNext/Trilium
github.comgithub.com/TriliumNext/Trilium/blob/v0.107.0/packages/trilium-core/src/services/sync_update.ts#L107
github.comgithub.com/TriliumNext/Trilium/commit/4ec30088fce936f2e87c0af6af3f89c47d331176
vulncheck.comvulncheck.com/advisories/trilium-through-0.107.0-sql-injection-via-sync-update-entity-name

Frequently asked

questions

The affected paths are sync API endpoints, so exploitation may be possible over the network when those endpoints are reachable and an attacker can submit sync data.

The described attack requires the ability to act as a sync partner or otherwise submit data to the affected endpoints. Authentication and authorization requirements depend on the deployment.

Use parameterized queries for values and strict allowlists for identifiers such as entity and column names.

Treat sync input as untrusted, validate it against explicit schemas, review query construction for unsafe interpolation, and restrict database privileges.

Find out what's already
exploitable in your codebase.