CVE-2016-6652: Spring Framework Improper Neutralization Of Special Elements Vulnerability

MODERATE
Advisory Identifier: GHSA-xr4v-28rm-pvgw
CVSS 5.6
CWE-89
Published
Advisory Summary

CVE-2016-6652 is a MODERATE (CVSS 5.6) improper neutralization of special elements vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Spring Framework libraries in the Maven ecosystem. The issue involves improper neutralization of special elements used in an sql command pivotal spring data jpa. Remediation is available by upgrading affected packages to version 1.9.6, 1.10.4.

CVE-2016-6652 at a Glance

CVE Identifier CVE-2016-6652
GHSA Identifier GHSA-xr4v-28rm-pvgw
Severity MODERATE
CVSS v3.1 Base Score 5.6
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Spring Framework
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 5.6

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2016-6652

To remediate this vulnerability, upgrade all affected Spring Framework dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

org.springframework.data:spring-data-jpa fixed: 1.9.6
<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-jpa</artifactId>
    <version>1.9.6</version>
</dependency>
org.springframework.data:spring-data-jpa fixed: 1.10.4
<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-jpa</artifactId>
    <version>1.10.4</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=org.springframework.data

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2016-6652, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.springframework.data

Analyze the terminal output to locate any version of Spring Framework in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.9.6), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.springframework.data command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Spring Framework, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

SQL injection vulnerability in Pivotal Spring Data JPA before 1.9.6 (Gosling SR6) and 1.10.x before 1.10.4 (Hopper SR4), when used with a repository that defines a String query using the @Query annotation, allows attackers to execute arbitrary JPQL commands via a sort instance with a function call.

CVE-2016-6652 Affected Spring Framework Versions

2 component(s)
Fixed Versions:
1.9.61.10.4
Product / Package Ecosystem Affected Versions Fixed Version
org.springframework.data:spring-data-jpa
Maven
< 1.9.6
1.9.6
org.springframework.data:spring-data-jpa
Maven
≥ 1.10.0
< 1.10.4
1.10.4

References

Frequently Asked Questions

What is CVE-2016-6652?
CVE-2016-6652 is a security vulnerability in Spring Framework involving Improper Neutralization of Special Elements used in an SQL Command Pivotal Spring Data JPA under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Spring Framework versions are affected?
Affected versions include releases prior to 1.9.6, 1.10.4 across affected packages: org.springframework.data:spring-data-jpa.
What version fixes CVE-2016-6652?
Upgrading to 1.9.6, 1.10.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is spring-data-jpa affected?
Yes, org.springframework.data:spring-data-jpa is affected in releases prior to 1.9.6, 1.10.4. Upgrade your dependency to 1.9.6, 1.10.4 or later.
What is the CVSS score of CVE-2016-6652?
CVE-2016-6652 has a CVSS v3.1 base score of 5.6 (MODERATE) with vector string CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2016-6652?
CVE-2016-6652 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check Maven dependencies for CVE-2016-6652?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.springframework.data'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-xr4v-28rm-pvgw",
  "modified" : "2022-07-06T19:45:18Z",
  "published" : "2022-05-17T02:37:09Z",
  "aliases" : [ "CVE-2016-6652" ],
  "summary" : "Improper Neutralization of Special Elements used in an SQL Command  Pivotal Spring Data JPA",
  "details" : "SQL injection vulnerability in Pivotal Spring Data JPA before 1.9.6 (Gosling SR6) and 1.10.x before 1.10.4 (Hopper SR4), when used with a repository that defines a String query using the @Query annotation, allows attackers to execute arbitrary JPQL commands via a sort instance with a function call.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.springframework.data:spring-data-jpa"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.9.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.springframework.data:spring-data-jpa"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.10.0"
      }, {
        "fixed" : "1.10.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2016-6652"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/spring-projects/spring-data-jpa/commit/b8e7fe"
  }, {
    "type" : "WEB",
    "url" : "https://jira.spring.io/browse/DATAJPA-965"
  }, {
    "type" : "WEB",
    "url" : "https://pivotal.io/security/cve-2016-6652"
  }, {
    "type" : "WEB",
    "url" : "https://security.gentoo.org/glsa/201701-01"
  }, {
    "type" : "WEB",
    "url" : "http://www.securityfocus.com/bid/93276"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-07-06T19:45:18Z",
    "nvd_published_at" : "2016-10-05T16:59:00Z"
  }
}