Building Labs with QEMU on Kali host


QEMU
QEMU (Quick Emulator) is a powerful, open-source virtualization tool widely used by security researchers, penetration testers, and red teamers for building fast and flexible virtual labs. Unlike VirtualBox or VMware, which offer GUI-based virtualization, QEMU operates at a lower level, offering direct control over CPU architecture emulation, hardware pass-through, and advanced networking. This makes it ideal for automated lab setups, malware analysis, and incident response simulations, especially when combined with KVM (Kernel-based Virtual Machine) for near-native performance.
What sets QEMU apart is its deep integration with Linux, minimal resource overhead, and extensive customization options. While VirtualBox and VMware are great for general-purpose VMs with user-friendly interfaces, QEMU shines in headless, scriptable, and production-like environments.
Heads-up: In my home lab, Kali Linux is used as the host operating system, and QEMU is used to create and run virtual guest machines for red team and IR testing.
QEMU Installation in Kali
(sticky@shicyber)-[~] sudo apt install virt-manager
OR
(sticky@shicyber)-[~] sudo apt update && sudo apt install virt-manager -y
To improve communication between the guest VM and the host system when using QEMU/KVM with virt-manager, we have to install certain modules inside the guest OS, namely qemu-guest-agent
and spice-vdagent
spice-vdagent
is responsible for enabling features like seamless mouse integration, clipboard sharing, and auto screen resizing between the guest and host.qemu-guest-agent
allows the host to communicate with the guest system, enabling features like graceful shutdowns, IP address reporting, and time sync.
(sticky@shicyber)-[~] sudo apt install qemu-guest-agent
(sticky@shicyber)-[~] sudo apt install spice-vdagent
(sticky@shicyber)-[~] sudo virt-manager
To enable efficient folder sharing between the Kali host and the QEMU virtual guest, we need to install the virtiofsd
module on the host system.
virtiofsd
is a userspace daemon that powers Virtio-FS, a modern way to share directories between the host and guest with better performance and POSIX compatibility compared to traditional methods like 9p
or Samba. It allows the guest VM to access a host directory almost as if it were native.
(sticky@shicyber)-[~] sudo apt install virtiofsd
Once installed, it can be used with QEMU to mount shared folders securely and efficiently. However. we have to create a shared folder in the kali host in prior or later.
Mount shred drive
Below set of commands creates a shared directory on the Kali host that can be accessed from a virtual machine using Virtio-FS.
sudo mkdir /mnt/irth_share
creates a new folder namedirth_share
in/mnt
, which will act as the shared folder between host and guest.sudo chown sticky:sticky /mnt/irth_share
changes ownership of the folder to the usersticky
, ensuring that this user has full read/write access.
Note: This step is important because Virtio-FS requires a properly permissioned host directory to mount it inside the guest VM.
(sticky@shicyber)-[~] sudo mkdir /mnt/irth_share
(sticky@shicyber)-[~] sudo chown sticky:sticky /mnt/irth_share
To validate if the shared folder has been created and mounted or not following command
(sticky@shicyber)-[~] ls -ld /mnt/irth_share
drwxr-xr-x 3 sticky sticky 4096 Jul 12 15:57 /mnt/irth_share
If it exists, you can open it in the file manager:
(sticky@shicyber)-[~] xdg-open /mnt/irth_share
Configure QEMU and Windows Guest
To access this mounted folder as a shared drive in the Windows VM, certain steps must be followed, and the necessary applications or drivers need to be installed inside the Windows VM. Without these, it will not be possible to access the shared drive.
Enabled shared memory
Add file systems
virtiofsd installation which we have performed before
Install Winfsp in Windows
Install virtio-win
Check if the service is running else start manually
Enabled shared memory
Add file systems
Add a new hardware and then add the info path location details in source path and target path.
virtiofsd installation
which we have performed installation before, if you haven’t installed
(sticky@shicyber)-[~] sudo apt install virtiofsd
Install Winfsp & virtio-win in Windows
virtio-win
is a set of Windows drivers provided by the QEMU project. These drivers are necessary for Windows guests to recognize and interact with virtual hardware (like Virtio devices for disk, network, and file sharing). For example, without these, Windows may not detect a Virtio-based shared folder, network adapter, or disk.WinFsp
(Windows File System Proxy) is a user-mode file system framework for Windows. It enables Windows to mount and interact with non-standard or virtual file systems—such as a shared folder provided by Virtio-FS. It's often used together with other tools (like SSHFS-Win or Virtio-FS integrations) to allow seamless folder access.
Why Install ?
If you're sharing a folder from your Kali host to a Windows guest VM via Virtio-FS, you’ll need:
virtio-win
drivers to support the Virtio device in WindowsWinFsp
to make the file system mountable and accessible in Windows
Without these, the Windows VM won’t recognize the shared drive, and folder sharing will fail.
Links
https://github.com/virtio-win/virtio-win-pkg-scripts/blob/master/README.md
Check the service
After the installation check the services from the windows and if you noticed it’s stopped then just start it. you will see it has been mounted and you can transfer files…
Final Test
Subscribe to my newsletter
Read articles from ShiNobiX directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
