Vulnerability GHSA-rfx3-98h7-v3xp

Critical
CRITICAL RISK
CVSS Score: 9.1
Score Range: 9.0–10.0
Critical severity vulnerabilities (CVSS 9.0–10.0). These represent the highest impact issues.
1 month ago
September 17, 2026 at 02:51 PM UTC
Marten's LINQ provider has SQL injection via unescaped string literals
7.0.0 - 7.39.3 and 7.39.5 - 8.0.0-alpha-2 and 8.0.0-alpha-3 and 8.0.0-alpha-5 and 8.0.0-alpha-6- and 8.0.0-beta-1 and 8.0.0-beta-2 and 8.0.0-rc-1 and 8.0.0-rc-2 and 8.0.0 - 8.1.0 and 8.1.2 - 8.9.0-channels-alpha-1 and 8.9.0-channels-alpha-2 and 8.9.0 - 9.0.2 and 9.2.0 - 9.3.2 and 9.3.4 - 9.12.0
7.0.0 - 7.39.3 and 7.39.5 - 8.0.0-alpha-2 and 8.0.0-alpha-3 and 8.0.0-alpha-5 and 8.0.0-alpha-6- and 8.0.0-beta-1 and 8.0.0-beta-2 and 8.0.0-rc-1 and 8.0.0-rc-2 and 8.0.0 - 8.1.0 and 8.1.2 - 8.9.0-channels-alpha-1 and 8.9.0-channels-alpha-2 and 8.9.0 - 9.0.2 and 9.2.0 - 9.3.2 and 9.3.4 - 9.12.0

Summary

Marten's LINQ provider has SQL injection via unescaped string literals

Details

Several code paths in Marten's LINQ provider and tenant-management internals interpolated a runtime, potentially attacker-influenced value into generated SQL as a single-quoted string literal without escaping or parameterization. A value containing a single quote (') could break out of the literal and inject arbitrary SQL.

