/

CVE-2026-75513

Severity:

CRITICAL RISK

(9.1)

SQL Injection (CWE-89) in Marten LINQ/Tenant Filters

CVE-2026-75513

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Authorization Bypass, Blind Data Exfiltration, and Potential Data Modification

Severity:

CRITICAL RISK

(9.1)

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

Marten contains SQL injection vulnerabilities in several LINQ and tenant-management paths that interpolate runtime strings into single-quoted SQL literals without reliable escaping or parameterization. If an attacker can influence a dictionary key, tenant value, or related filter input, they may bypass authorization, extract data, or, in some database configurations, modify data.

Affected context

The issue affects Marten deployments using vulnerable LINQ, dictionary, event-store, or tenant-management paths where runtime values are incorporated into generated PostgreSQL statements. Relevant contexts include dictionary indexer keys in Where filters, selected projection or tenant-partition operations, and certain ContainsKey calls when the Newtonsoft.Json serializer is used. The related System.Text.Json handling for ContainsKey is not affected according to the advisory.

Exploit preconditions

  • Attack surface: Application endpoints, background operations, or APIs that expose affected Marten query and tenant-management functionality
  • Required access: The ability to supply or influence a runtime filter value, dictionary key, tenant identifier, or related operation input
  • Trigger point: SQL generation and execution in affected LINQ, event-store, dictionary, or tenant-partition code paths
  • Why exploitation is possible: Runtime strings are inserted into single-quoted SQL literals without consistent parameterization or escaping, allowing input to alter the intended SQL expression
  • Additional condition for data modification: The database driver and deployment configuration must permit the resulting statement behavior, including any applicable restrictions on batched statements

Why this happens

The underlying bug is an unsafe SQL construction pattern. A runtime-controlled string is interpolated into a single-quoted SQL literal instead of being represented as a bound database parameter or safely encoded according to the database driver's rules.

This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'). The same class of flaw appears across multiple sinks, including dictionary item filters, projection parsing, tenant partition management, tenant deletion operations, and related event-loading logic. Validation performed after SQL text construction cannot reliably compensate for unsafe query generation.

Potential impact

  • An attacker may bypass tenant or filter-based authorization controls.
  • Sensitive records may be disclosed through blind data-extraction behavior.
  • Query results may be altered, causing incorrect application decisions or data exposure.
  • Data may be modified or deleted where statement batching and database permissions allow it.
  • Cross-tenant isolation may be weakened.
  • Compromised application credentials may provide broader database access than intended.

General mitigation guidance

Mitigation generally focuses on ensuring that all runtime values remain data rather than SQL syntax.

Common defensive patterns include:

  • Use parameterized queries and expression translators that bind values through the database provider.
  • Centralize SQL generation so every literal-producing path follows the same safe parameter-binding policy.
  • Avoid manual quoting, string interpolation, and concatenation when constructing SQL.
  • Apply strict allowlists for structural inputs such as field names, operation types, and tenant selectors; treat values as untrusted by default.
  • Prefer serializers and query paths that preserve typed values without converting them into executable SQL fragments.
  • Enforce least-privilege database roles, restrict write and administrative permissions, and separate tenant data access where practical.
  • Disable unnecessary multi-statement behavior and apply database policies that limit destructive operations.

How teams detect issues like this

Detection can combine source review, automated analysis, and runtime monitoring.

  • Use static analysis rules to identify SQL strings built through interpolation, concatenation, or formatting with runtime values.
  • Review LINQ translators, tenant-management code, event loaders, and serializer-specific branches for generated SQL literals.
  • Flag manual quote handling and APIs that accept raw SQL fragments without parameter metadata.
  • Add code-review policies requiring parameter binding for all user-, tenant-, and request-derived database values.
  • Test authorization boundaries with negative cases involving special characters and cross-tenant identifiers, without relying on production data.
  • Monitor database logs for unexpected statement structure, unusual quoting patterns, multi-statement requests, and access across tenant boundaries.
  • Neutral automated security review tools may help identify suspicious SQL construction paths before deployment.

Sources

SourceLink
github.comgithub.com/JasperFx/marten/commit/61882d0424854cb48703f08bdb246894ac576bed
github.comgithub.com/JasperFx/marten/pull/4911
github.comgithub.com/JasperFx/marten/releases/tag/9.13.0
github.comgithub.com/JasperFx/marten/security/advisories/GHSA-rfx3-98h7-v3xp

Frequently asked

questions

It can be remotely exploitable when an application exposes affected Marten query or tenant-management operations to users who can control filter values, dictionary keys, tenant identifiers, or similar inputs. Exploitability depends on the application's reachable attack surface and authorization controls.

Direct database credentials are not necessarily required. An attacker may only need application-level access to a feature that passes attacker-controlled values into an affected Marten path.

Ensure every runtime value is passed as a bound database parameter rather than interpolated into SQL text. Structural query elements should be selected from strict allowlists, while values should remain typed parameters.

Enforce parameterized-query policies, review query translators and tenant boundaries, test cross-tenant authorization behavior, restrict database privileges, and monitor for anomalous SQL statements.

Find out what's already
exploitable in your codebase.