In the first hours of a ransomware attack, everyone rushes to bring systems back and, in that rush, deletes the most valuable evidence with their own hands. Restarted servers, formatted disks, event logs that fill up and get overwritten, snapshots deleted because their retention period ran out: everything that would show how the attacker got in and what they took is gone. This guide explains which evidence to preserve, in what order and how, without delaying recovery.
The conflict between recovery and evidence preservation
In enterprise cybersecurity incidents, the purpose of preserving evidence isn’t just legal proceedings. Recovery done without knowing the initial access point, the accounts used, the persistence mechanisms and the scope of the leak invites the attacker back through the same door. Personal data breach notification, insurance claims and customer communication also rely on these findings. No evidence, no answers.
The conflict blows up at these points:
- Restoring an affected virtual machine from backup to the same place overwrites the original disk.
- Restarting the server erases processes in memory, network connections and injected code.
- Mass antivirus cleanup changes malicious files and timestamps.
- Full event logs are overwritten cyclically with new events.
- The backup software’s retention policy automatically deletes restore points from the attack period.
The practical principle is simple: recovery is done to new targets, originals are frozen. For this, capacity reserved for evidence storage and a separate environment where recovery will be done should be planned in advance; nobody has time to build these from scratch on the day of the incident. The design of the recovery environment is explained separately in the isolated recovery environment guide.
Order of volatility
RFC 3227 recommends collecting evidence from the most volatile to the most persistent. The faster a source disappears, the earlier it’s preserved. The table below adapts this order to a typical Windows and virtualization environment.
| Evidence type | Volatility | Why it disappears | Preservation method |
|---|---|---|---|
| Memory, processes, network connections | Very high | Shutdown, restart | Memory image, VM snapshot with memory |
| Temporary files, page file | High | Restart, cleanup | Inside the disk image |
| Local event logs | Medium–high | Cyclic overwriting, deletion | Export, central logging |
| Disk contents | Intermediate | Rebuild, restore | Disk image, snapshot |
| Firewall, proxy, EDR, cloud logs | Intermediate | Retention period limit | Extending retention, export |
| Backups and archives | Low to medium | Retention policy | Retention lock, separate copy |
Firewall, proxy and cloud logs look persistent, but their retention periods are often short. The day you notice the incident may also be the day these sources are about to delete the initial access period. That’s why extending retention or exporting the raw data moves to the top of the list in the first hours. This is the evidence most often lost in the field.
Approaches to memory and disk imaging
Virtual machines
Virtualization makes evidence collection easier. In VMware vSphere, a snapshot that includes memory writes the memory contents to a separate file; in Hyper-V, putting the machine into a saved state writes the memory state to disk in a similar way. Then the virtual disk and memory files are copied to an evidence store independent of production. No tool needs to be installed in the guest operating system, and the attacker’s interference inside the guest doesn’t affect this process.
With one condition: the hypervisor itself may also have been affected. If encryption was done at the hypervisor layer, taking a snapshot may not be possible; then the storage array’s snapshot feature or a raw LUN copy is used.
Physical servers and clients
On physical systems, a memory image is taken with a dedicated tool while the operating system is running (tools such as WinPmem or Magnet RAM Capture for Windows, AVML or LiME for Linux). Run the tool from external, write-protected media and write the output to an external disk; every file written to the system disk can overwrite potential evidence. A disk image, on the other hand, is taken after the system is shut down with a hardware write blocker, or as a logical image on the live system. Common formats are raw (raw/dd) and E01, which carries metadata and a hash.
Whatever the method, the hash value is calculated and recorded as soon as the image is taken. Examples on Windows and Linux:
# Windows (PowerShell)
Get-FileHash -Algorithm SHA256 -Path E:\Evidence\SRV-FS01-mem.raw |
Format-List Path, Hash
# Linux
sha256sum /mnt/evidence/srv-fs01-disk0.raw | tee /mnt/evidence/srv-fs01-disk0.raw.sha256
The hash value is written into the chain of custody record. Analysis is always done on a copy, and the copy’s hash is compared with the original. The original isn’t touched.
Preserving log sources
Attackers may clear the Windows Security log to cover their tracks; the log’s default size also covers a very short period on a busy server. The first job during an incident is to export the logs on affected and suspicious systems and, if needed, increase the size limit. This is the first place to look in the console.
REM Exporting logs (elevated command prompt)
wevtutil epl Security E:\Evidence\DC01-Security.evtx
wevtutil epl System E:\Evidence\DC01-System.evtx
wevtutil epl "Microsoft-Windows-PowerShell/Operational" E:\Evidence\DC01-PS.evtx
REM Setting the Security log's maximum size to 1 GB (in bytes)
wevtutil sl Security /ms:1073741824
Other log sources to prioritize:
- Domain controllers: Authentication, group membership changes, new service and scheduled task creation events.
- Firewall and VPN: Remote access sessions and large outbound data transfers; the scope of a leak is usually worked out from here.
- EDR console: Process tree and command-line telemetry; the product’s retention period may be limited, so export the data for the relevant endpoints.
- Cloud and Microsoft 365: Audit logs and sign-in records; the retention period depends on the license, so export the records for the incident period.
- Backup and hypervisor consoles: Job deletions, retention changes, console sessions and hypervisor shell access logs.
If there’s a central log infrastructure, most of the evidence is already there. But the SIEM’s own retention policy should also be frozen to cover the incident period; otherwise the SIEM deletes its own records in turn too. Retention period and architecture decisions are covered in the central log retention architecture article.
Keeping snapshots and backups as evidence
Backups from the attack period are valuable for both recovery and investigation. The investigation team finds the initial access date and persistence mechanisms by comparing these restore points; the method is explained in detail in the choosing a clean recovery point guide. The problem: the backup software keeps deleting these points under the normal retention policy. If nobody stops it, it won’t stop.
What to do the moment the incident is declared:
- Stop automatic retention cleanup in backup jobs covering the affected systems, or put the relevant restore points on indefinite retention.
- Take a separate copy of the restore points covering the attack period to a target independent of the production backup chain.
- Prevent automatic deletion of storage array and hypervisor snapshots; if the product supports it, apply a retention lock.
- Don’t use the points set aside as evidence in restore tests; work on a separate copy for recovery.
These steps require capacity. Plan in advance assuming the evidence storage space will be roughly the total disk size of the affected systems, plus their memory size, plus the backup chain for the attack period. Cases where evidence is sacrificed because no capacity can be found during the incident happen in the field more often than you’d think.
The chain of custody record
The chain of custody is a record that shows without interruption who took a piece of evidence, when and how, and whose hands it passed through afterwards. Without the record, even technically correct evidence has its reliability called into question. NIST SP 800-86 defines the digital forensics process in the stages of collection, examination, analysis and reporting; the chain record is kept from the first stage onwards.
| Field | Example content |
|---|---|
| Evidence ID | INC-2026-004-E07 |
| Source | SRV-FS01, virtual disk 0 |
| Method and tool | Hypervisor snapshot, disk file copy |
| Time (including UTC) | Start and end of acquisition |
| Hash | SHA-256 value |
| Collector and witness | Name, role, signature |
| Storage location | Evidence store path or physical safe |
| Handover records | For each handover: date, handed over by, received by, purpose |
The accuracy of system clocks is recorded too. Timestamps from a system with clock drift need correcting when compared with other sources; that’s why, when evidence is taken, the difference between the target system’s clock and a reference clock is noted. A single server with broken NTP can shift the whole timeline.
First response checklist
- Has the incident lead and the person who will make evidence preservation decisions been identified?
- Have the affected systems been disconnected from the network, but not shut down unnecessarily?
- Was a memory image or a snapshot with memory taken before shutting down or restarting?
- Have local event logs been exported and log sizes increased?
- Has the retention period of firewall, VPN, EDR and cloud logs been extended to cover the incident period?
- Has backup and snapshot retention cleanup been stopped?
- Is recovery being done to separate targets rather than over the originals?
- Has a hash and a chain of custody record been created for each piece of evidence?
This list is only useful during an incident if the tools, evidence store and authority decisions are ready in advance; the general readiness steps are in the ransomware recovery readiness article. To review your incident response plan together with evidence preservation steps and test it with an exercise, see our cyber incident response readiness and exercises service.
Primary sources: RFC 3227 and NIST SP 800-86.
Handle the technical response steps together with a cyber incident response and notification plan that covers decision owners and notification processes.
Frequently asked questions
Is it right to shut down a server infected with ransomware immediately?
In most cases, cutting the network connection first is better than shutting down. Shutting down destroys processes in memory, network connections and sometimes traces of the encryption key. For virtual machines, a snapshot with memory or suspending is preferred; for physical servers, shutting down after taking a memory image. If encryption is actively ongoing and data loss is growing, the incident lead must make this decision quickly.
How long should snapshots kept as evidence be retained?
The period is a legal and contractual decision, not a technical one. They’re kept until the forensic investigation, the insurance process, possible litigation and official notification obligations are complete. That’s why evidence snapshots are taken out of the normal retention policy, and their deletion requires the written approval of the incident lead and the legal department.
Can our own team take memory or disk images?
Yes, as long as the tools have been prepared in advance, the procedure is written and it has been tried in an exercise. An image’s value comes from being kept together with its hash value and the chain of custody record. If legal proceedings are anticipated, carrying out the imaging together with an independent digital forensics expert reduces the chance of the evidence being challenged.
Does restoring to an isolated environment for recovery damage evidence?
A restore produces a new copy from the backup; it doesn’t change the source. The problem is overwriting the affected original disks or virtual machines. Rebuilding isn’t done before the original environment has been imaged and snapshotted, and restores are done to separate targets.