The primary vector is a Dictionary<,> indexer key used in a Where filter — Where(x => x.Attributes[key] == v) — a common "filter by attribute name" / EAV pattern. It is confirmed with an executed proof-of-concept and yields filter / multi-tenant authorization bypass (returning other tenants' rows) and blind data exfiltration. Where the application permits ;-batched statements (Npgsql default), data modification is also possible.

Affected sinks

  • Linq/Members/Dictionaries/DictionaryItemMember.cs — dictionary indexer key (primary, confirmed PoC)
  • Linq/Members/Dictionaries/DictionaryContainsKeyFilter.cs — Dictionary.ContainsKey(key) (Newtonsoft serializer only; System.Text.Json escapes the quote)
  • Linq/Parsing/SelectParser.cs — a constant string projected through Select(x => new { L = runtimeString })
  • Internal/Operations/DeleteAllForTenant.cs — tenant id reaching per-tenant projection teardown via IEventStore.DeleteProjectionProgressAsync (an in-code comment wrongly claimed the value was validated)
  • Schema/DatabaseScopedTenantPartitions.cs — tenant id inlined into FOR VALUES IN ('...') partition DDL
  • Events/Daemon/Internals/EventLoader.cs (defense-in-depth) — per-tenant partition-pruning literal

Proof of concept (primary vector)

Benign: x.Attributes["nonexistent-key"] == "v" returns 0 rows. Attack: x.Attributes["nonexistent' = '' or 1=1 --"] == "v" returns all rows. Generated SQL:

select d.data from public.mt_doc_doc as d where d.data -> 'Attributes' ->> 'x' or 1=1 --' = :p0;

Fix

Each sink now escapes embedded single quotes (.Replace("'", "''"), mirroring the existing Ordering.BuildNgramRankExpression) or binds the value as a parameter (DeleteAllForTenant). Where a literal is retained for partition pruning, escaping preserves plan-time pruning while closing the injection. Regression tests lock down each vector.

Workarounds

Until upgrading: do not pass untrusted input as a dictionary indexer key / ContainsKey argument / Select constant, nor as a tenant id into projection teardown or provisioning; and disable multi-statement command batching to limit blast radius.

Credit

Reported privately and responsibly by an external security researcher with an executed PoC. Additional sinks found during the follow-up LINQ-wide audit.

Related Vulnerabilities

Other vulnerabilities affecting the same packages

Critical
5 months ago
Marten has an injection vulnerability in its full-text search regConfig parameter
0.5.0.8 and 0.5.0.9 and 0.5.1.34 and 0.5.2.36 and 0.5.3.38 and 0.6.0.43 and 0.6.1.46 and 0.6.2.57 and 0.6.3.67 and 0.6.4.77 and 0.6.5.78 and 0.6.6.82 and 0.7.0.85 and 0.7.0.97 and 0.7.1.103 and 0.8.0.132 and 0.8.2.188 and 0.8.3.238 and 0.8.4.255 and 0.8.5.274 and 0.8.6.284 and 0.8.7.297 and 0.8.8.299 and 0.8.9.322 and 0.8.10.355 and 0.9.0.379 and 0.9.1.401 and 0.9.2.423 and 0.9.2.427 and 0.9.3.458 and 0.9.4.464 and 0.9.5.473 and 0.9.6.493 and 0.9.6.498 and 0.9.7.515 and 0.9.7.517 and 0.9.8.523 and 0.9.9.534 and 0.9.9.551 and 0.9.10.555 and 0.9.11.556 and 0.9.12.563 and 1.0.0-alpha-625 and 1.0.0-alpha-639 and 1.0.0-alpha-644 and 1.0.0-alpha-663 and 1.0.0-alpha-664 and 1.0.0-alpha-666 and 1.0.0-alpha-667 and 1.0.0-alpha-668 and 1.0.0-alpha-669 and 1.0.0-alpha-701 and 1.0.0-alpha-703 and 1.0.0-alpha-706 and 1.0.0-alpha-709 and 1.0.0-alpha-710 and 1.0.0-alpha-719 and 1.0.0 - 2.0.0-alpha-50651 and 2.0.0-alpha-51133 and 2.0.0-alpha-51614 and 2.0.0-rc-50930 and 2.0.0-rc-51247 and 2.0.0 - 3.0.0-alpha-1 and 3.0.0-alpha-2 and 3.0.0 - 4.0.0-alpha and 4.0.0 - 5.11.0 and 6.0.3 - 7.39.3 and 7.39.5 - 8.0.0-alpha-2 and 8.0.0-alpha-3 and 8.0.0-alpha-5 and 8.0.0-alpha-6- and 8.0.0-beta-1 and 8.0.0-beta-2 and 8.0.0-rc-1 and 8.0.0-rc-2 and 8.0.0 - 8.1.0 and 8.1.2 - 8.9.0-channels-alpha-1 and 8.9.0-channels-alpha-2 and 8.9.0 - 8.36.0 GHSA-vmw2-qwm8-x84c
0.5.0.8 and 0.5.0.9 and 0.5.1.34 and 0.5.2.36 and 0.5.3.38 and 0.6.0.43 and 0.6.1.46 and 0.6.2.57 and 0.6.3.67 and 0.6.4.77 and 0.6.5.78 and 0.6.6.82 and 0.7.0.85 and 0.7.0.97 and 0.7.1.103 and 0.8.0.132 and 0.8.2.188 and 0.8.3.238 and 0.8.4.255 and 0.8.5.274 and 0.8.6.284 and 0.8.7.297 and 0.8.8.299 and 0.8.9.322 and 0.8.10.355 and 0.9.0.379 and 0.9.1.401 and 0.9.2.423 and 0.9.2.427 and 0.9.3.458 and 0.9.4.464 and 0.9.5.473 and 0.9.6.493 and 0.9.6.498 and 0.9.7.515 and 0.9.7.517 and 0.9.8.523 and 0.9.9.534 and 0.9.9.551 and 0.9.10.555 and 0.9.11.556 and 0.9.12.563 and 1.0.0-alpha-625 and 1.0.0-alpha-639 and 1.0.0-alpha-644 and 1.0.0-alpha-663 and 1.0.0-alpha-664 and 1.0.0-alpha-666 and 1.0.0-alpha-667 and 1.0.0-alpha-668 and 1.0.0-alpha-669 and 1.0.0-alpha-701 and 1.0.0-alpha-703 and 1.0.0-alpha-706 and 1.0.0-alpha-709 and 1.0.0-alpha-710 and 1.0.0-alpha-719 and 1.0.0 - 2.0.0-alpha-50651 and 2.0.0-alpha-51133 and 2.0.0-alpha-51614 and 2.0.0-rc-50930 and 2.0.0-rc-51247 and 2.0.0 - 3.0.0-alpha-1 and 3.0.0-alpha-2 and 3.0.0 - 4.0.0-alpha and 4.0.0 - 5.11.0 and 6.0.3 - 7.39.3 and 7.39.5 - 8.0.0-alpha-2 and 8.0.0-alpha-3 and 8.0.0-alpha-5 and 8.0.0-alpha-6- and 8.0.0-beta-1 and 8.0.0-beta-2 and 8.0.0-rc-1 and 8.0.0-rc-2 and 8.0.0 - 8.1.0 and 8.1.2 - 8.9.0-channels-alpha-1 and 8.9.0-channels-alpha-2 and 8.9.0 - 8.36.0 GHSA-vmw2-qwm8-x84c
View all vulnerabilities for these packages

Impacted packages

Timeline

Published
1 month ago
September 17, 2026 at 02:51 PM UTC
Fixed (9.13.0)
4 months ago
July 08, 2026 at 03:53 PM UTC
Last Modified
8 hours ago
November 09, 2026 at 04:46 PM UTC