You cannot learn offensive or defensive security by reading. You learn it by breaking things you are allowed to break. A home lab is the sandbox where you run Nmap, fire Metasploit modules, crack hashes, poison LLMNR, or watch an EDR light up — without touching a network you do not own. VirtualBox is the fastest, zero-cost way to build one: it runs on Windows, Linux and macOS (Intel), imports ready-made appliances, and scripts cleanly from the command line.
This guide takes you from a bare host to a working, fully isolated lab: install VirtualBox three ways, provision VMs with the GUI, VBoxManage and Vagrant, wire up NAT / host-only / internal networks correctly, then drop in a Kali attacker, Metasploitable 2, DVWA and a Windows victim. Every command is copy-pasteable. The single rule you will hear repeatedly: vulnerable VMs never touch the internet.
◈ Table of Contents
01 — What a Home Lab Is & Why You Need One
Phase 1 / 11A cybersecurity home lab is a set of virtual machines running on your own computer, connected to a private virtual network that has no path to your real home network or the internet. One VM is your attacker (Kali Linux). The others are deliberately vulnerable targets. Because everything is virtual and snapshotted, you can exploit a box, wipe it, and rebuild it in seconds — and because it is isolated, a real attacker scanning the internet can never reach the intentionally broken services you are hosting.
VirtualBox is a Type-2 hypervisor from Oracle: it runs as an application on top of your existing OS rather than on bare metal. That makes it the ideal beginner platform — it is free and open source, installs in minutes on the OS you already use, and (critically for a lab) it can be driven entirely from the command line, so your entire environment becomes reproducible and disposable.
Practice Offense Legally
Run Nmap, Metasploit, Hydra and SQLmap against targets you own. Attacking machines in a network you control, with full permission, is completely legal.
Build Detections
Generate real attack telemetry, then hunt it in Wazuh, Sentinel or Splunk. You cannot write a good detection for an attack you have never seen fire.
Cert & CTF Prep
OSCP, PNPT, eJPT and CTFs all assume you can enumerate and exploit boxes. The lab is where that muscle memory is built — for free.
Break & Restore
Snapshots let you detonate ransomware samples or trash a box, then roll back to a clean state in under a minute. Nothing is permanent.
Everything in this guide is for use on hardware and networks you own. Scanning, exploiting or brute-forcing systems you do not have written authorization to test is a crime in most jurisdictions. Keep it in the lab.
02 — Prerequisites & Requirements
Phase 2 / 11You can start with a single 8 GB laptop, but the experience scales sharply with RAM. Every running VM consumes real memory from the host; the trick is to run only the VMs you need for the exercise in front of you and keep the rest powered off.
| Resource | Minimum | Recommended | Notes |
|---|---|---|---|
| Host RAM | 8 GB MIN | 16–32 GB REC | Kali ~4 GB, each target 1–4 GB. 8 GB = 2 VMs at a time. |
| CPU | Dual-core, VT-x/AMD-V | Quad-core+ with virtualization on | Enable Intel VT-x / AMD-V in BIOS/UEFI or VMs stay 32-bit only. |
| Free disk | 60 GB MIN | 250 GB SSD REC | Dynamically-allocated disks grow as used; snapshots eat space fast. |
| Host OS | Win 10/11, Ubuntu 22.04+, macOS (Intel) | — | Apple Silicon (M1–M4) is not supported for x86 guests; see Phase 5. |
| VirtualBox | 7.0 | 7.1.x (latest) | Install the matching Extension Pack for USB 2/3 and disk encryption. |
| Kali image | Installer ISO or prebuilt VirtualBox VM | Prebuilt VM (fastest) | Download only from kali.org — verify the SHA256. |
Before anything else, reboot into BIOS/UEFI and confirm virtualization is enabled (Intel VT-x / SVM Mode on AMD). On Windows, "Virtualization: Enabled" appears under Task Manager → Performance → CPU. Without it, VirtualBox refuses to boot 64-bit guests.
On Windows, Hyper-V, WSL2, Memory Integrity (Core Isolation) and the Windows Hypervisor Platform all grab the virtualization stack and can cripple VirtualBox performance or force painfully slow software emulation. If your VMs crawl, disable Hyper-V (bcdedit /set hypervisorlaunchtype off) and reboot.
03 — Method 1: Install VirtualBox on the Host
Phase 3 / 11Install the hypervisor first. Pick the section for your host OS. In all cases you install two things: VirtualBox itself, and the Oracle Extension Pack (same version number) which adds USB 2.0/3.0 passthrough, disk encryption and NVMe.
Grab the platform package for your host and the platform-independent Extension Pack. Never download VirtualBox from a mirror or a "download button" ad — only from virtualbox.org.
Run the installer with defaults, or drive it silently from an elevated PowerShell/CMD. The installer briefly drops your network while it inserts the host-only adapter — that is expected.
Add C:\Program Files\Oracle\VirtualBox to your PATH so VBoxManage works from any terminal. Every command in Phase 4 assumes this.
Use Oracle's own repository, not the distro package — the distro version is usually stale and its Extension Pack will mismatch. Add the signing key, add the repo, install, then add yourself to the vboxusers group for USB.
If VMs fail with "Kernel driver not installed (rc=-1908)", the vboxdrv module did not build. Run sudo /sbin/vboxconfig. On Secure-Boot systems you must enroll a MOK key or the unsigned module is blocked — the installer prints the exact steps.
On an Intel Mac, mount the .dmg, run the installer, then approve the Oracle system extension under System Settings → Privacy & Security and reboot. Verify the version from a terminal on any host.
Apple Silicon Macs (M1–M4) run ARM, not x86. The x86 Kali/Metasploitable images in this guide will not run there under VirtualBox. On those machines use UTM/QEMU with ARM images, or run the lab on a separate x86 host — see Phase 5.
04 — Method 2: Reproducible VMs with VBoxManage & Vagrant
Phase 4 / 11Clicking through the GUI is fine for one VM. The moment you want a lab you can tear down and rebuild identically — the equivalent of a Docker Compose file — you script it. VirtualBox ships VBoxManage, a complete CLI; Vagrant layers a declarative file on top so a whole lab comes up with one command.
This builds an empty Kali VM: register it, size CPU/RAM/VRAM, create a dynamically-allocated 60 GB disk, attach a SATA controller plus the installer ISO, and set the boot order. Adjust the ISO path to your download.
Vagrant pulls prebuilt "boxes" and provisions them automatically. The kalilinux/rolling box is published by the Kali team. This brings up a headless Kali in minutes with zero clicking.
This is the VirtualBox answer to a compose file: one text file defines an attacker and a target on the same private network. vagrant up builds both; vagrant destroy -f removes them. Put this in an empty folder as Vagrantfile.
Keep your Vagrantfiles in a git repo. Your entire lab topology becomes version-controlled and shareable — rebuild the exact same environment on a new machine with one git clone and vagrant up.
05 — Method 3: Import Prebuilt Appliances & Nested Alternative
Phase 5 / 11The fastest path for beginners is to skip OS installation entirely and import ready-made appliances. Kali ships an official prebuilt VirtualBox image; Metasploitable and many VulnHub targets are distributed as .ova / .vmdk files you import in one step.
Kali offers a prebuilt VirtualBox VM (7-zip archive) with tools preinstalled. Download it, extract, then import the .vbox or the OVA. This avoids the 20-minute installer entirely.
Metasploitable 2 is Rapid7's intentionally vulnerable Linux VM — the classic first target. It ships as a VMDK inside a zip. Create a VM shell and attach the existing disk rather than creating a new one.
Metasploitable 2 ships with the login msfadmin / msfadmin and dozens of unauthenticated services. It is a live target range in a box — give it an internal or host-only NIC only (Phase 7). Never bridge it or NAT it to the internet.
If your laptop is out of RAM, or you are on Apple Silicon, host the lab on a dedicated box running Proxmox VE or VMware ESXi and reach it over RDP/SSH. You still export/import the same OVA appliances — the workflow barely changes.
CyberHawk has full walkthroughs for both platforms if you outgrow a laptop: the Proxmox VE 9 and VMware ESXi 8 homelab guides on the blog pick up exactly where VirtualBox leaves off.
06 — Initial Configuration: The Kali Attacker
Phase 6 / 11Boot Kali, update it, install Guest Additions for a usable desktop, then snapshot it clean. This "golden" snapshot is the state you return to whenever an experiment leaves the box in a mess.
Prebuilt Kali images log in with kali / kali. If you installed from ISO, use the account you created. First thing after login: change the password.
Kali is a rolling release; update before you install anything. A stale mirror is the number-one cause of "package not found" errors for beginners.
Guest Additions unlock a resizable window, shared clipboard and shared folders. On Kali the packaged version is easiest; on other Linux guests, mount the Guest Additions ISO from the VirtualBox Devices menu and run the installer.
Enable a shared clipboard (bidirectional) and drag-and-drop under the VM's Settings → General → Advanced. It makes copying payloads and notes between host and Kali painless — but disable it before detonating anything untrusted.
Now that Kali is clean, updated and has Guest Additions, snapshot it. From now on you can experiment freely and roll back to this exact state in seconds.
07 — Core Configuration: Lab Networking (Get This Right)
Phase 7 / 11This is the single most important phase and the one beginners get wrong. VirtualBox offers several adapter modes; for a lab you care about three. The rule: your attacker and targets must talk to each other, but the targets must never reach the internet or your real LAN.
| Mode | VM ↔ VM | VM → Internet | Host ↔ VM | Use for |
|---|---|---|---|---|
| NAT (default) | No | Yes | No (port-fwd only) | Updating Kali only |
| NAT Network | Yes | Yes | No (port-fwd only) | Lab where Kali needs updates |
| Host-Only | Yes | No | Yes | Host reaches lab; no internet |
| Internal | Yes | No | No | Maximum isolation (malware) |
| Bridged | Yes | Yes | Yes | Avoid for targets — exposes them to your LAN |
A NAT Network lets all lab VMs talk to each other and reach the internet through the host (handy so Kali can update) while staying invisible from outside. Create it once, then attach VMs.
A host-only adapter gives your host machine a route into the lab (for SSH, RDP, copying loot) with no internet exposure. Create the interface, set its IP range, then attach it as a second NIC.
Host-only ranges are restricted by default on Windows/macOS. Allowed ranges live in /etc/vbox/networks.conf (Linux/macOS) or %PROGRAMDATA%\VirtualBox\networks.conf (Windows). If ipconfig is refused, add your subnet there first.
For detonating malware or running truly air-gapped targets, use an internal network: VMs on the same named intnet see each other and nothing else — not the host, not the internet. Assign static IPs inside the guests since there is no DHCP by default.
Prove the lab is sealed. From a target VM, a ping to a public address must fail. From Kali, discovery of the lab subnet must succeed. If a target can reach 8.8.8.8, stop and fix its NIC before doing anything else.
- Targets cannot ping or resolve any public address
- Kali sees the targets with
nmap -snon the lab subnet - No lab VM uses a Bridged adapter
- Your real router's DHCP client list shows none of the lab VMs
08 — Integration: Add Your Target VMs
Phase 8 / 11A lab is only useful with things to attack. Start with one Linux target and one web-app target, then add a Windows victim to practice the attacks that dominate real enterprise breaches. The table below is a sensible starter roster and what each box teaches.
| Target VM | RAM | Teaches | Default creds |
|---|---|---|---|
| Metasploitable 2 | 512–1024 MB | Service enumeration, unauth RCE, Metasploit basics | msfadmin / msfadmin |
| DVWA (Docker) | host container | SQLi, XSS, CSRF, file upload, command injection | admin / password |
| Windows Server (eval) | 4 GB | SMB attacks, AD, credential theft, pivoting | set at install |
| VulnHub box (OVA) | varies | Full CTF-style boot-to-root chains | per machine |
Attach Metasploitable to LabNet, boot it, find its IP, then run a service scan from Kali. Every port you see is an attack surface to research.
DVWA is the standard sandbox for web attacks — SQL injection, XSS, file upload, command injection — with tunable difficulty. The fastest install is the official Docker image on any Linux target VM.
Pair DVWA with Burp Suite (already in Kali). Set Firefox's proxy to 127.0.0.1:8080, and you can intercept, replay and fuzz every DVWA request — the exact workflow used against real web apps.
Most enterprise attacks land on Windows. Grab a free time-limited evaluation ISO from the Microsoft Evaluation Center (Windows Server) or the ready-made Windows 11 dev VM, install it as a normal VM, and place it on LabNet. Later, promote it to a Domain Controller to practice Active Directory attacks.
To practice attacks like SMB relay or a certain 2017 worm-class SMB exploit, you must disable Windows Defender and the firewall inside the lab VM and skip patches. That is exactly why the VM must be isolated — you are deliberately running a machine with its defenses off.
Confirm the attacker can reach every target and that a full exploitation toolchain works end to end — here, a quick Metasploit handshake against the classic vsftpd backdoor on Metasploitable.
09 — Advanced: Segmented, Reproducible Lab
Phase 9 / 11Once the basics work, grow the lab to mirror a real network: multiple subnets separated by a firewall, cheap disposable clones of targets, and tuned resources so more VMs fit on the same host.
A pfSense VM with two NICs turns a flat lab into a routed one: a "corp" subnet behind the firewall and a "DMZ" in front, so you can practice pivoting and firewall bypass. WAN faces the NAT Network; LAN faces an internal network the corp VMs share.
A linked clone shares the parent's disk and only stores differences — seconds to create, a fraction of the space. Perfect for spinning up five identical victims for a CTF. Take a snapshot first; linked clones branch from it.
Trim memory and cores on idle targets, enable the paravirtualization interface for the guest type, and turn on nested paging. Small tweaks let an 8 GB host juggle three or four VMs.
Run targets headless (--type headless) and reach them over SSH/RDP. A GUI-less VM uses noticeably less RAM and CPU than one rendering a desktop you never look at.
A realistic layout for practising lateral movement: an attacker subnet, a DMZ, and an internal corp subnet behind pfSense. Each lives on its own switch; only pfSense bridges them.
| Segment | Switch / Mode | Subnet | Hosts |
|---|---|---|---|
| Attacker | NAT Network "LabNet" | 10.10.10.0/24 | Kali |
| DMZ | Internal "dmz" | 10.10.20.0/24 | DVWA, Metasploitable |
| Corp | Internal "corp" | 10.10.30.0/24 | Win DC, Win client |
| Edge | pfSense (3 NICs) | routes all | Firewall / gateway |
10 — Monitoring, Maintenance & Troubleshooting
Phase 10 / 11Update Kali weekly, prune old snapshots (they consume disk and slow VMs), and export a golden appliance so a corrupted VM is a five-minute restore, not a rebuild.
The problems below account for the overwhelming majority of "my lab won't work" posts. Work top to bottom.
| Symptom | Cause | Fix |
|---|---|---|
| Only 32-bit guests offered | VT-x/AMD-V off, or Hyper-V owns it | Enable virtualization in BIOS; bcdedit /set hypervisorlaunchtype off |
| VERR_VMX_ROOT / rc=-1908 | vboxdrv module not loaded | sudo /sbin/vboxconfig; enroll MOK if Secure Boot |
| Extremely slow VMs | Windows Core Isolation / WSL2 active | Disable Memory Integrity & Hyper-V, reboot |
| VMs can't see each other | Using plain NAT (not NAT Network) | Switch NICs to NAT Network or Internal |
| Target has internet | Bridged/NAT adapter on a target | Move target to Host-Only or Internal |
| Host-only ipconfig refused | Subnet not in allow-list | Add range to networks.conf |
| Blurry / tiny screen | Guest Additions missing | Install Guest Additions, reboot |
| "Kernel driver not installed" (Win) | Install blocked / older build | Reinstall as admin; allow Oracle driver |
Snapshots are not backups. A snapshot chain lives inside the same disk file — if that file corrupts, every snapshot goes with it. Keep a periodic VBoxManage export OVA on separate storage for anything you cannot afford to rebuild.
- VirtualBox + Extension Pack installed and
VBoxManage --versionworks - Kali is updated, has Guest Additions, and a "clean-golden" snapshot
- At least one Linux and one web target respond to Kali on the lab subnet
- Every target fails to reach the internet (verified isolation)
- You can restore any VM to a known-good state in under a minute
11 — Sources & References
Phase 11 / 11Primary, first-party documentation for every tool used in this guide. Always download tools from these official sources and verify checksums.
Your lab is live — now put it to work.
With targets on the bench, the next step is running structured attacks and building the detections that catch them. Follow along with CyberHawk's hands-on guides — Nmap, Metasploit, Burp Suite, hashcat and the Active Directory home lab — on the CyberHawk blog, and test artifacts you find against the free IOC Scanner. Ready-to-run SOC playbooks live in the SOP library.
◈ Stay Connected
Follow CyberHawk Threat Intel for threat intelligence, deployment guides and hands-on SOC tooling content.
"They can't exploit you if you are the Exploit."