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 - 5.4.3
  • 5.3.0.RELEASE - 5.3.8.RELEASE
  • 5.2.0.RELEASE - 5.2.8.RELEASE

Mitigation

Users of affected versions should upgrade to the corresponding fixed version.
Fix versionAvailability
5.4.4OSS
5.3.9.RELEASEOSS
5.2.9.RELEASEOSS

No further mitigation steps are necessary.

Credit

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

History

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

Get ahead

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

Learn more

Get support

Tanzu Spring 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