All Vulnerability Reports

CVE-2021-22112: Changing SecurityContext More Than Once in Single Request Can Fail to Save




Spring by VMware


Spring Security versions 5.4.0 to 5.4.3, 5.3.0.RELEASE to 5.3.8.RELEASE, 5.2.0.RELEASE to 5.2.8.RELEASE, and older unsupported versions can fail to save the SecurityContext if it is changed more than once in a single request. The SecurityContext can fail to save to the HttpSession if a developer changes the SecurityContext twice in a single request when both of the following conditions are met: First the developer must change the SecurityContext before the HttpResponse is committed and then the HttpResponse must be committed before the SecurityContextPersistenceFilter completes. Then the developer must attempt to change the SecurityContext again before the SecurityContextPersistenceFilter completes. A malicious user cannot cause the bug to happen (it must be programmed in). However, if the application's intent is to only allow the user to run with elevated privileges in a small portion of the application, the bug can be leveraged to extend those privileges to the rest of the application.

Affected VMware Products and Versions

Severity is low unless otherwise noted.

Older unsupported versions are also affected.

  • Spring Security
    • 5.4.0 to 5.4.3
    • 5.3.0.RELEASE to 5.3.8.RELEASE
    • 5.2.0.RELEASE to 5.2.8.RELEASE


Users of affected versions should apply the following mitigation: 5.4.x users should upgrade to 5.4.4, 5.3.x users should upgrade to 5.3.9.RELEASE, 5.2.x users should upgrade to 5.2.9.RELEASE. Older versions should upgrade to a supported branch. There are no other mitigation steps necessary. Releases that have fixed this issue include:

  • Spring Security
    • 5.4.4
    • 5.3.9.RELEASE
    • 5.2.9.RELEASE


This issue was discovered and responsibly reported by Daniel Beck, Jeff Thompson, Jesse Glick, and Wadeck Follonier, CloudBees, Inc.



2021-02-19: Corrected Fixed Versions
2021-02-19: Initial vulnerability report published.