VMware vCenter Server CVE-2021-21972远程代码执行漏洞

admin 2021年3月5日03:08:32评论165 views字数 3604阅读12分0秒阅读模式
2021年2月23日,VMware发布了一份公告(VMSA-2021-0002),公布了影响VMware ESXi、VMware vCenterServer和VMware Cloud Foundation的三个威胁。
vSphere Client(HTML5)受影响的版本:
  • 7.0 U1c 之前的 7.0 版本

  • 6.7 U3l 之前的 6.7 版本

  • 6.5 U3n 之前的 6.5 版本

VMware Cloud Foundation受影响的版本:
  • 4.2之前的4.x版本 

  • 3.10.1.2 之前的3.x版本

漏洞详细信息和建议
CVE-2021-21972
vSphere Client(HTML5)存在一个远程执行代码漏洞CVE-2021-21972(CVSSv3评分9.8),任何未授权的攻击者都可以通过访问开放的443端口,向服务器发送构造的恶意请求,从而写入webshell,最终造成远程任意代码执行。
PT Swarm(https://swarm.ptsecurity.com/unauth-rce-vmware/) 详细介绍了这一弱点以及如何利用它:
在分析 vSphere Client时,像往常一样使用黑盒和白盒方法进行测试。从 Web 面板中,尝试发送尽可能多的不同请求,但这些请求都没有 Cookie信息。
发送未经授权的请求后,发现它实际上不需要任何身份验证。于是准备对代码进行分析。
首先,Web 应用程序是依赖于插件(通常位于单独的.jar文件中)来实现其某些功能。例如:
Vropspluginui插件对应文件vropsplugin-service.jar。每个插件必须指定哪些端点需要在 Web 面板中授权才能运行,哪些不需要。此插件被配置为允许未经授权的用户访问它处理的任何 URL。
通过分析代码,找到了一个vCenter Server的vROPS插件的代码,存在敏感接口。其中 uploadova 接口存在一个上传 OVA 文件的功能:
@RequestMapping(      value = {"/uploadova"},      method = {RequestMethod.POST}   )   public void uploadOvaFile(@RequestParam(value = "uploadFile",required = true) CommonsMultipartFile uploadFile, HttpServletResponse response) throws Exception {      logger.info("Entering uploadOvaFile api");      int code = uploadFile.isEmpty() ? 400 : 200;      PrintWriter wr = null;      try {         if (code != 200) {            response.sendError(code, "Arguments Missing");            return;         }         wr = response.getWriter();      } catch (IOException var14) {         var14.printStackTrace();         logger.info("upload Ova Controller Ended With Error");      }      response.setStatus(code);      String returnStatus = "SUCCESS";      if (!uploadFile.isEmpty()) {         try {            logger.info("Downloading OVA file has been started");            logger.info("Size of the file received  : " + uploadFile.getSize());            InputStream inputStream = uploadFile.getInputStream();            File dir = new File("/tmp/unicorn_ova_dir");            if (!dir.exists()) {               dir.mkdirs();            } else {               String[] entries = dir.list();               String[] var9 = entries;               int var10 = entries.length;               for(int var11 = 0; var11 < var10; ++var11) {                  String entry = var9[var11];                  File currentFile = new File(dir.getPath(), entry);                  currentFile.delete();               }               logger.info("Successfully cleaned : /tmp/unicorn_ova_dir");            }            TarArchiveInputStream in = new TarArchiveInputStream(inputStream);            TarArchiveEntry entry = in.getNextTarEntry();            ArrayList result = new ArrayList();            while(entry != null) {               if (entry.isDirectory()) {                  entry = in.getNextTarEntry();               } else {                  File curfile = new File("/tmp/unicorn_ova_dir", entry.getName());                  File parent = curfile.getParentFile();                  if (!parent.exists()) {                     parent.mkdirs();                  }                  OutputStream out = new FileOutputStream(curfile);                  IOUtils.copy(in, out);                  out.close();                  result.add(entry.getName());                  entry = in.getNextTarEntry();               }            }            in.close();            logger.info("Successfully deployed File at Location :/tmp/unicorn_ova_dir");         } catch (Exception var15) {            logger.error("Unable to upload OVA file :" + var15);            returnStatus = "FAILED";         }      }      wr.write(returnStatus);      wr.flush();      wr.close();   }
因为没有对.tar名称进行过滤,它们只是与字符串"/tmp/unicorn_ova_dir"连在一起,然后在生成的位置创建文件。所以我们直接将TAR文件与 /tmp/unicorn_ova_dir 拼接并写入文件。如果文件名内存在“../” 即可实现目录遍历。如上述代码:
Rapid7的研究人员已经独立分析,测试,并确认了这一漏洞的可利用性,并提供了完整的技术分析。(https://attackerkb.com/topics/lrfxAJ9nhV/vmware-vsphere-client-unauth-remote-code-execution-vulnerability-cve-2021-21972?referrer=blog#rapid7-analysis
鉴于漏洞的严重性以及网络基础设施可能会被遭到恶意破坏,组织最好考虑紧急修补程序。如果您无法立即更新到软件的新固定版本,您可以通过以下 VMware 官方的指示在此处禁用 vROP 插件:https://kb.vmware.com/s/article/82374
CVE-2021-21973
CVE-2021-21973是 VMware ESXi OpenSLP 中一个重要的(CVSSv3 基础 8.8)基于堆溢的远程代码执行漏洞。在受影响的系统上访问端口 427 的同一段网络访问权限的攻击者可能能够使用堆溢式弱点执行远程代码执行。
VMware已为临时缓解提供了步骤(https://kb.vmware.com/s/article/76372),其中包括在受影响的系统上禁用 SLP 服务。
CVE-2021-21974

CVE-2021-21974是影响 HTML5 vSphere 客户端的中度(CVSSv3 基础 5.3)服务器端请求伪造漏洞。访问受影响系统的端口 443 的攻击者可以利用此弱点访问基础系统信息。

VMware已为临时缓解提供了步骤(https://kb.vmware.com/s/article/82374),其中包括禁用插件。

Rapid7实验室尚未检测到来自互联网的VMware vCenter服务器的无差别扫描,但Bad Packets(https://twitter.com/bad_packets/status/1364661586070102016?s=20)已检测到了恶意事件。我们将持续关注这个事件,并更新此文章!


本文始发于微信公众号(Rapid7):VMware vCenter Server CVE-2021-21972远程代码执行漏洞

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年3月5日03:08:32
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   VMware vCenter Server CVE-2021-21972远程代码执行漏洞http://cn-sec.com/archives/281508.html

发表评论

匿名网友 填写信息