Incident Response

Forensic Evidence Preservation after a Cyberattack: Secure the Evidence Before It Disappears

Ransomware Reverse Editorial TeamLast technical review: 8 min read

After a cyberattack, the most valuable evidence is often the first to be lost: memory, active network connections and short-lived logs. Forensic preservation therefore follows the order of volatility, captures disks as images with hash values, records every hand-over in a chain of custody and exports cloud logs before their retention expires. Rebuilding, cleaning and restoring come afterwards.

Key takeaways

  • Secure the most volatile evidence first, such as memory, network connections and sessions, before systems are restarted or cleaned.
  • Isolate affected systems from the network instead of reflexively shutting them down, and document every shutdown decision with time and reason.
  • Export cloud and SaaS logs early, because expired logs cannot be recovered after the fact.
  • Image disks with hash values, analyse only copies and record every handover in a chain of custody.
  • Avoid antivirus scans, cleanup scripts and reinstallations before evidence is secured, as they overwrite files, timestamps and logs.

In short: why evidence comes before recovery

After a cyberattack there is strong pressure to bring systems back quickly. That is exactly when the evidence you will badly need later tends to disappear: How did the attackers get in? How long have they been in the network? Which accounts are compromised? Was data taken? Without those answers you can neither pick a clean restore point nor assess notification obligations properly.

Forensic preservation is therefore not an academic exercise but part of incident response. NIST SP 800-86 describes the forensic process in four phases: collection, examination, analysis and reporting.[2] This guide focuses on the first phase – collection – and on what administrators can get right or wrong in the first hours. The overall process is covered in Ransomware Incident Response: The Process.

The order of volatility

Not all evidence is equally short-lived. RFC 3227, the IETF guidelines for evidence collection, recommends starting with the most volatile data.[1]

Order of volatility (RFC 3227)1. Registers, cache; 2. Routing table, ARP cache, process table, kernel statistics, memory; 3. Temporary file systems; 4. Disk; 5. Remote logging and monitoring data; 6. Physical configuration, network topology; 7. Archival media. Levels 1–2: lost on shutdown. ↑ volatile1 Registers, cache2 Routing table, ARP cache, process table, kernel statistics, memory3 Temporary file systems4 Disk5 Remote logging and monitoring data6 Physical configuration, network topology7 Archival media↓ persistentlost on shutdown – collectfirst © 2026 ransomware-reverse.de
Order of volatility (RFC 3227)1. Registers, cache; 2. Routing table, ARP cache, process table, kernel statistics, memory; 3. Temporary file systems; 4. Disk; 5. Remote logging and monitoring data; 6. Physical configuration, network topology; 7. Archival media. Levels 1–2: lost on shutdown. ↑ volatile1 Registers, cache2 Routing table, ARP cache, process table,kernel statistics, memory3 Temporary file systems4 Disk5 Remote logging and monitoring data6 Physical configuration, network topology7 Archival media↓ persistent1–2: lost on shutdown – collect first © 2026 ransomware-reverse.de
Order of volatility (RFC 3227). Collect from top to bottom: first what is lost fastest. Shutting down or rebooting destroys the top levels.
RankData source (per RFC 3227)Typically lost through
1Registers, cacheAny further activity
2Routing table, ARP cache, process table, kernel statistics, memoryReboot, power-off
3Temporary file systemsReboot, clean-up
4DiskOverwriting, reinstallation
5Remote logging and monitoring data relevant to the systemRetention expiry, rotation
6Physical configuration, network topologyChanges to the environment
7Archival mediaRarely at immediate risk

For volatile operating system data, NIST SP 800-86 gives a more specific order: network connections and login sessions first, because connections may time out and sessions change, then memory contents, running processes, open files, network configuration and finally the operating system time.[2]

In a ransomware case this means that memory from an affected system is often worth more than yet another scan. It holds running processes, active network connections and loaded tools that can no longer be traced after a reboot.

Power off or isolate?

This question comes up in almost every incident – and there is no blanket answer.

  • RFC 3227 advises not to shut down until evidence collection is complete, while warning that disconnecting from the network can trigger "deadman switches" that destroy evidence.[1]
  • NIST SP 800-86 describes the trade-off: a graceful shutdown can trigger clean-up routines and the removal of malicious material, whereas cutting power preserves swap and temporary files but can corrupt open files.[2]
  • CISA points out that powering down destroys infection artefacts and evidence held in volatile memory, and recommends it only if disconnecting from the network is not possible.[3]

