When a ransomware wave hits a production environment, the first instinct is to restore from backups. That’s a good rule of thumb, but it only works if the backups are clean. In practice, many organisations restore from the same storage that the malware infected, ending up with the same encrypted data. Archiving pre‑incident snapshots—immutable, signed copies of the system state taken before the attack—provides a clean slate that is often overlooked.
Why snapshots matter
- Immutability – Snapshots stored in a write‑once, read‑many (WORM) archive cannot be altered by malware.
- Atomicity – A snapshot captures the entire filesystem and memory state at a single point, avoiding the “partial restore” problem that can leave services in a half‑upgraded state.
- Speed – Restoring from a snapshot is typically faster than rebuilding from incremental backups, reducing downtime.
- Auditability – Signed snapshots can be logged and verified against a chain of custody, satisfying compliance frameworks such as NIST SP 800‑171.
Building a snapshot strategy
| Layer | Tool | Typical command | Notes |
|---|---|---|---|
| VM | vboxmanage snapshot (VirtualBox) |
vboxmanage snapshot <vm> take pre-incident --description "Before ransomware" |
Works for on‑prem VMs. |
| Container | docker commit |
docker commit --change='CMD ["bash"]' <container> pre-incident |
Use for stateless services. |
| Filesystem | btrfs subvolume snapshot |
btrfs subvolume snapshot /mnt/root /mnt/root-snap |
Btrfs supports copy‑on‑write snapshots natively. |
| Cloud | AWS EBS snapshot | aws ec2 create-snapshot --volume-id vol-12345678 --description "Pre‑incident" |
Use AWS CLI or SDK. |
| Immutable storage | AWS S3 Glacier Deep Archive | aws s3 cp snapshot.tar.gz s3://bucket/archives/ --storage-class DEEP_ARCHIVE |
Adds WORM layer. |
Example: snapshotting a critical web server
# 1. Stop services that modify state
systemctl stop nginx
# 2. Create a btrfs snapshot
btrfs subvolume snapshot /var/www /var/www-snap
# 3. Archive the snapshot
tar -C /var/www-snap -cvzf /tmp/www-snap.tar.gz .
# 4. Upload to immutable storage
aws s3 cp /tmp/www-snap.tar.gz s3://secure-archives/www-snap-$(date +%F).tar.gz --storage-class DEEP_ARCHIVE
# 5. Sign the archive
openssl dgst -sha256 -sign private.key -out www-snap.sig /tmp/www-snap.tar.gz
The signed archive can be stored off‑site or in a separate AWS region. In the event of an incident, you can download the archive, verify the signature, and restore the exact pre‑infection state.
Trade‑offs to consider
| Trade‑off | Benefit | Drawback |
|---|---|---|
| Storage cost | Immutable archives are cheap in Glacier tiers. | Requires a separate bucket and lifecycle policies. |
| Snapshot frequency | More snapshots = higher recovery fidelity. | Higher storage and management overhead. |
| Snapshot size | Full snapshots capture everything. | Large archives can slow restoration. |
| Automation | CI/CD pipelines can schedule snapshots. | Complexity in orchestrating across heterogeneous environments. |
Common pitfalls
- Snapshotting after the attack – If you take a snapshot after the malware has run, you’ll capture encrypted files. Always schedule snapshots before any critical update or deployment that could trigger an attack vector.
- Not signing snapshots – Without a cryptographic signature, you can’t prove the snapshot was not tampered with.
- Ignoring metadata – Store the snapshot’s creation time, hash, and any relevant logs in a separate audit table.
- Failing to test restores – A snapshot is useless if you can’t restore it. Run a quarterly restore drill on a non‑production clone.
Integrating snapshots into your incident response playbook
- Detection – When an anomaly is detected (e.g., a sudden spike in file modifications), trigger an automated snapshot job via a monitoring system like Prometheus + Alertmanager.
- Containment – Isolate the affected host.
- Recovery – Pull the latest pre‑incident snapshot, verify its integrity, and restore to a clean environment.
- Validation – Run integrity checks (e.g.,
sha256sum) against known good hashes stored in a secure vault. - Lessons learned – Update the playbook with any gaps discovered during the restore.
Real‑world example
In 2025, a mid‑size SaaS provider faced a ransomware outbreak that encrypted their PostgreSQL data directory. Their backup strategy was a nightly incremental dump to an S3 bucket. When they restored, the dump contained the same encrypted files. Because they had an immutable btrfs snapshot from the previous day, they could restore the database to its exact state before the attack, recover all data, and resume service within 90 minutes. The incident report highlighted the snapshot as the decisive factor.
Automation tips
- Use IaC – Terraform modules can provision snapshot schedules for EC2 instances.
- Leverage GitOps – Store snapshot definitions in a Git repo; changes trigger CI pipelines that create snapshots.
- Encrypt at rest – Enable SSE‑KMS on S3 or use client‑side encryption before uploading.
- Rotate keys – Follow NIST SP 800‑57 for key lifecycle management.
When snapshots are not enough
If the ransomware targets the hypervisor or the storage controller, even immutable snapshots may be compromised. In those cases, consider:
- Hardware‑based root of trust – TPM‑based attestation to verify that the hypervisor hasn’t been tampered with.
- Network segmentation – Isolate critical workloads so that a compromised host cannot reach the storage backend.
- Zero‑trust micro‑segmentation – Use tools like Calico or Cilium to enforce per‑pod policies.
Final checklist
- Snapshots are taken before any critical change.
- Snapshots are signed and stored in a WORM archive.
- Restore drills are performed quarterly.
- Snapshot metadata is logged in an immutable audit trail.
- Automation is in place to trigger snapshots on alerts.
Implementing a robust pre‑incident snapshot strategy turns ransomware from a catastrophic event into a manageable incident. It’s a small operational overhead that pays dividends in resilience and compliance.
See also
- How ML and Behavioral Analysis Are Changing WAFs
- Skipping CVE‑2026‑1234: a risk‑based patching trade‑off for CI pipelines
- NGWAF: From Static Rules to Behavioral, API-Aware Protection
- Using Attack Trees to Prioritize API Endpoint Protection in Microservices
- When a Compromised RDP Session Spills Into the VLAN: A Hands‑On Guide to
- Fixing Session Fixation in a Remember Me Cookie