QID 376684

QID 376684: Spring Data MongoDB SpEL Expression Injection Vulnerability

A Spring Data MongoDB application is vulnerable to SpEL Injection when using @Query or @Aggregation-annotated query methods with SpEL expressions that contain query parameter placeholders for value binding if the input is not sanitized.
Specifically, an application is vulnerable when all of the following are true:

  1. A repository query method is annotated with @Query or @Aggregation
  2. The annotated query or aggregation value/pipeline contains SpEL parts using the parameter placeholder syntax within the expression
  3. The user supplied input is not sanitized by the application
Affected VMware Products and Versions

Spring Data MongoDB:

  1. 3.4.0
  2. 3.3.0 to 3.3.4
  3. Older, unsupported versions are also affected

A remote attacker can execute arbitrary code on the target system. Successful exploitation of this vulnerability may result in a complete compromise of a vulnerable system.

  • CVSS V3 rated as Critical - 9 severity.
  • CVSS V2 rated as High - 7.6 severity.
  • Solution
    Users of affected versions should apply the following mitigation: 3.4.x users should upgrade to 3.4.1+. 3.3.x users should upgrade to 3.3.5+. No other steps are necessary.
    Vendor References

    CVEs related to QID 376684

    Software Advisories
    Advisory ID Software Component Link
    Spring URL Logo spring.io/blog/2022/06/20/spring-data-mongodb-spel-expression-injection-vulnerability-cve-2022-22980