Skip to content
Flooding-against-RansomwarePublic

About

The Scalable Air-gapped Framework for Automated Ransomware Investigation (SAFARI) platform

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SAFARI: Scalable Air-gapped Framework for Automated Ransomware Investigation. Reproducible ransomware experiments, as code.


SAFARI is a framework for running ransomware safely and reproducibly, to study how it behaves and to test countermeasures against it. It applies infrastructure-as-code to security research. In the current incarnation, SAFARI targets Proxmox VE and uses Terraform to create disposable virtual machines, Ansible to infect them, cut their network (to isolate them), run possible countermeasures under test, and collect the results. Every experiment is a set of configuration files, so one can repeat them and arrays of parametric experiments and run them in parallel on many machines.

We used SAFARI to profile the encryption patterns of seven ransomware strains, including WannaCry and LockBit, and to evaluate Ranflood against five of them.

Caution

SAFARI's main use case is the execution of live ransomware. Run it only on a dedicated Proxmox host that is isolated from production networks and storage, keep samples in password-protected archives, and check your institution's rules on handling malware before you start. SAFARI disconnects the victim machines from the network before it runs the sample, but isolating the host is your responsibility.

How it works

An experiment has two phases. Each phase is driven by a shell script that applies a Terraform configuration and then runs an Ansible playbook.

1. Infection (Infected/infected.sh). Terraform clones vms_count Windows VMs from a template and writes their IP addresses, IDs, and disk names to Infected/vm_ip_address.txt, vm_id.txt, and vm_disk.txt. The external playbook then copies the ransomware archive, an internal playbook, and its variables into each VM over WinRM, and starts the internal playbook inside the VM through WSL. The internal playbook:

  1. disables all network bindings of the VM, cutting it off from the network;
  2. starts the Ranflood daemon and, for the strategies that need it, takes a snapshot of the target directory;
  3. extracts the ransomware and runs it;
  4. after a configurable delay, starts Ranflood's flooding.

To run the ransomware without any countermeasure, as a baseline, use internal_playbook_only_rans.yml as the internal playbook. Finally, after a configurable delay, the external playbook shuts the victims down from the Proxmox host.

2. Checking (Checker/checker.sh). Terraform clones one Linux checker VM per victim. Each checker receives the disk of its victim as a passthrough device, plus a small disk for the results. The playbook mounts the victim's disk, runs Ranflood's filechecker to compare the user's files with the checksums of a clean installation, and copies the report to the results disk.

Since the victims are shut down and a separate machine analyses their disks, the ransomware cannot interfere with the analysis.

Requirements

Controller (the machine that runs the scripts)

  • Terraform, which installs the Telmate/proxmox provider (version 3.0.1-rc4) at terraform init
  • Ansible with pywinrm and the collections ansible.windows, community.windows, community.general, and ansible.posix

Proxmox VE host

  • an API token for Terraform, and SSH access for Ansible, which shuts the VMs down with qm shutdown
  • a storage for the results disks

Victim template (Windows 10)

  • QEMU guest agent, so that Terraform can read the VM's IP address
  • WinRM enabled, with the credentials listed in Infected/Ansible/external_inventory
  • WSL with Ansible, which runs the internal playbook from inside the VM
  • Ranflood, if you test it

Checker template (Linux)

  • QEMU guest agent and SSH, with the credentials listed in Checker/Ansible/inventory
  • Java and a build of Ranflood, which provides filechecker.jar
  • the checksums of the clean victim template, created with Ranflood's filechecker

Configuration

Git does not track the variable files or the samples (see .gitignore).

  1. Terraform variables. In both Infected/Terraform and Checker/Terraform, create a file ending in .auto.tfvars that sets the variables declared in variables.tf: the Proxmox API URL and token, the template to clone, the number of VMs, and their resources. For the checker, vm_disk_to_check_name_file points to the Infected/vm_disk.txt file produced by the first phase.
  2. Ansible variables. Create Infected/Ansible/ansible_variables.yml with the paths of the sample and the playbooks on the controller and inside the VM, the name of the sample archive, the Ranflood strategy and target directory, and the two delays (before flooding, and before shutting down). The playbooks show the names of the variables they expect.
  3. Inventories. Set the address and credentials of the Proxmox host in Infected/Ansible/external_inventory.
  4. Paths. The scripts and playbooks assume that the repository is in ~/Coding/SAFARI. Update the paths in infected.sh, checker.sh, and the playbooks if you cloned it elsewhere. The checker's results disk uses the Proxmox storage named storage-condiviso in Checker/Terraform/checker.tf.

Running an experiment

# Phase 1: create the victims, infect them, and shut them down
./Infected/infected.sh

# Phase 2: analyse the victims' disks
./Checker/checker.sh

Terraform appends to vm_ip_address.txt, vm_id.txt, and vm_disk.txt. Before a new experiment, delete these files and destroy the previous VMs with terraform destroy.

Tips

Setting pm_timeout = 600 in the provider "proxmox" block of the provider.tf files helps when cloning machines with large disks, especially on slow storage. With shorter timeouts, the cloning may succeed but the VM becomes ready too late for the scripts that depend on timings, such as sequential tests on the same node.

Publications

If you use SAFARI, please cite:

  • T. Compagnucci, S. Giallorenzo, A. Melis, S. Melloni, M. Prandini, A. Vannini. SAFARI: A Scalable Air-gapped Framework for Automated Ransomware Investigation. Computers & Security 170, 2026. doi:10.1016/j.cose.2026.105032

Related work:

  • T. Compagnucci, F. Callegati, S. Giallorenzo, A. Melis, S. Melloni, A. Vannini. SAFARI: A Scalable Air-Gapped Framework for Automated Ransomware Investigation. IFIP SEC 2025. doi:10.1007/978-3-031-92882-6_15
  • F. Callegati, S. Giallorenzo, A. Melis, S. Melloni, M. Prandini, A. Vannini. Investigating Operational Technology Attacks as Code. Empirical Software Engineering 30, 2025. doi:10.1007/s10664-025-10713-2. It extends SAFARI to industrial Operational Technology environments; see OT_case_studies.
  • D. Berardi, S. Giallorenzo, A. Melis, S. Melloni, L. Onori, M. Prandini. Data Flooding against Ransomware: Concepts and Implementations. Computers & Security 131, 2023. doi:10.1016/j.cose.2023.103295

Licence

SAFARI is free software, released under the GNU Lesser General Public License v2.1.

About

The Scalable Air-gapped Framework for Automated Ransomware Investigation (SAFARI) platform

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages