暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

【漏洞预警】Vmware 多个严重漏洞预警&复现

燕云实验室 2021-06-28
3452



“燕云实验室”是河北千诚电子科技有限公司成立的网络安全攻防技术研究实验室。专注于web安全,网络攻防,安全运维,应急溯源方面的研究,开发成果应用于产品核心技术转化,国家重点科技项目攻关。





一、漏洞概述


近日围绕Vmware系列产品爆发了多个漏洞包括:

CVE-2021-21972:VMware vCenter Server 未授权任意文件上传,攻击者可直接通过443端口构造恶意请求,上传恶意文件执行任意代码,控制vCenter。

CVE-2021-21973:VMware vCenter Server SSRF漏洞 中,攻击者可通过443端口发送恶意POST请求,发起内网扫描,造成SSRF漏洞。

CVE-2021-21974:ESXi中使用的OpenSLP存在堆溢出漏洞,CVSSv3评分8.8。与ESXi处于同一网段中且可以访问427端口的攻击者可触发OpenSLP服务中的堆溢出问题,从而导致远程执行代码。


其中CVE-2021-21972基本上在安全圈上了热搜,这里主要探讨CVE-2021-21972




二、漏洞影响

vCenter Server 7.0 < 7.0 U1c

vCenter Server 6.7 < 6.7 U3l

vCenter Server 6.5 < 6.5 U3n




三、漏洞复现

漏洞位置位于/ui/vropspluginui/rest/services/uploadova,该漏洞也是在未授权的情况下调用可调用上传接口,从而上传任意文件


只要构造可用的tar包进行上传即可


这里构造tar包需要设定上传后文件部署的绝对路径,否则即使上传成功也无法访问jsp文件,


构建tar包需要用到evilarc:https://github.com/ptoomey3/evilarc


这里不同系统的目录结构不同

