The Wayback Machine - https://web.archive.org/web/20260215200015/https://www.geeksforgeeks.org/ethical-hacking/sandboxing-in-virtual-machines-for-malware-analysis/

Sandboxing in Virtual Machines for Malware Analysis

Last Updated : 7 Oct, 2025

A sandbox is a secure environment used to run and study malicious software safely. It allows you to observe files, registry, processes, and malware analysis without infecting the actual system, helping develop effective defence strategies.

Setting Up a Sandbox in an Isolated Virtual Machine

Follow these steps to create and run a secure malware analysis environment:

1. Choose a Virtualisation Software: Pick a virtualisation software to create and run your virtual machine (VM):

  • VirtualBox → free and easy to use
  • VMware Workstation → advanced features
  • Hyper-V → built into Windows 10/11

2. Create and install the Virtual Machine: Here is the link to install Virtual Machine.

3. Ensure VM is Ready: Make sure your virtual machine has a fresh Windows or Linux installation.

  • Take an initial snapshot of the VM now (name it Clean-Base) so you can always revert to this clean state before testing malware.
  • Confirm that virtualisation features are enabled on the host and that the VM is properly isolated (no shared folders or clipboard with the host).

4. Install a Sandbox in the VM: You can choose either Sandboxie‑Plus (for windows) or Firejail Sandbox (for linux).

Sandboxie-Plus (Requires Windows):

  • Take a screenshot of your VM (Before-Sandboxie-Install).
  • Inside the VM, open a browser and download Sandboxie‑Plus from the official website.
  • Run the installer → follow prompts → install using default options. Launch Sandboxie‑Plus Control → create a new sandbox (e.g.: MalwareSandbox).
sandboxie-plus-
  • Configure sandbox settings if needed.
  • You can now run any program sandboxed: right-click the file → Run Sandboxed → choose AnalysisBox.
sandboxie-plus-
  • After testing, delete sandbox contents or revert VM to snapshot to clean everything.

Firejail Sandbox (Requires linux):

  • Take a snapshot of your Kali VM (e.g., Before-Firejail-Install).
  • Inside the VM, update the system:
sudo apt update && sudo apt upgrade -y
  • Install Firejail sandbox:
sudo apt install firejail -y
1
  • Verify the installation:
firejail --version
  • Place the suspicious binary or malware sample in a dedicated folder (e.g., sample_name).
  • Run the program inside a sandbox with Firejail:
firejail ./sample_name
  • Use tools like strace or Wireshark to monitor the sandboxed program’s behaviour.
  • After analysis, delete the sample and revert the VM snapshot to return to a clean state.
Comment

Explore