Spring Security Authentication Bypass Vulnerability (CVE-2022-31692) Notice

Spring Security Authentication Bypass Vulnerability (CVE-2022-31692) Notice

November 4, 2022 | Jie Ji

Overview

Recently, NSFOCUS CERT found that the PoC of the Spring Security authentication bypass vulnerability (CVE-2022-31692) was publicly disclosed online. Due to improper authorization flaws, under certain conditions, an unauthenticated remote attacker can use FORWARD or INCLUDE for forwarding, thereby exploiting the vulnerability to bypass the authorization rules and ultimately achieve authentication bypass. At present, the PoC has been made public, and relevant users are requested to take measures to protect it.

Spring Security is a highly customizable security framework. Using Spring IoC/DI and AOP functions, declarative security access control functions are provided for the system.

Reference link:

https://tanzu.vmware.com/security/cve-2022-31692

Scope of Impact

Affected version

  • Spring Security 5.7.x <= 5.7.4
  • Spring Security 5.6.x <= 5.6.8

Unaffected version

  • Spring Security >= 5.7.5
  • Spring Security >= 5.6.9

Troubleshooting

According to the exploit conditions, the following points can be used for troubleshooting:

1. Detect whether the application uses authorizeHttpRequests() or AuthorizationFilter. If it is not used, the vulnerability does not exist.

2. Detect whether the application contains forward/include requests. If not, the vulnerability does not exist.

3. Whether the application configures Spring Security to apply to FORWARD and INCLUDE scheduler types, if not, the vulnerability does not exist.

Details can be found in the official documentation: https://tanzu.vmware.com/security/cve-2022-31692

Mitigation

Official Upgrade

The official security version has been released to fix this vulnerability. It is recommended that affected users upgrade their protection in time: https://github.com/spring-projects/spring-security/releases

Other Measures

1. If users cannot upgrade the system, replace “authorizeHttpRequests().shouldFilterAllDispatcherTypes(true)” with:

authorizeHttpRequests().shouldFilterAllDispatcherTypes(true)

2. Users with version less than 5.7.0 do not have shouldFilterAllDispatcherTypes available, it be achieved by adding ObjectPostProcessor:

authorizeHttpRequests().withObjectPostProcessor(new

 ObjectPostProcessor<AuthorizationFilter>() {

   @Override

    public<O extends AuthorizationFilter> O postProcess(O filter) {

        filter.setObserveOncePerRequest(false);

        filter.setFilterAsyncDispatch(true);

        filter.setFilterErrorDispatch(true);

        return filter;    }});

Statement

This advisory is only used to describe a potential risk. NSFOCUS does not provide any commitment or promise on this advisory. NSFOCUS and the author will not bear any liability for any direct and/or indirect consequences and losses caused by transmitting and/or using this advisory. NSFOCUS reserves all the rights to modify and interpret this advisory. Please include this statement paragraph when reproducing or transferring this advisory. Do not modify this advisory, add/delete any information to/from it, or use this advisory for commercial purposes without permission from NSFOCUS.

About NSFOCUS

NSFOCUS, Inc., a global network and cyber security leader, protects enterprises and carriers from advanced cyber attacks. The company’s Intelligent Hybrid Security strategy utilizes both cloud and on-premises security platforms, built on a foundation of real-time global threat intelligence, to provide multi-layered, unified and dynamic protection against advanced cyber attacks.

NSFOCUS works with Fortune Global 500 companies, including four of the world’s five largest financial institutions, organizations in insurance, retail, healthcare, critical infrastructure industries as well as government agencies. NSFOCUS has technology and channel partners in more than 60 countries, is a member of both the Microsoft Active Protections Program (MAPP), and the Cloud Security Alliance (CSA).

A wholly owned subsidiary of NSFOCUS Technologies Group Co., Ltd., the company has operations in the Americas, Europe, the Middle East and Asia Pacific.