linux:

    ../../usr/lib/vmware-vsphere-ui/server/work/deployer/s/global/42/0/h5ngc.war/resources/

    windows:

      ../../ProgramData/VMware/vCenterServer/data/perfcharts/tc-instance/webapps/statsreport/

      构建tar包,详细参数参考evilarc


      接下来只要向漏洞接口post构建的tar包即可



      返回SUCCESS即为成功


      也可以创建一个webshell,这里是冰蝎的马儿



      这里有https://github.com/QmF0c3UK/CVE-2021-21972-vCenter-6.5-7.0-RCE-POC的批量扫描python,该文件仅判断有无/ui/vropspluginui/rest/services/uploadova可用,并未测试上传:

      其print看着别扭魔改了一哈:

        #-*- coding:utf-8 -*-
        banner = """
        888888ba dP
        88 `8b 88
        a88aaaa8P' .d8888b. d8888P .d8888b. dP dP
        88 `8b. 88' `88 88 Y8ooooo. 88 88
        88 .88 88. .88 88 88 88. .88
        88888888P `88888P8 dP `88888P' `88888P'
        ooooooooooooooooooooooooooooooooooooooooooooooooooooo
        @time:2021/02/24 CVE-2021-21972.py
        C0de by NebulabdSec - @batsu
        """
        print(banner)


        import threadpool
        import random
        import requests
        import argparse
        import http.client
        import urllib3


        urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
        http.client.HTTPConnection._http_vsn = 10
        http.client.HTTPConnection._http_vsn_str = 'HTTP/1.0'


        TARGET_URI = "/ui/vropspluginui/rest/services/uploadova"


        def get_ua():
        first_num = random.randint(55, 62)
        third_num = random.randint(0, 3200)
        fourth_num = random.randint(0, 140)
        os_type = [
        '(Windows NT 6.1; WOW64)', '(Windows NT 10.0; WOW64)', '(X11; Linux x86_64)',
        '(Macintosh; Intel Mac OS X 10_12_6)'
        ]
        chrome_version = 'Chrome/{}.0.{}.{}'.format(first_num, third_num, fourth_num)


        ua = ' '.join(['Mozilla/5.0', random.choice(os_type), 'AppleWebKit/537.36',
        '(KHTML, like Gecko)', chrome_version, 'Safari/537.36']
        )
        return ua


        def CVE_2021_21972(url):
        proxies = {"scoks5": "http://127.0.0.1:1081"}
        headers = {
        'User-Agent': get_ua(),
        "Content-Type": "application/x-www-form-urlencoded"
        }
        targetUrl = url + TARGET_URI
        try:
        res = requests.get(targetUrl,
        headers=headers,
        timeout=15,
        verify=False,
        proxies=proxies)
        # proxies={'socks5': 'http://127.0.0.1:1081'})
        # print(len(res.text))
        if res.status_code == 405:
        print("[+] URL:{} is CVE-2021-21972 vuln".format(url))
        # print("[+] Command success result: " + res.text + "\n")
        with open("存在漏洞地址.txt", 'a') as fw:
        fw.write(url + '\n')
        else:
        print("[-] " + url + " not CVE-2021-21972 vuln")
        # except Exception as e:
        # print(e)
        except:
        print("[-] " + url + " Request ERROR.")
        def multithreading(filename, pools=5):
        works = []
        with open(filename, "r") as f:
        for i in f:
        func_params = [i.rstrip("\n")]
        # func_params = [i] + [cmd]
        works.append((func_params, None))
        pool = threadpool.ThreadPool(pools)
        reqs = threadpool.makeRequests(CVE_2021_21972, works)
        [pool.putRequest(req) for req in reqs]
        pool.wait()


        def main():
        parser = argparse.ArgumentParser()
        parser.add_argument("-u",
        "--url",
        help="Target URL; Example:http://ip:port")
        parser.add_argument("-f",
        "--file",
        help="Url File; Example:url.txt")
        # parser.add_argument("-c", "--cmd", help="Commands to be executed; ")
        args = parser.parse_args()
        url = args.url
        # cmd = args.cmd
        file_path = args.file
        if url != None and file_path ==None:
        CVE_2021_21972(url)
        elif url == None and file_path != None:
        multithreading(file_path, 10) # 默认15线程


        if __name__ == "__main__":
        main()


        漏洞poc和exp已经整合入vulmap 0.7中


        或者@NS-Sp4ce师傅的 https://github.com/NS-Sp4ce/CVE-2021-21972




        四、修复建议


        目前官方已在最新版本中修复了该漏洞,请受影响的用户尽快升级版本进行防护,对应产品版本的下载链接及文档如下:
          VMware ESXi 7.0 ESXi70U1c-17325551  https://my.vmware.com/group/vmware/patch  https://docs.vmware.com/en/VMware-vSphere/7.0/rn/vsphere-esxi-70u1c.html
          VMware ESXi 6.7 ESXi670-202102401-SG https://docs.vmware.com/en/VMware-vSphere/6.7/rn/esxi670-202102001.html
          VMware ESXi 6.5 ESXi650-202102101-SG https://docs.vmware.com/en/VMware-vSphere/6.5/rn/esxi650-202102001.html
          VMware vCloud Foundation 4.2 https://docs.vmware.com/en/VMware-Cloud-Foundation/4.2/rn/VMware-Cloud-Foundation-42-Release-Notes.html
          VMware vCloud Foundation 3.10.1.2 https://docs.vmware.com/en/VMware-Cloud-Foundation/3.10.1/rn/VMware-Cloud-Foundation-3101-Release-Notes.html
          vCenter Server 7.0.1 Update 1 https://my.vmware.com/web/vmware/downloads/details?downloadGroup=VC70U1C&productId=974 https://docs.vmware.com/en/VMware-vSphere/7.0/rn/vsphere-vcenter-server-70u1c-release-notes.html
          vCenter Server 6.7 U3l https://my.vmware.com/web/vmware/downloads/details?downloadGroup=VC67U3L&productId=742&rPId=57171 https://docs.vmware.com/en/VMware-vSphere/6.7/rn/vsphere-vcenter-server-67u3l-release-notes.html
          vCenter Server 6.5 U3n https://my.vmware.com/web/vmware/downloads/details?downloadGroup=VC65U3N&productId=614&rPId=60942 https://docs.vmware.com/en/VMware-vSphere/6.5/rn/vsphere-vcenter-server-65u3n-release-notes.html

          END



          声明


          署名:CC BY-NC-SA 3.0 CN

          文中所涉及的技术,思路和工具仅供以安全为目的的学习交流使用,请勿做非法用途否则后果自负。






          文章转载自燕云实验室,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

          评论