What to preserve

Memory (RAM)

CISA recommends taking a system image and memory capture from a sample of affected devices – workstations, servers, virtual servers and cloud servers.[3] For memory capture, RFC 3227 applies: do not trust the programs on the compromised system, but run tools from appropriately protected media.[1] Memory images are written to an external, clean destination, never to the affected system itself.

For virtual machines, memory state can sometimes be captured via the hypervisor depending on the platform. Whether this is forensically sound in a given case depends on the platform and its state and should be agreed with specialists.

Disks

Disks are captured as a full bit-stream image, not as a simple file copy. NIST SP 800-86 describes write-blockers – hardware or software that prevents writes to the source media – and recommends testing them routinely.[2] Examination is then performed only on the copy, never on the original.[2]

Logs

Logs are often the only way to reconstruct the timeline. CISA explicitly lists data that is highly volatile or has limited retention – such as Windows Security logs and firewall log buffers – as a priority to preserve.[3] Typical sources:

  • Windows event logs (Security, System, PowerShell, RDP-related logs) from domain controllers and affected servers
  • Firewall, proxy, VPN and DNS logs
  • EDR or antivirus telemetry
  • Hypervisor, storage and backup software logs
  • Authentication and audit logs from cloud and SaaS services

The European Data Protection Board (EDPB) notes that sophisticated malware can edit log files and remove traces. It therefore recommends forwarding logs to a central log server, ideally with signing or cryptographic time-stamping of log entries.[5]

Cloud logs: the clock is ticking

In cloud services, licensing determines how long logs are kept. Two examples from the Microsoft ecosystem:

LogDefault retentionSource
Microsoft Entra ID – audit and sign-in logs7 days (Free), 30 days (P1/P2)[6]
Microsoft Purview Audit (Standard)180 days (for records generated from 17 October 2023)[7]
Microsoft Purview Audit (Premium)1 year for Exchange, SharePoint, OneDrive and Entra records with an appropriate E5 licence[7]

Microsoft makes clear that retention changes are not retroactive: data that has already expired cannot be recovered unless it was archived beforehand.[6] For longer retention, Entra logs can be routed to a storage account via Azure Monitor, for example.[6] During an incident, cloud logs should therefore be exported early – not only once the analysis asks for them.

Integrity: hashing and documentation

Hash values

According to NIST SP 800-86, the integrity of collected data is demonstrated with message digests (hashes): hash the original before imaging, hash the copy afterwards and compare, then hash the original again to show the imaging did not alter it – and document everything.[2] The publication dates from 2006 and names MD5 and SHA-1; today, practitioners typically use SHA-2 family algorithms such as SHA-256. Hashes should be calculated for all collected data, including log exports.[2]

Time

RFC 3227 recommends recording the difference between the system clock and UTC, stating for each timestamp whether it is UTC or local time, and recording the extent of clock drift.[1] In ransomware incidents spanning many systems, cloud services and time zones, this is the foundation of a reliable timeline.

Chain of custody

According to RFC 3227, the chain of custody records where, when and by whom evidence was discovered and collected, where, when and by whom it was handled or examined, who had custody during which period, how it was stored and when and how custody changed hands.[1] NIST SP 800-86 adds: a log of every person who had physical custody, including their actions and the times, secure storage, examination only of copies and verification of the integrity of both original and copy.[2]

A simple template is often enough:

FieldExample content
Evidence IDSequential number
DescriptionDevice/disk with model and serial number, log export with source
Location, date, time (with time zone)–
Collected byName, role
Method and toolImage, memory capture, export
Hash value(s)Algorithm and value
Storage locationLocked cabinet, encrypted storage
TransfersFrom, to, date, time, purpose

What administrators should not do

Much evidence is lost not to attackers but to well-intentioned quick fixes. The following rules follow from RFC 3227, NIST SP 800-86 and CISA:

  • Do not shut down or reboot prematurely before volatile data has been captured.[1][3]
  • Do not use tools from the affected system to collect evidence; use trusted tools from protected media.[1]
  • Do not run programs that change access times on masses of files, such as large-scale copying with built-in tools.[1]
  • No antivirus scans, clean-up scripts or reinstallations on affected systems before preservation – they overwrite files, timestamps and logs.
  • Do not work on the original: analyse copies only.[2]
  • Do not delete logs or let them rotate; check retention periods and trigger exports.[3][6]
  • Do not reinitialise affected disks, format them or rebuild RAID arrays.
  • Do not contact the attackers or visit ransom portals without coordinating with the incident response team.
  • Do not use compromised channels for crisis communication: attackers may be reading email and chat.

