Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1359 CNY

100%

CVE-2022-22978 PoC — VMware Spring Security 授权问题漏洞

Source
Associated Vulnerability
Title: VMware Spring Security 授权问题漏洞 (CVE-2022-22978)
Description:In spring security versions prior to 5.4.11+, 5.5.7+ , 5.6.4+ and older unsupported versions, RegexRequestMatcher can easily be misconfigured to be bypassed on some servlet containers. Applications using RegexRequestMatcher with `.` in the regular expression are possibly vulnerable to an authorization bypass.
Description
CVE-2022-22978漏洞实例代码
Readme
# CVE-2022-22978-demo
CVE-2022-22978漏洞示例代码

# 利用条件
虽然定为高危,但是利用条件还是比较苛刻的,个人感觉这个漏洞比较鸡肋。
1. 首先肯定是spring-security在漏洞影响范围内
2. 其次需要使用spring-security的正则匹配器regexMatchers或者直接使用RegexRequestMatcher,并且使用了`.` 匹配路径,类似这样: 
   - regexMatcher("/api/.*") // 允许/api下的所有子路径
   - regexMatcher("/files/.*\\.jpg") // 匹配所有.jpg结尾的文件请求
   - regexMatcher("/user/.*/profile") // 允许/user下任意用户名的profile路径
4. 实际上这种情况很少见,比如regexMatcher("/api/.*"),有这样的路径,那么还需要一个有类似@RequestMapping("/api/\*")注解的controller,用户处理/api下的所有路径的请求。否则即使用`%0a%0d`绕过了spring-security的路径匹配规则,但是却会报404错误。

# 利用演示
正常访问所有路径,都会跳转到spring-security提供的默认登录页面。
![image](https://github.com/wan9xx/CVE-2022-22978-demo/assets/65795483/7fe9c086-8a99-4810-970f-5aa75d5b18e9)


访问:http://127.0.0.1:8080/admin/admin%0a,成功绕过登录
![image](https://github.com/wan9xx/CVE-2022-22978-demo/assets/65795483/6d30b535-cbe8-440e-bde8-690863e6ac65)

访问:http://127.0.0.1:8080/hello%0a
绕过了所有路径都需要登录的安全检测,但是由于没有@RequestMapping("/hello/\*")注解的控制器,导致映射失败,报404错误
![image](https://github.com/wan9xx/CVE-2022-22978-demo/assets/65795483/54d67828-4261-4922-a469-e6772eb03128)

   
File Snapshot

Log in to view the POC file snapshot cached by Shenlong Bot

Log in to view
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →