Show Me the Recovery: Testing Backups Against Ransomware

Note: This post was originally written on October 26, 2017, and updated on November 22, 2026, for modern Windows, NAS, and immutable backup setups.

An ounce of prevention is worth a pound of cure, and that especially applies to ransomware. Every guide on the subject tells you the same two things: use common sense and keep a good backup. That second part got me thinking. How do you actually know if your backup plan will hold up when things go sideways?

To find out, I spun up an isolated Windows virtual machine (VM) on a segmented lab network and attached a second virtual disk to act as a local backup drive. I wanted to see whether standard local backups would survive an active ransomware run, or if the infection would chew right through the backup drive too.

Warning: Do not run ransomware samples or simulator scripts on your daily driver or any machine with access to live network shares. Only test this inside an isolated VM on a segmented network with no production data attached.

Prerequisites

Before you test anything like this in your own lab, make sure you have a few basics in place:

  • An isolated Windows 11 VM on a segmented VLAN or private virtual switch.
  • A clean VM snapshot taken before you touch anything, so you can roll back in seconds.
  • Sample test files (documents, spreadsheets, and images) you do not care about losing.
  • A local backup target (an attached virtual disk) and, if you run a NAS, a test SMB share with snapshots enabled.

Why Real Malware Was a Dud in the Lab

When I originally ran this test, I grabbed a real sample of the Locky ransomware to see what it would do against a patched Windows VM. I figured it would detonate right away. Instead, Microsoft Defender blocked it before it could do anything.

So I turned Defender off and tried again, clicking through every security warning in Word to enable macros. Still nothing. I disabled country blocking on my firewall and bypassed my threat protection, and the sample still sat there doing nothing because its command-and-control servers were long dead. It turns out trying to infect a lab machine on purpose is surprisingly hard.

If I could not get a real sample to run, I decided to build a harmless simulator instead. I opened PowerShell and wrote a quick script that scans drives and appends .ransom to user files while skipping Windows, Program, and AppData folders, plus .exe and .dll files. The script below targets a specific test path so you can see how a local backup target reacts without bricking the OS.

$TargetPaths = @("C:\Users", "D:\")

foreach ($Root in $TargetPaths) {
    Get-ChildItem -Path $Root -Recurse -File -ErrorAction SilentlyContinue | Where-Object {
        $_.FullName -notmatch '\\(Windows|Program Files|Program Files \(x86\)|AppData)\\' -and
        $_.Extension -notin @('.exe', '.dll', '.ransom')
    } | ForEach-Object {
        Rename-Item -Path $_.FullName -NewName ($_.Name + ".ransom") -ErrorAction SilentlyContinue
    }
}
Code language: PowerShell (powershell)

I took a fresh snapshot of the VM, kicked off the script, and watched what happened. This time, it worked.

Testing Local Windows Backups

For the first round, I tested the built-in and local tools people rely on most often:

  1. Windows File History: File History backs up user libraries to a secondary drive. Because that drive had a drive letter assigned to it, the script walked right onto the backup drive and renamed the backed-up copies too.
  2. Windows Backup and Restore (Legacy): This older tool stores a system image as a .vhdx file on an external drive. Because ransomware typically runs with elevated privileges or targets common archive extensions, that .vhdx on a mounted drive is still a sitting duck.
  3. Dedicated Backup Agents (e.g., Veeam Agent for Windows Free): Storing backups in a proprietary archive format helps against basic scripts that only target .docx or .jpg files. However, if the backup sits on a mounted drive letter or a writable network share, modern ransomware will either encrypt the archive or delete it outright.

What Actually Protects Your Backups

Testing those local backups confirmed one simple rule: if Windows can see it with a drive letter and write to it, ransomware can ruin it. A local backup is not supposed to stop ransomware by itself. You have to protect your backups from the machine being backed up.

Backup TargetSurvives Ransomware?Why
Always-connected USB driveNoMounted with a drive letter and writable by the infected PC.
Writable NAS SMB shareNoMalware can traverse mapped drives and even unmapped UNC paths.
NAS share with ZFS snapshotsYesSnapshots are read-only on the NAS, so the PC cannot alter or delete them.
Immutable cloud backup (3-2-1-1-0)YesObject Lock and versioning keep prior clean copies safe off-site.
Rotated offline USB drivesYesAir-gapped drives that are physically disconnected cannot be touched.

If you run a NAS like TrueNAS in your homelab, scheduled ZFS snapshots are the easiest way to make a local backup ransomware-resistant. Even if a PC encrypts everything inside a writable SMB share, the Windows box has no permissions to touch the underlying ZFS snapshots on the server. You just clean or rebuild the PC and roll the dataset back to a snapshot taken before the infection.

Pair that with an off-site cloud backup that supports versioning or immutability (such as Backblaze or restic pushing to an Object Lock bucket), or rotate an external drive you unplug when the backup finishes. Follow the 3-2-1-1-0 rule (three copies, two media types, one off-site, one immutable or offline, and zero errors on test restores), and you will actually have something to restore when disaster hits.

Wrapping Up

Testing your backups with a harmless script in an isolated VM is a fast way to find blind spots before an actual infection finds them for you. Local backups on an attached drive are great for fast restores after a hardware failure, but they will not save you from ransomware unless you add an immutable layer like ZFS snapshots or an air-gapped copy. Give your backup plan a dry run in a test VM and see how it holds up.

Published on

by

Nick

Leave a Comment