Coordinating preservation and recovery

Evidence preservation and recovery compete for the same systems. A pragmatic sequence:

  1. Isolate rather than wipe: disconnect affected systems from the network and document their state.
  2. Volatile first: memory from a representative sample, active connections, sessions.[2][3]
  3. Secure logs: local and central logs; export cloud logs before retention runs out.[3][6]
  4. Disk images of key systems (for example patient zero, domain controllers, backup servers), with hash values.[2]
  5. Only then clean up and restore – based on the forensic findings. See Backups after Ransomware.

NIST SP 800-61 Rev. 3 places incident response within overall cybersecurity risk management under the NIST Cybersecurity Framework 2.0.[4] Forensic readiness therefore belongs in preparation: defined responsibilities, prepared tools, enough storage for images and extended log retention.

The preserved evidence is also the basis for determining whether data was exfiltrated – see How to Detect Data Exfiltration – and for the GDPR assessment covered in Ransomware and Personal Data Breaches.

Checklist: initial forensic preservation

  • Decision on court-grade evidence handling made and documented
  • Person responsible for evidence handling and chain of custody appointed
  • Affected systems isolated; time and method documented
  • Memory captured from a sample of affected systems
  • Network connections, sessions and processes recorded
  • Local and central logs preserved; rotation stopped or retention extended
  • Cloud and SaaS logs exported (retention checked)
  • Disk images of key systems created; hash values documented
  • Time zones and clock drift recorded
  • Evidence stored securely; transfers logged
  • Recovery only after approval by the incident response team

Which route fits your situation?

Frequently asked questions

Why is forensic preservation needed after an attack?

Without preserved evidence it is hard to establish the attack path, the time of initial compromise, the affected accounts and whether data was exfiltrated. Those answers are needed for a safe recovery, for assessing notification obligations, for insurers and, where relevant, for law enforcement.

Should I switch off an infected machine immediately?

Not by reflex. Powering off destroys memory and the evidence it holds. In many cases it is better to isolate the system from the network and capture memory first. If encryption is actively running and cannot be stopped any other way, shutting down may be the better option. Make the decision deliberately and document it.

What does order of volatility mean?

The order of volatility describes which data should be collected first because it is lost most quickly. According to RFC 3227, registers and cache come first, followed by the routing table, ARP cache, process table, kernel statistics and memory, then temporary file systems, disks, remote logs, physical configuration and finally archival media.

What are hash values used for in evidence preservation?

A hash value is a digital fingerprint of a file or disk. Calculating it when the evidence is captured and verifying it later demonstrates that the copy is identical to the original and has not been altered since. This is essential for the evidential value.

What is a chain of custody?

The chain of custody is a complete record of who collected, transferred, stored and examined an item of evidence, when, where and how. Its purpose is to rule out allegations that evidence was tampered with or mishandled.

How long are cloud logs available?

That depends on the service and licence. Microsoft Entra ID keeps sign-in and audit logs for seven days on the free tier and 30 days with P1 or P2. Expired logs cannot be recovered retroactively, so they should be exported early.

Can administrators preserve evidence themselves?

Yes, if they are prepared and document their work. Internal admins are often fastest at securing logs and isolating systems. The problems are unplanned actions such as antivirus scans, clean-up scripts or reinstallations on affected systems. For memory and disk images, experienced forensic support is advisable.

Related ransomware profiles

Read next

Sources and further reading

  1. [1]IETF RFC 3227 – Guidelines for Evidence Collection and Archiving rfc-editor.org
  2. [2]NIST SP 800-86 – Guide to Integrating Forensic Techniques into Incident Response csrc.nist.gov
  3. [3]CISA – #StopRansomware Guide cisa.gov
  4. [4]NIST SP 800-61 Rev. 3 – Incident Response Recommendations and Considerations for Cybersecurity Risk Management csrc.nist.gov
  5. [5]EDPB – Guidelines 01/2021 on Examples regarding Personal Data Breach Notification edpb.europa.eu
  6. [6]Microsoft Learn – Microsoft Entra data retention learn.microsoft.com
  7. [7]Microsoft Learn – Manage audit log retention policies (Microsoft Purview) learn.microsoft.com