Hacktricks-skills vmware-esx-vcenter-security-audit
Security audit and hardening guidance for VMware ESX/vCenter infrastructure. Use this skill when users need to assess VMware virtualization security, understand attack vectors for defensive purposes, enumerate ESXi hosts for authorized penetration testing, identify ransomware indicators in virtual environments, or harden vSphere deployments. Trigger on mentions of VMware, ESXi, vCenter, virtualization security, hypervisor auditing, or ESX pentesting.
git clone https://github.com/abelrguezr/hacktricks-skills
skills/network-services-pentesting/pentesting-web/vmware-esx-vcenter.../SKILL.MDVMware ESX/vCenter Security Audit
A skill for security professionals to audit, harden, and defend VMware ESX/vCenter infrastructure. This skill provides guidance on understanding attack vectors, identifying indicators of compromise, and implementing defensive controls.
⚠️ Authorization Required
All activities described in this skill require explicit written authorization. Use only on systems you own or have permission to test.
Enumeration & Discovery
Network Scanning
Identify VMware services and versions:
# Nmap service detection with VMware-specific scripts nmap -sV --script "http-vmware-path-vuln or vmware-version" -p <PORT> <IP> # Common VMware ports to scan # 443 - vSphere Client (HTTPS) # 902 - vSphere Agent # 22 - SSH (if enabled) # 902-903 - vSphere services
Metasploit Enumeration
# ESXi fingerprinting msfconsole use auxiliary/scanner/vmware/esx_fingerprint set RHOSTS <target> run # Check for MS15-034 HTTP.sys vulnerability use auxiliary/scanner/http/ms15_034_http_sys_memory_dump set RHOSTS <target> run
Credential Testing (Authorized Only)
# Test for weak credentials on VMware HTTP interface use auxiliary/scanner/vmware/vmware_http_login set RHOSTS <target> set RPORT 443 set USERNAME <username> set PASSWORD <password> run
Post-Exploitation Indicators
Hypervisor Takeover Signs
Monitor for these commands in ESXi logs:
| Command | Purpose | Detection Priority |
|---|---|---|
| Host fingerprinting | Medium |
| Network adapter enumeration | High |
| Firewall disablement | Critical |
| vCenter isolation | Critical |
| Credential rotation | Critical |
C2 Beacon Detection
Look for persistent processes polling external URIs:
# Check for suspicious network connections netstat -anp | grep ESTABLISHED # Look for unusual cron jobs cat /var/spool/cron/crontabs/* # Check for unknown processes ps -ef | grep -v "init\|vpxa\|hostd"
Ransomware Indicators
File Extensions Targeted
| Extension | Description | Risk Level |
|---|---|---|
, , , , | VM disks, snapshots, swap | Critical |
, | VM appliance bundles | High |
| ESXi installation bundles | High |
, | Veeam backup files | Critical |
, , | Encrypted files | Critical |
Detection Queries
# Find recently modified VM files find /vmfs/volumes -name "*.vmdk" -mtime -1 # Look for ransom notes find / -name "*Restore*" -o -name "*ransom*" -o -name "*How To*" 2>/dev/null # Check for encrypted file extensions find /vmfs/volumes -name "*.emario" -o -name "*.mario" 2>/dev/null
Hardening Recommendations
Network Security
- Segment management traffic - Isolate vCenter and ESXi management interfaces
- Disable unnecessary services - Turn off SSH, DCUI if not needed
- Implement network ACLs - Restrict access to management ports (443, 902, 22)
- Enable TLS 1.2+ - Disable older SSL/TLS versions
Access Control
- Strong authentication - Use MFA for vCenter access
- Principle of least privilege - Create role-based access controls
- Regular credential rotation - Change default passwords immediately
- Audit logging - Enable and monitor vCenter logs
Host Hardening
# Disable unnecessary services esxcli system settings advanced set -o /UserVars/ESXShellEnabled -i 0 # Enable lockdown mode esxcli system lockdown set -e true # Configure firewall rules esxcli network firewall ruleset set -e true -r sshServer
Backup Protection
- 3-2-1 backup rule - 3 copies, 2 media types, 1 offsite
- Immutable backups - Use write-once-read-many (WORM) storage
- Air-gapped recovery - Maintain offline backup copies
- Regular restore testing - Validate backup integrity monthly
Incident Response
Immediate Actions
- Isolate affected hosts - Disconnect from network
- Preserve evidence - Capture memory, logs, disk images
- Identify scope - Check all ESXi hosts and vCenter
- Notify stakeholders - Follow incident response procedures
Recovery Steps
- Clean rebuild - Reinstall ESXi from trusted media
- Restore from clean backups - Verify backup integrity first
- Patch vulnerabilities - Apply latest security updates
- Rotate all credentials - Change all passwords and certificates
- Monitor for persistence - Watch for re-infection indicators
References
- Unit 42 – RansomHouse Encryption Analysis
- VMware Security Hardening Guide
- CWE-426: Untrusted Search Path
Quick Reference
Common VMware Ports
| Port | Service | Protocol |
|---|---|---|
| 22 | SSH | TCP |
| 443 | vSphere Client | TCP |
| 902 | vSphere Agent | TCP |
| 903 | vSphere Agent | TCP |
| 902-903 | vSphere Services | TCP |
Critical Files to Monitor
- System logs/var/log/
- VMware-specific logs/var/log/vmware/
- Configuration files/etc/vmware/
- VM datastores/vmfs/volumes/
- VMware state files/var/lib/vmware/