ZeroHour

CVE-2026-75513

large1

SQL Injection in Marten .NET Document DB and Event Store LINQ/Tenant Paths

CVSS 3.1
9.1 critical
EPSS
Published
()
Modified
AI analysis

Marten, a .NET transactional document database and event store built on PostgreSQL, fails to escape or parameterize runtime strings interpolated into single-quoted SQL literals in versions 7.0.0 through before 9.13.0. The confirmed injection point is the dictionary indexer key used by LINQ Where filters (DictionaryItemMember.cs), with additional sinks in SelectParser.cs, DatabaseScopedTenantPartitions.cs, DeleteAllForTenant.cs (reachable via IEventStore.DeleteProjectionProgressAsync), the Newtonsoft-serializer-only DictionaryContainsKeyFilter.cs (System.Text.Json is not affected), and a defense-in-depth per-tenant partition literal in EventLoader.cs. An attacker who controls a value containing a single quote — for example a dictionary key used in a query filter or a tenant identifier — can break out of the generated literal to bypass query filters or multi-tenant authorization and perform blind data exfiltration. Where the deployment permits semicolon-batched Npgsql statements, the injection can extend to data modification. Any application built with Marten 7.0.0–9.12.x on PostgreSQL, particularly multi-tenant apps that pass attacker-influenced keys or tenant IDs into LINQ queries, is affected; no public PoC exists, it is not in CISA KEV, and exploitation is not known to date.

What to do: Upgrade to Marten 9.13.0 or later. Until patched, validate/escape single quotes in values used as dictionary indexer keys in Where filters and in tenant identifiers, avoid enabling semicolon-batched Npgsql statements, and audit multi-tenant query paths (select parsing, tenant partition management, DeleteAllForTenant/DeleteProjectionProgressAsync); note the ContainsKey sink applies only when the Newtonsoft serializer is used.

Affected
JasperFx Marten (.NET Transactional Document DB and Event Store on PostgreSQL)>= 7.0.0, < 9.13.0 (fixed in 9.13.0)
Estimated exposure
largelikely on the order of 10,000–100,000 deployed applications (Marten has millions of cumulative NuGet downloads), though only the subset passing… — Marten is a widely adopted .NET persistence library with millions of lifetime NuGet downloads, but it is embedded in server-side applications rather than deployed as an internet-facing product, and exploitation requires the vulnerable…

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

Description

Marten is a .NET Transactional Document DB and Event Store on PostgreSQL. From version 7.0.0 until 9.13.0, several Marten LINQ and tenant-management paths interpolate runtime, potentially attacker-controlled strings into single-quoted SQL literals without escaping or parameterization. The primary confirmed vector is a dictionary indexer key used by Where filters in src/Marten/Linq/Members/Dictionaries/DictionaryItemMember.cs. Additional affected sinks include SelectParser.cs, DatabaseScopedTenantPartitions.cs, and DeleteAllForTenant.cs reached through IEventStore.DeleteProjectionProgressAsync, while DictionaryContainsKeyFilter.cs (Newtonsoft serializer only; System.Text.Json is not affected) handles ContainsKey calls. Events/Daemon/Internals/EventLoader.cs contains a related per-tenant partition-pruning literal that the advisory identifies as a defense-in-depth sink. A crafted single quote can escape the generated literal, enabling filter or multi-tenant authorization bypass and blind data exfiltration, and deployments that permit semicolon-batched Npgsql statements may also allow data modification. This issue is fixed in version 9.13.0.

Weakness
CWE-89
Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L

In the news

No ingested article mentions this CVE yet.