Babyk ransomware attacks seen in VMware ESXi environments target virtual machine files and break VM boot. The most common picture is this: the VM powers on, but the console shows Operating system not found, No bootable device, or a No Media-style error on the EFI side. Drawing on a real recovery scenario, this article explains the header transplant method in detail, how to read the file structure, and how to safely return the VM to the inventory.
The goal is to restore the boot chain without paying the ransom and without disturbing running production servers. This guide is written for system administrators, hosting teams and cyber incident response (IR) processes.
What Does Babyk Ransomware Do on ESXi?
Babyk (and similar ESXi-focused ransomware) usually leaves these traces:
- Files with the .babyk extension: In particular
.vmdk.babyk, log and helper files get renamed. - Ransom notes such as “How To Restore Your Files.txt” are dropped into the VM folder.
- The large -flat.vmdk data file often stays in the folder, but the beginning of the file (MBR/GPT, EFI System Partition, NTFS boot sector) may be encrypted or corrupted.
- The descriptor (
.vmdk) may have been rewritten with missing or wrong CID and DDB fields.
The critical point is this: the whole disk is not always encrypted. In many cases the first few hundred MB look high-entropy (encrypted/corrupted), while structures deeper in, such as the NTFS MFT (FILE0), may remain intact. So instead of writing the disk off as dead, reading the file structure increases your chances of recovery.
Symptoms: Is This Your Problem?
- The VM powers on but the operating system cannot be found
- With EFI firmware you get “No Media”; with BIOS the boot menu stays empty
- The VM folder is still in the datastore and the
-flat.vmdkis large - The folder contains
.babykfiles and a ransom note - Previously recovered
*_restoredcopies may still be sitting in the datastore
Safety Rules Before Recovery
- Do not shut down the working restored VM. In particular, do not power off or write to the sibling copy that is running in production.
- Take a backup first. Copy at least the first 1 GB of the target
-flat.vmdkto a separate file. - Never connect two VMs with the same UUID and IP to the network together. After a clone/transplant, Windows may bring the same static IP along.
- Do not pay the ransom. The method in this article focuses on boot repair without payment.
Diagnosis: Looking at the File Structure
Inspect the target folder over ESXi SSH:
ls -lah /vmfs/volumes/DiskX/ORNEK-VM/
hexdump -C -n 64 /vmfs/volumes/DiskX/ORNEK-VM/ORNEK-VM-flat.vmdk | head
cat /vmfs/volumes/DiskX/ORNEK-VM/ORNEK-VM.vmdk
cat /vmfs/volumes/DiskX/ORNEK-VM/ORNEK-VM.vmdk.babyk
What are we looking for?
- MBR signature: Sector 0 should end with
55 AA. If it does not, the boot area is corrupted/encrypted. - GPT:
EFI PARTmay be visible at LBA 1 (on UEFI disks). - NTFS: The OEM field at the start of the partition should read
NTFS. - MFT: Seeing
FILE0deeper in the disk shows that the data body is partly healthy. - Sibling copy: Is there a working
*_restoredVM with the sameuuid.bios/ the same disk capacity?
The folder name and the displayName in the inventory may be mixed up. For example, the folder may be 185.x.x.75 while the inventory name is a different IP. So do not rely on the folder name alone; look at the uuid.bios and the SCSI disk name inside the VMX.
The Solution: Header Transplant
The essence of the method is this: take the disk header from a healthy, working restored sibling VM and write it over the beginning of the damaged target's -flat.vmdk file. This way:
- The damaged MBR / partition / boot sectors are repaired
- The data body on the target disk is preserved
- The working sibling VM is not shut down
In practice the first 1 GB is usually enough, because in most cases the encryption/corruption is concentrated in roughly the first ~500 MB.
Step-by-Step Procedure
1) Take a temporary snapshot on the working sibling
Goal: keep the sibling VM running, send writes to the delta, and make the base disk readable.
vim-cmd vmsvc/snapshot.create <VMID> "hdr_src" "temp header source" 0 0
vim-cmd vmsvc/snapshot.get <VMID>
Important: After the snapshot, -000001.vmdk and the open -flat.vmdk are often locked (Device or resource busy / Failed to lock the file). Use the parent/base .vmdk descriptor for the clone.
2) Take a thin clone from the base disk
mkdir -p /vmfs/volumes/DiskY/tmp_hdr
vmkfstools -i '/vmfs/volumes/DiskX/RESTORED/ORNEK.vmdk' \
'/vmfs/volumes/DiskY/tmp_hdr/base.vmdk' -d thin
With thin provisioning this operation can finish relatively quickly. Once the clone is done, base-flat.vmdk is used as the header source.
3) Power off the target VM and back up the header
vim-cmd vmsvc/power.off <HEDEF_VMID>
dd if=/vmfs/volumes/.../HEDEF-flat.vmdk \
of=/vmfs/volumes/.../header_backup_pre.bin \
bs=1M count=1024 conv=fsync
4) Write the healthy header to the target
dd if=/vmfs/volumes/DiskY/tmp_hdr/base-flat.vmdk \
of=/vmfs/volumes/.../HEDEF-flat.vmdk \
bs=1M count=1024 conv=notrunc,fsync
conv=notrunc is critical: it changes only the beginning and does not wipe the rest of the flat file.
5) Fix the VMDK descriptor
After Babyk, the descriptor may be left incomplete. Using the working sibling's DDB fields as a reference, fill in the following:
CID/ddb.longContentIDddb.uuid, geometry,ddb.thinProvisionedddb.adapterType→ must match the VMX (in most scenarioslsilogic)- The extent line must point to the correct flat file
6) VMX and inventory settings
- Set
displayNameto the name you want (e.g. the name shown in the inventory) - Give it a new
uuid.bios(so it does not collide with the sibling) - Give it a new MAC (
ethernet0.addressType = static) - Align the firmware with the sibling VM. In this case EFI gave “No Media”, while boot succeeded with BIOS.
- Refresh the inventory with
vim-cmd vmsvc/reload <VMID>
vim-cmd vmsvc/getallvms | grep -i SemihTest
7) Cleanup: snapshot and temporary clone
vim-cmd vmsvc/snapshot.remove <KARDEŞ_VMID> <SNAPSHOT_ID>
# gerekirse:
vim-cmd vmsvc/snapshot.removeall <KARDEŞ_VMID>
rm -rf /vmfs/volumes/DiskY/tmp_hdr
Verify the sibling VM's power state, tools and IP status. The goal is not to break it.
8) Power on the target and verify
vim-cmd vmsvc/power.on <HEDEF_VMID>
vim-cmd vmsvc/get.guest <HEDEF_VMID>
Signs of success:
guestState = running- VMware Tools is running
- The guest OS name is displayed (e.g. Windows Server 2022)
The IP Conflict Trap
A header / disk clone can also carry the Windows guest's network settings along. The result: the recovered VM and the restored sibling try to use the same IPv4 address. In this case:
- Immediately disconnect the NIC on the recovered VM:
vim-cmd vmsvc/device.connection <HEDEF_VMID> 4000 disconnect
- Change the IP from the console
- Then reconnect the NIC
It is also safe to leave ethernet0.startConnected = "FALSE" in the VMX so that it does not connect automatically on the next boot.
Choosing Firmware: EFI or BIOS?
| Situation | Recommendation |
|---|---|
| Sibling VM is EFI + healthy ESP | Try EFI |
| EFI “No Media” / no boot entry | Switch to BIOS and try again |
| MBR signature present, no GPT | BIOS is more likely |
| Secure Boot is on and the signature does not match | Temporarily turn Secure Boot off |
Why Does This Method Work?
A common pattern in Babyk's ESXi variant is to corrupt not the entire large flat disk but specifically its initial blocks. When the boot loader chain (MBR/VBR/ESP) is broken, the hypervisor opens the disk but the guest operating system cannot load. Header transplant:
- Brings the boot chain back from a healthy copy
- Keeps using the healthy MFT/body in the data area
- Lets you make progress without shutting down the running production copy
Of course, not every attack is the same. If the disk body is also fully encrypted, this method is not enough; in that case you need a clean backup, a storage snapshot, or offline decrypt/restore scenarios.
Checklist (Cheat Sheet)
- Are there
.babykfiles + a ransom note in the target folder? - Does the start of the flat file show
55 AA? - Is there a
FILE0/ NTFS trace deeper in the disk? - Is there a working restored sibling with the same UUID/size?
- Snapshot on the sibling → base
vmkfstools -iclone - Target off → 1 GB header backup → 1 GB transplant
- Descriptor + VMX (name, UUID, MAC, firmware)
- Snapshot/temp cleanup
- Power on → verify Tools/OS
- If there is an IP conflict, disconnect the NIC
Common Mistakes
- Trying dd on a locked flat file: You will get a busy error; use the snapshot + base clone route first.
- Getting stuck trying to clone
-000001.vmdk: It is usually locked; try the parent descriptor. - Copying the UUID/MAC: Causes conflicts in the inventory and on the network.
- Leaving the descriptor half-fixed: The disk opens but may remain unstable with geometry/CID errors.
- Powering off the restored sibling: Unnecessary risk. It is not needed in this method.
Frequently Asked Questions
What is Babyk?
It is a ransomware family that targets ESXi and virtual machine files. It reveals itself through its file extension and ransom note. The aim is to halt operations by cutting off backups and access, and then collect a ransom.
Can a header transplant cause data loss?
When done correctly (conv=notrunc and a limited count), only the start of the disk changes. Even so, a 1 GB header backup before the operation is mandatory.
What if there is no restored VM?
This method needs a healthy sibling/backup header. If there is none, you move on to storage snapshots, external backups, or offline repair (Windows recovery / BCD / registry) scenarios.
Is it enough to just rename the .vmdk.babyk file back?
Sometimes restoring the descriptor is enough. But if the start of the flat file is encrypted, renaming alone will not bring back boot; header repair is required.
Is this procedure legal?
On systems you manage or are authorized for, it falls under disaster recovery. Interfering with someone else's systems without permission is against the law.
Conclusion
After Babyk on ESXi, the “operating system not found” error often does not mean the disk body is completely gone. Reading the file structure and performing a header transplant from a working restored copy, together with the right snapshot/clone technique, descriptor correction and UUID/MAC isolation, is an effective recovery path.
The flow in this article is based on steps verified in a real incident response: a clone was taken without disturbing the sibling VM, the target's boot area was repaired, it was added to the inventory under a new name, and the IP conflict was kept under control by disconnecting the NIC.
If you face a similar case, do not break the order: backup first, then diagnosis, and writing last. In a recovery, the most valuable thing is not speed but taking steps that you can reverse.
Need Support?
If you need help with ESXi / Babyk / VM boot problems, you can contact me directly:
- Email: [email protected]
- Phone: 0541 646 16 16
If possible, include in your message the ESXi version, the error screen (Operating system not found / No Media, etc.), the file list in the datastore folder, and whether the VM is powered off; it speeds up the diagnosis.