CVE-2021-22112: Privilege Escalation in Spring Security
Summary
CVE-2021-22112: Privilege escalation in spring security. Affects org.springframework.security:spring-security-bom across 3 version ranges.
< 5.2.9
>= 5.3.0, < 5.3.8
>= 5.4.0, < 5.4.4
Fixed in 5.2.9, 5.3.8 or 5.4.4, depending on the release line you run. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Spring Security is a powerful and widely used framework for securing Java applications. It provides comprehensive authentication and authorization mechanisms to protect sensitive resources. However, versions 5.4.x prior to 5.4.4, 5.3.x prior to 5.3.8.RELEASE, 5.2.x prior to 5.2.9.RELEASE, and older unsupported versions of Spring Security are vulnerable to a privilege escalation issue.
Vulnerability Detail
The vulnerability arises when the SecurityContext in Spring Security fails to save changes if it is modified more than once in a single request. While a malicious user cannot trigger this bug directly, if the application allows users to run with elevated privileges in a limited portion of the application, this bug can be exploited to extend those privileges to the rest of the application. This can lead to unauthorized access, data breaches, and other security compromises.
How To Fix
Fixed versions by release line
The minimum fixed version depends on the release line you run.
-
< 5.2.95.2.9 -
>= 5.3.0, < 5.3.85.3.8 -
>= 5.4.0, < 5.4.45.4.4
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
There is no specific workaround provided for this vulnerability. It is essential to apply the recommended fix by upgrading to the patched versions of Spring Security.
Conclusion
The privilege escalation vulnerability in Spring Security can lead to unauthorized access and compromise the security of your application. It is crucial to upgrade to the latest patched versions of Spring Security to mitigate this risk. Regularly updating your dependencies and staying vigilant about security vulnerabilities is essential to ensure the ongoing security of your application.
See every vulnerability recorded for org.springframework.security:spring-security-bom →
FAQ
You can use Vulert Playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Vulert Playground allows you to analyze your pom.xml file and provides real-time alerts for open-source vulnerabilities in your software.
No, this vulnerability cannot be exploited remotely. It requires a malicious user to have access to the application and the ability to modify the SecurityContext.
The CVSS score for this vulnerability is 8.8, indicating a high severity level.
There are no known instances of this vulnerability being exploited in the wild at the time of this report. However, it is crucial to apply the recommended fix to mitigate any potential risks.
For further support and assistance in vulnerability remediation, you can reach out to info@devnack.com. Our team of experts will be happy to assist you.