In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applicationsUpgrade org.springframework.data:spring-data-mongodb to version 5.0.9, 5.1.3 or higher.
Affected versions of this package are vulnerable to Improper Neutralization of Special Elements in Data Query Logic in the ParameterBindingJsonReader class, which binds a String argument into an MQL @Query or @Aggregation placeholder without escaping it for the surrounding quoted string literal. A user supplying a repository method argument that contains a quote or JavaScript metacharacter can break out of the literal and alter the query when the placeholder sits inside a server-side script operator such as $where, $function, or $accumulator. Exploitation requires MongoDB server-side JavaScript to be enabled and the application to pass untrusted input to such a templated query method without sanitization.
This vulnerability can be avoided by disabling MongoDB server-side JavaScript (security.javascriptEnabled: false), which removes the $where/$function/$accumulator execution the injection relies on.