CVE-2021-22047: Spring Framework Remote Code Execution Vulnerability
MODERATECVE-2021-22047 is a MODERATE (CVSS 5.3) remote code execution vulnerability (CWE-668: Exposure of Resource to Wrong Sphere) affecting Spring Framework libraries in the Maven ecosystem. The issue involves exposure of resource to wrong sphere in spring data rest. Remediation is available by upgrading affected packages to version 3.4.14, 3.5.6.
CVE-2021-22047 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N).
How to Fix CVE-2021-22047
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.
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-core</artifactId>
<version>3.4.14</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-core</artifactId>
<version>3.5.6</version>
</dependency>
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-2021-22047, 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 3.4.14), 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-668: Exposure of Resource to Wrong Sphere, where the product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource. 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
CVE-2021-22047 Affected Spring Framework Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.springframework.data:spring-data-rest-core
|
Maven |
≥ 3.4.0
< 3.4.14
|
3.4.14
|
|
org.springframework.data:spring-data-rest-core
|
Maven |
≥ 3.5.0
< 3.5.6
|
3.5.6
|
References
Frequently Asked Questions
What is CVE-2021-22047?
Which Spring Framework versions are affected?
What version fixes CVE-2021-22047?
Is spring-data-rest-core affected?
What is the CVSS score of CVE-2021-22047?
What CWE is associated with CVE-2021-22047?
How can I check Maven dependencies for CVE-2021-22047?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-4926-qpxg-6r3w",
"modified" : "2022-06-22T18:29:53Z",
"published" : "2022-05-24T19:19:03Z",
"aliases" : [ "CVE-2021-22047" ],
"summary" : "Exposure of Resource to Wrong Sphere in Spring Data REST",
"details" : "In Spring Data REST versions 3.4.0 - 3.4.13, 3.5.0 - 3.5.5, and older unsupported versions, HTTP resources implemented by custom controllers using a configured base API path and a controller type-level request mapping are additionally exposed under URIs that can potentially be exposed for unauthorized access depending on the Spring Security configuration.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.springframework.data:spring-data-rest-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.4.0"
}, {
"fixed" : "3.4.14"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.4.13"
}
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.springframework.data:spring-data-rest-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.5.0"
}, {
"fixed" : "3.5.6"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.5.5"
}
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-22047"
}, {
"type" : "WEB",
"url" : "https://tanzu.vmware.com/security/cve-2021-22047"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-668" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-06-22T18:29:53Z",
"nvd_published_at" : "2021-10-28T16:15:00Z"
}
}