Exploiting Vulnerbilities in ESXi - Preauth RCE and Sandbox Escape.
Exploiting Vulnerbilities in ESXi - Preauth RCE and Sandbox Escape.
ESXi
preauth RCE & Sandbox escape
WeiHua Huang
Dr. Zhiniang Peng of Sangfor
Whoami
• Zhiniang Peng
• the Principal Security Researcher & Chief Architect at Sangfor
• PhD in Cryptography, interested in all areas of CS
• Started hacking when at the age of 13
• Work in Defensive & Offensive security
• Published many research in both Industry & Academia
• https://sites.google.com/site/zhiniangpeng
• Twitter: @edwardzpeng
Whoami
• Weihua Huang
• Researching in windows kernel.
• Researching in virtualization.
• Interested in exploitation and detection.
Agenda
• Introduction
• Root cause analysis
• Exploitation
• Post-exploitation
• Conclusion
Introduction
ESXi & vCenter
SLP
Sandbox
ESXi
• VMware ESXi, also called VMware ESXi Server, is a bare-metal
hypervisor developed by VMware for vSphere.
• ESXi is one of the primary components in the VMware infrastructure
software suite.
• It’s the industry leader for efficient architecture, setting the
standard for reliability, performance, and support.
• Virtual machine is running on ESXi.
vCenter
• vCenter Server is the service through which you manage multiple
hosts connected in a network and pool host resources.
SLP
• Introduction to SLP service
• ESXiArgs: Ransomware attack in realworld
• The reason for exploiting SLP service
• SLP in ESXi
SLP service
• It is a service discovery protocol that allows computers and other
devices to find services in a local area network (LAN) without prior
configuration.
• SLP has been designed to scale from small, unmanaged networks to
large enterprise networks.
Ransomware attacks
• In February 2023, the “ESXiArgs” ransomware attacks appear to be
targeting unpatched and unprotected instances of VMware ESXi.
• Vulnerabilities of SLP service were used.
• According to information released by CISA, ESXiArgs actors have
compromised over 3,800 servers globally.
Ransomware attacks
• From this attack:
1. Many ESXi are not patched.
2. The SLP vulns is very useful.
3. From 2021 to 2023, nearly two years, these critical vulns have
been available to exploit all the time.
• When will it keep available until in intranet?
Why exploit SLP service
• Target:
• The most valuable target is vCenter.
• Take down vCenter means the whole cluster is taken down.
• Condition:
• vCenter is easier to take down vCenter than ESXi.
• More published RCE vulns.
• But vCenter is usually inaccessible in pentest.
• Runs in another network segment.
• But vCenter is accessible from ESXi.
• → Need to RCE ESXi
• → Exploit SLP!
SLP in ESXi
After the patch of CVE-2020-3992 and CVE-2021-21974, SLP service is only accessible from local( 127.0.0.1(ipv4) or
::1(ipv6)).
So CVE-2022-31699 is not used to RCE, but can be used to escape sandbox before ESXi 7.0u2, especially in ESXi 6.7.
From 7.0u2, SLP service runs inside sandbox.
From 7.0u2c, SLP service is disabled by default.
CVE-2019-5544(heap buffer overflow)
• Client send SLPSrvRqst to get service’s information.
• Slpd will use ProcessSrvRqst(…) to handle and reply request.
• But…
typedef struct _SLPSrvRqst
{
int prlistlen;
const char *prlist;
int srvtypelen;
const char *srvtype;
int scopelistlen;
const char *scopelist;
int predicatever;
int predicatelen;
const char *predicate;
int spistrlen;
const char *spistr;
} SLPSrvRqst;
CVE-2019-5544(heap buffer overflow)
Realloc sendbuf with size of url and langtag
• But:
• Not full exploitation.
• no detail about how to leak libc.
• Only general ideas for exploiting CVE-2021-21974
• Here:
• Share a more practical memory layout for leaking.
• Also Share the exploitation of CVE-2020-3992.
• Talk about the problem and solution in pentest.
Exploitation
If os of virtual machine is windows, the position can be the physical memory of function MsvpPasswordValidate in
Ntlmshared.dll loaded into lsass.exe, and the shellcode can be:“xor eax, eax; inc eax; ret;”
Patch login function
• If os of virtual machine is windows:
Position:
Ntlmshared.dll!MsvpPasswordValidate in lsass.exe.
• Network Operation:
• DVfilter
Attacker
Hack into a VM
Run in ESXi
Exploit SLP service to
RCE ESXi
Pentest to vm
Run in ESXi
• Make sure that your ESXi/vCenter is safe from nday, especially the
SLP vulns.
• Disable SLP service or upgrade ESXi.