{"id":"CVE-2026-75513","aliases":["EUVD-2026-81263","GHSA-rfx3-98h7-v3xp"],"status":"published","title":"Marten: SQL injection in Marten's LINQ provider via unescaped string literals","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.","severity":{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L","level":"critical","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-11","score":0.00468,"percentile":0.40943,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-89"],"published":"2026-09-16T20:46:17Z","modified":"2026-11-09T16:46:31Z","fixes":[{"ecosystem":"NuGet","package":"Marten","fixed_in":["8.37.4","9.13.0"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"NuGet","package":"Marten","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"7.0.0"},{"fixed":"8.37.4"}]}]},{"source":"ghsa","ecosystem":"NuGet","package":"Marten","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"9.0.0"},{"fixed":"9.13.0"}]}]},{"source":"osv","ecosystem":"NuGet","package":"Marten","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"7.0.0"},{"fixed":"8.37.4"}]}],"versions":["7.0.0","7.1.0","7.1.1","7.10.0","7.10.1","7.11.0","7.12.0","7.13.0","7.13.1","7.14.0","7.15.0","7.16.0","7.17.0","7.17.1","7.18.0","7.19.0","7.19.1","7.2.0","7.20.0","7.20.1","7.20.2","7.21.0","7.21.1","7.22.0","7.23.0","7.23.1","7.24.0","7.25.0","7.25.1","7.25.2","7.26.0","7.26.1","7.26.2","7.26.3","7.26.4","7.26.5","7.26.6","7.27.0","7.28.0","7.28.1","7.28.2","7.29.0","7.3.0","7.3.1","7.30.0","7.30.1","7.30.2","7.30.3","7.31.0","7.31.1","7.31.2","7.31.3","7.32.0","7.33.0","7.33.1","7.33.2","7.33.3","7.34.0","7.34.1","7.35.0","7.35.1","7.35.2","7.35.3","7.36.0","7.37.0","7.37.1","7.37.2","7.37.3","7.38.0","7.38.1","7.39.0","7.39.1","7.39.2","7.39.3","7.39.5","7.39.6","7.4.0","7.40.0","7.40.1","7.40.2","7.40.3","7.40.4","7.40.5","7.5.0","7.6.0","7.7.0","7.8.0","7.9.0","8.0.0","8.0.0-alpha-2","8.0.0-alpha-3","8.0.0-alpha-5","8.0.0-alpha-6-","8.0.0-beta-1","8.0.0-beta-2","8.0.0-rc-1","8.0.0-rc-2","8.0.1","8.1.0","8.1.2","8.10.0","8.10.1","8.11.0","8.12.0","8.13.0","8.13.1","8.13.2","8.13.3","8.14.0","8.15.0","8.15.1","8.15.2","8.15.3","8.15.4","8.16.0","8.16.1","8.16.2","8.16.3","8.16.4","8.17.0","8.18.0","8.18.1","8.18.2","8.18.3","8.19.0","8.2.0","8.2.1","8.20.0","8.21.0","8.22.0","8.22.1","8.22.2","8.23.0","8.24.0","8.25.0","8.26.0","8.26.1","8.26.2","8.27.0","8.28.0","8.29.0","8.29.1","8.29.2","8.29.3","8.3.0","8.3.1","8.3.2","8.3.3","8.30.0","8.30.1","8.31.0","8.32.0","8.32.1","8.33.0","8.34.0","8.34.1","8.34.2","8.35.0","8.36.0","8.37.0","8.37.1","8.37.2","8.37.3","8.4.0","8.5.0","8.6.0","8.7.0","8.8.0","8.8.1","8.8.2","8.9.0","8.9.0-channels-alpha-1","8.9.0-channels-alpha-2"]},{"source":"osv","ecosystem":"NuGet","package":"Marten","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"9.0.0"},{"fixed":"9.13.0"}]}],"versions":["9.0.0","9.0.1","9.0.2","9.10.0","9.11.0","9.12.0","9.2.0","9.2.1","9.3.0","9.3.1","9.3.2","9.3.4","9.3.5","9.4.0","9.5.0","9.5.1","9.5.2","9.5.3","9.6.0","9.7.0","9.7.1","9.7.2","9.7.3","9.7.4","9.7.5","9.7.6","9.8.0","9.8.1","9.8.2","9.9.0","9.9.1"]}],"products":[{"vendor":"jasperfx","product":"marten"}],"references":[{"url":"https://github.com/JasperFx/marten/security/advisories/GHSA-rfx3-98h7-v3xp","tags":["x_refsource_CONFIRM","exploit","advisory","web"]},{"url":"https://github.com/JasperFx/marten/pull/4911","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/JasperFx/marten/commit/61882d0424854cb48703f08bdb246894ac576bed","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/JasperFx/marten/releases/tag/9.13.0","tags":["x_refsource_MISC","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-75513","tags":["advisory"]},{"url":"https://github.com/JasperFx/marten/releases/tag/8.37.4","tags":["web"]},{"url":"https://github.com/advisories/GHSA-rfx3-98h7-v3xp"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/75xxx/CVE-2026-75513.json","tags":["advisory"]},{"url":"https://github.com/JasperFx/marten","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2026-75513","title":"Marten: SQL injection in Marten's LINQ provider via unescaped string literals","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.","status":"published","published":"2026-09-16T20:46:17.189Z","modified":"2026-09-19T01:55:24.743Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L","level":"critical","assessor":"cna"}],"cwes":["CWE-89"],"updated_at":"2026-11-02T14:20:07.260654Z"}],"euvd":[{"id":"EUVD-2026-81263","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.","status":"published","published":"2026-09-16T20:46:17Z","modified":"2026-09-19T01:55:24Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L","level":"critical"}],"updated_at":"2026-11-02T17:28:06.992666Z"}],"ghsa":[{"id":"GHSA-rfx3-98h7-v3xp","title":"Marten's LINQ provider has SQL injection via unescaped string literals","description":"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.\n\nThe primary vector is a `Dictionary\u003c,\u003e` indexer **key** used in a `Where` filter — `Where(x =\u003e 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.\n\n## Affected sinks\n\n- `Linq/Members/Dictionaries/DictionaryItemMember.cs` — dictionary indexer key (primary, confirmed PoC)\n- `Linq/Members/Dictionaries/DictionaryContainsKeyFilter.cs` — `Dictionary.ContainsKey(key)` (Newtonsoft serializer only; System.Text.Json escapes the quote)\n- `Linq/Parsing/SelectParser.cs` — a constant string projected through `Select(x =\u003e new { L = runtimeString })`\n- `Internal/Operations/DeleteAllForTenant.cs` — tenant id reaching per-tenant projection teardown via `IEventStore.DeleteProjectionProgressAsync` (an in-code comment wrongly claimed the value was validated)\n- `Schema/DatabaseScopedTenantPartitions.cs` — tenant id inlined into `FOR VALUES IN ('...')` partition DDL\n- `Events/Daemon/Internals/EventLoader.cs` (defense-in-depth) — per-tenant partition-pruning literal\n\n## Proof of concept (primary vector)\n\nBenign: `x.Attributes[\"nonexistent-key\"] == \"v\"` returns 0 rows. Attack: `x.Attributes[\"nonexistent' = '' or 1=1 --\"] == \"v\"` returns all rows. Generated SQL:\n\n```\nselect d.data from public.mt_doc_doc as d where d.data -\u003e 'Attributes' -\u003e\u003e 'x' or 1=1 --' = :p0;\n```\n\n## Fix\n\nEach 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.\n\n## Workarounds\n\nUntil 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.\n\n## Credit\n\nReported privately and responsibly by an external security researcher with an executed PoC. Additional sinks found during the follow-up LINQ-wide audit.","status":"published","published":"2026-09-17T14:51:41Z","modified":"2026-11-09T16:39:14Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L","level":"critical"}],"cwes":["CWE-89"],"updated_at":"2026-11-09T16:48:53.544113Z"}],"nvd":[{"id":"CVE-2026-75513","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.","status":"published","published":"2026-09-16T21:17:13.44Z","modified":"2026-09-19T02:16:54.14Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L","level":"critical","assessor":"secondary"}],"cwes":["CWE-89"],"updated_at":"2026-11-02T14:12:49.013904Z"}],"osv":[{"id":"CVE-2026-75513","title":"Marten: SQL injection in Marten's LINQ provider via unescaped string literals","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.","status":"published","published":"2026-09-16T20:46:17.189Z","modified":"2026-10-28T02:31:03.184387667Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L","level":"critical"}],"cwes":["CWE-89"],"updated_at":"2026-11-02T15:45:17.102988Z"},{"id":"GHSA-rfx3-98h7-v3xp","title":"Marten's LINQ provider has SQL injection via unescaped string literals","description":"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.\n\nThe primary vector is a `Dictionary\u003c,\u003e` indexer **key** used in a `Where` filter — `Where(x =\u003e 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.\n\n## Affected sinks\n\n- `Linq/Members/Dictionaries/DictionaryItemMember.cs` — dictionary indexer key (primary, confirmed PoC)\n- `Linq/Members/Dictionaries/DictionaryContainsKeyFilter.cs` — `Dictionary.ContainsKey(key)` (Newtonsoft serializer only; System.Text.Json escapes the quote)\n- `Linq/Parsing/SelectParser.cs` — a constant string projected through `Select(x =\u003e new { L = runtimeString })`\n- `Internal/Operations/DeleteAllForTenant.cs` — tenant id reaching per-tenant projection teardown via `IEventStore.DeleteProjectionProgressAsync` (an in-code comment wrongly claimed the value was validated)\n- `Schema/DatabaseScopedTenantPartitions.cs` — tenant id inlined into `FOR VALUES IN ('...')` partition DDL\n- `Events/Daemon/Internals/EventLoader.cs` (defense-in-depth) — per-tenant partition-pruning literal\n\n## Proof of concept (primary vector)\n\nBenign: `x.Attributes[\"nonexistent-key\"] == \"v\"` returns 0 rows. Attack: `x.Attributes[\"nonexistent' = '' or 1=1 --\"] == \"v\"` returns all rows. Generated SQL:\n\n```\nselect d.data from public.mt_doc_doc as d where d.data -\u003e 'Attributes' -\u003e\u003e 'x' or 1=1 --' = :p0;\n```\n\n## Fix\n\nEach 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.\n\n## Workarounds\n\nUntil 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.\n\n## Credit\n\nReported privately and responsibly by an external security researcher with an executed PoC. Additional sinks found during the follow-up LINQ-wide audit.","status":"published","published":"2026-09-17T14:51:41Z","modified":"2026-11-09T16:46:31.948335441Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L","level":"critical"}],"cwes":["CWE-89"],"updated_at":"2026-11-09T17:04:22.742827Z"}]}}
