CVE-2023-20862: Spring Framework Spring Security Logout Not Clearing Vulnerability
MODERATECVE-2023-20862 is a MODERATE (CVSS 6.3) spring security logout not clearing vulnerability (CWE-459: Incomplete Cleanup) affecting Spring Framework libraries in the Maven ecosystem. The issue involves spring security logout not clearing security context. Remediation is available by upgrading affected packages to version 5.7.8, 5.8.3, 6.0.3.
CVE-2023-20862 at a Glance
Security Impact
CVSS: 6.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L).
How to Fix CVE-2023-20862
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.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>5.7.8</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>5.8.3</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>6.0.3</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.security
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2023-20862, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.springframework.security
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.7.8), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.springframework.security 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-459: Incomplete Cleanup, where the product does not properly "clean up" and remove temporary or supporting resources after they have been used. 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-2023-20862 Affected Spring Framework Versions
3 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.springframework.security:spring-security-core
|
Maven |
≥ 5.7.0
< 5.7.8
|
5.7.8
|
|
org.springframework.security:spring-security-core
|
Maven |
≥ 5.8.0
< 5.8.3
|
5.8.3
|
|
org.springframework.security:spring-security-core
|
Maven |
≥ 6.0.0
< 6.0.3
|
6.0.3
|
References
Frequently Asked Questions
What is CVE-2023-20862?
Which Spring Framework versions are affected?
What version fixes CVE-2023-20862?
Is spring-security-core affected?
What is the CVSS score of CVE-2023-20862?
What CWE is associated with CVE-2023-20862?
How can I check Maven dependencies for CVE-2023-20862?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-x873-6rgc-94jc",
"modified" : "2023-08-23T22:15:24Z",
"published" : "2023-04-19T21:30:26Z",
"aliases" : [ "CVE-2023-20862" ],
"summary" : "Spring Security logout not clearing security context",
"details" : "In Spring Security, versions 5.7.x prior to 5.7.8, versions 5.8.x prior to 5.8.3, and versions 6.0.x prior to 6.0.3, the logout support does not properly clean the security context if using serialized versions. Additionally, it is not possible to explicitly save an empty security context to the HttpSessionSecurityContextRepository. This vulnerability can keep users authenticated even after they performed logout. Users of affected versions should apply the following mitigation. 5.7.x users should upgrade to 5.7.8. 5.8.x users should upgrade to 5.8.3. 6.0.x users should upgrade to 6.0.3.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.springframework.security:spring-security-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "5.7.0"
}, {
"fixed" : "5.7.8"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.springframework.security:spring-security-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "5.8.0"
}, {
"fixed" : "5.8.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.springframework.security:spring-security-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "6.0.0"
}, {
"fixed" : "6.0.3"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-20862"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/spring-projects/spring-security"
}, {
"type" : "WEB",
"url" : "https://security.netapp.com/advisory/ntap-20230526-0002"
}, {
"type" : "WEB",
"url" : "https://spring.io/security/cve-2023-20862"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-459" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-05-05T22:58:08Z",
"nvd_published_at" : "2023-04-19T20:15:10Z"
}
}