Sub topic 12
Security and Isolation of Virtual Machines
This chapter assumes you know what a host, a guest, and a hypervisor are, and that you have seen the virtual network modes (NAT, bridged, host-only, internal). Here you will see how those pieces combine to keep a risky guest away from your real machine and your network.
Isolation is the main security feature
A hypervisor gives each guest its own virtual CPU, memory, disk, and network adapter. Software inside a guest normally cannot read the host's files or the memory of another guest. This is why a VM works as a sandbox, an isolated space where you can run untrusted software without risking the host.
Isolation is strong but not perfect. A flaw in the hypervisor can let code escape from a guest to the host. This is called a VM escape. Hypervisor vendors patch these flaws, so keeping the hypervisor updated is part of VM security.
What the guest can still reach
A guest is only as isolated as its settings allow. These features open paths between guest and host:
- Shared folders let the guest read and write host files.
- Shared clipboard and drag-and-drop move data between guest and host.
- Bridged networking puts the guest on your real LAN, where it can reach other devices.
- USB passthrough hands a physical device to the guest.
For a malware analysis VM, turn these off. Pick the network mode by how much contact you want with the outside world.
| Network mode | Guest can reach the internet | Guest can reach the LAN | Isolation |
|---|---|---|---|
| NAT | Yes | Outbound only, through the host | Medium |
| Bridged | Yes | Yes, as a full peer | Low |
| Host-only | No | Host only | High |
| Internal | No | Other guests on the same internal network | Highest |
Protecting the guests themselves
Each guest is a full operating system, so it needs the same care as a physical PC:
- Install OS updates and antivirus inside the guest.
- Use a firewall and strong passwords on the guest.
- Keep guest tools or additions updated, because they add drivers and features that can have flaws.
- Take a snapshot before risky work. A snapshot saves the guest's state so you can roll back after an infection. A snapshot is not a backup, because it usually lives on the same disk as the VM.
Unused or forgotten VMs are a risk too. An old guest that nobody patches is an easy target, a problem called VM sprawl. Delete guests you no longer need.
Host and data concerns
If the host is compromised, every guest on it is exposed. Secure the host first. Virtual disk files and snapshots can also hold sensitive data, so protect them with file permissions or disk encryption. On a shared host, give each VM only the CPU, memory, and storage it needs, so one noisy or infected guest cannot starve the others.
Remember that a VM copy does not carry a new software license. Licensing for guest operating systems still applies.
Exam tips
- "Test suspicious software safely" points to a VM sandbox with host-only or internal networking.
- "Guest must appear as its own device on the LAN" points to bridged mode, which lowers isolation.
- "Undo a bad change quickly" points to a snapshot.
Exercise
A technician must open a suspicious attachment in a VM. The guest must not reach the internet or the company LAN, but the technician wants to copy results to the host over the network. Which network mode fits, and what should be done before opening the file?
Show answer
Use host-only mode, because the guest can talk to the host but not the internet or LAN. Before opening the file, take a snapshot and disable shared folders and the shared clipboard, so the guest can be rolled back and has no other path to the host.