MODERATE

CVE-2026-59342

Spring Data MongoDB String query logic injection via function operator bind parameter

Description

Spring Data MongoDB's parameter binding mechanism for JSON-based query and aggregation using placeholder syntax did not contextually escape bound String argument values when those placeholders appeared inside a quoted string literal.

The application is vulnerable if all of the following are true:

MongoDB server-side JavaScript functions are enabled. The application accepts input parameters from untrusted sources and uses them without prior sanitization as repository query method argument of type String. The repository method is annotated with an MQL query template (e.g. @Query, @Aggregation) that uses a value placeholder inside a script expression (e.g. $accumulator, $function, $where, ...)

Affected Maven artifacts (1)

ArtifactAffected versionsFixed in
org.springframework.data » spring-data-mongodb
<= 3.4.21>= 4.4.0, <= 4.4.16>= 4.5.0, <= 4.5.14>= 5.0.0, < 5.0.9>= 5.1.0, < 5.1.3
5.0.9, 5.1.3

Blast radius

1affected artifacts
311affected versions
1,920dependent artifacts (est.)
43,945dependent versions

63% of the dependent artifacts (1,227) still pull an affected version in their latest release.

DepthDependent versions
Direct
24,957
2 hops
11,565
3 hops
5,422
4 hops
1,753
5 hops
228
6 hops
20

Most used dependents

Computed from the dependency graph of build 20261125.0317 (compile and runtime scopes, nearest version wins). Exclusions and dependency management in consuming projects are not applied, so dependents are potentially affected. When several artifacts are affected, a dependent version that pulls more than one of them is counted once per artifact.