Spring Security Advisories

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

LOW | FEBRUARY 19, 2021 | CVE-2021-22112

Description

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 Spring Products and Versions

  • 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

Mitigation

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

Credit

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

History

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

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring Runtime offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all