Recently, we showed how our “blue team” investigates attacks against the VMware ESXi hypervisor and other virtualization systems. Now, let’s look at virtual machines from the practical experience perspective of our “red team”.
Once, during an internal pentest, we encountered network access restrictions: the services we needed were unavailable due to segmentation. We already had domain administrator privileges and were proxying traffic through a domain controller into the internal network.
To proceed further, we decided to look for VMware ESXi virtualization servers: we were searching for an open TCP port 902, which is used by VMware components for infrastructure management and access to virtual machine consoles.
We discovered several ESXi hosts, and on one of them we managed to authenticate as root using a simple password. On ESXi, OS accounts are used to access the web interface, so we could connect via SSH and access virtual machine consoles in the browser. After connecting to the ESXi host, we viewed the list of virtual machines and among them found a VM which had vcenter in its name.
We opened its console and saw an active command prompt with root privileges. It seemed that we had gained access to the vCenter OS, all that remained was to connect via SSH and authenticate to the web interface. However, upon inspecting the system, we noticed some anomalies:
— typical VCSA executables and libraries were missing;
— expected vCenter components and services were not found;
— the hostname ended with -esxi01, which is more typical of a hypervisor than a virtualization management server.
We copied the /etc/shadow file to a datastore (datastores are mounted at /vmfs/volumes/), downloaded it via the Datastore Browser in the web interface, and cracked the root password. It turned out that the password matched the one previously used to log into ESXi.
Here we realized that the open VM console did not show the local vCenter shell, but rather an SSH session established from the VCSA to the ESXi host. Someone from the administration team had connected to the hypervisor from the vCenter console and left the SSH session open.
From there, it was enough to run:
exitThe command terminated the SSH session and brought us directly back to the VCSA, also with root privileges. Thus, access to the vCenter OS was obtained without knowing its password and without exploiting any vulnerabilities in vCenter itself.
From root on VCSA to the web interface
It is important to understand that the VCSA OS root account and the web interface administrator are different accounts. The former is used for OS administration, the latter — for managing infrastructure through vCenter Single Sign-On (SSO).
Having access to the VCSA shell does not automatically grant authorization in vSphere Client. However, using a Python script, we managed to obtain credentials in plaintext, after which we successfully authenticated to the vCenter web interface. The compromised vCenter managed the infrastructure of multiple data centers.
Key takeaway
This case required neither 0-days nor serious exploitation of some vulnerabilities. Compromising a single ESXi host can serve as the starting point for taking over the entire virtualization infrastructure. Especially if it hosts a vCenter that manages multiple clusters and data centers.

