CVE-2021-22118: Spring Framework Improper Privilege Management Vulnerability
HIGHCVE-2021-22118 is a HIGH (CVSS 7.8) improper privilege management vulnerability (CWE-668: Exposure of Resource to Wrong Sphere) affecting Spring Framework libraries in the Maven ecosystem. The issue involves improper privilege management in spring framework. Remediation is available by upgrading affected packages to version 5.2.15, 5.3.7.
CVE-2021-22118 at a Glance
Security Impact
CVSS: 7.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2021-22118
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</groupId>
<artifactId>spring-web</artifactId>
<version>5.2.15</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.3.7</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
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2021-22118, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.springframework
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 5.2.15), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.springframework 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-22118 Affected Spring Framework Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.springframework:spring-web
|
Maven |
≥ 5.2.0
< 5.2.15
|
5.2.15
|
|
org.springframework:spring-web
|
Maven |
≥ 5.3.0
< 5.3.7
|
5.3.7
|
References
Frequently Asked Questions
What is CVE-2021-22118?
Which Spring Framework versions are affected?
What version fixes CVE-2021-22118?
Is spring-web affected?
What is the CVSS score of CVE-2021-22118?
What CWE is associated with CVE-2021-22118?
How can I check Maven dependencies for CVE-2021-22118?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-gfwj-fwqj-fp3v",
"modified" : "2023-07-19T14:39:30Z",
"published" : "2022-05-24T19:03:28Z",
"aliases" : [ "CVE-2021-22118" ],
"summary" : "Improper Privilege Management in Spring Framework",
"details" : "In Spring Framework, versions 5.2.x prior to 5.2.15 and versions 5.3.x prior to 5.3.7, a WebFlux application is vulnerable to a privilege escalation: by (re)creating the temporary storage directory, a locally authenticated malicious user can read or modify files that have been uploaded to the WebFlux application, or overwrite arbitrary files with multipart request data.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.springframework:spring-web"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "5.2.0"
}, {
"fixed" : "5.2.15"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 5.2.14"
}
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.springframework:spring-web"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "5.3.0"
}, {
"fixed" : "5.3.7"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 5.3.6"
}
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-22118"
}, {
"type" : "WEB",
"url" : "https://github.com/spring-projects/spring-framework/issues/26931"
}, {
"type" : "WEB",
"url" : "https://github.com/spring-projects/spring-framework/commit/0d0d75e25322d8161002d861fff3ec04ba8be5ac"
}, {
"type" : "WEB",
"url" : "https://github.com/spring-projects/spring-framework/commit/cce60c479c22101f24b2b4abebb6d79440b120d1"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/spring-projects/spring-framework"
}, {
"type" : "WEB",
"url" : "https://security.netapp.com/advisory/ntap-20210713-0005"
}, {
"type" : "WEB",
"url" : "https://spring.io/security/cve-2021-22118"
}, {
"type" : "WEB",
"url" : "https://tanzu.vmware.com/security/cve-2021-22118"
}, {
"type" : "WEB",
"url" : "https://www.oracle.com//security-alerts/cpujul2021.html"
}, {
"type" : "WEB",
"url" : "https://www.oracle.com/security-alerts/cpuapr2022.html"
}, {
"type" : "WEB",
"url" : "https://www.oracle.com/security-alerts/cpujan2022.html"
}, {
"type" : "WEB",
"url" : "https://www.oracle.com/security-alerts/cpujul2022.html"
}, {
"type" : "WEB",
"url" : "https://www.oracle.com/security-alerts/cpuoct2021.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-269", "CWE-668" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-06-22T18:24:11Z",
"nvd_published_at" : "2021-05-27T15:15:00Z"
}
}