Blog/How-to guides

How to Preserve Evidence Before You Clean Up an Incident

Containment destroys evidence unless you sequence it. What to capture first, how to hash and log it, and the cloud records that expire while you are still deciding.

CyberWatch AI28 November 2026 · 8 min read
A closed laptop on a desk beside a labelled cardboard box and a clipboard

The inbox rule was named with a single full stop. It moved anything containing the words invoice, remittance or payment into RSS Subscriptions and forwarded a copy to an address at a free mail provider. Deleting it took four seconds, and it was the only artifact that showed how long the attacker had been reading the finance mailbox. The creation timestamp went with it.

That is the characteristic shape of evidence loss in a small incident. Nobody decides to destroy anything. Someone competent fixes the problem quickly, because fixing problems quickly is the job, and three weeks later the insurer asks when unauthorized access began and the honest answer is that nobody knows.

Containment and preservation are not actually in conflict. They only look that way because the fastest route to containment usually runs straight through the evidence. Sequencing them properly costs under an hour.

Step 1: Start a log before you start fixing

Open one document. Give one named person responsibility for it, and make clear that this person is not also the person doing the technical work, because nobody records their own actions accurately while performing them.

Every entry needs four things: timestamp in UTC, who, what they did or observed, and on which system. Include the dull entries. "09:14 UTC, J. Mensah, phoned user on mobile, user confirms she did not sign in from Lisbon" is evidence. So is "09:22 UTC, M. Boateng, disabled account, Entra admin center". Use UTC because every log you will later compare against does, and mixed local timestamps are how timelines go wrong.

NIST's incident response recommendations treat this record as part of the response rather than administration after it, and the practical reason is simple: it is the only artifact you cannot recover later.

Step 2: Settle the legal and insurance position in the first hour

Three questions, asked before anyone images a disk or reinstalls anything:

  • Does your cyber insurance require notification, and on what clock? Many policies also require that their appointed forensic provider does the investigation. Remediating first can affect what the policy covers, which makes this a commercial decision rather than a technical one.
  • Is there a regulatory clock running? Personal data breaches carry statutory notification deadlines in most jurisdictions, and the deadline usually starts when you became aware, not when you finished investigating.
  • Could this end in a police report, a claim or a dismissal? If yes, the standard of record-keeping rises, and the chain of custody in step seven stops being optional.

Who you tell, and in what order, is covered in our article on reporting a cyber incident as a business.

Step 3: Collect in order of volatility

RFC 3227 set out the principle decades ago and it still holds: collect the most perishable data first. Working from most to least volatile, that is processor registers and cache, then memory, network connections, running processes and logged-on sessions, then temporary file systems, then disk, then remote logging and monitoring data, then physical configuration and archived media.

Cloud incidents need one amendment. Add retention to the calculation. A sign-in log that expires in seven days under your licensing is more volatile than any hard disk in the building, even though it lives in a data center. In practice that moves log export much higher up the list than the original ordering suggests.

Step 4: Endpoints, and the four things not to do

For a machine you believe is compromised or encrypted:

  • Do not power it off. Memory contains the running processes, the network connections, injected code and occasionally keys. CISA's ransomware guidance is explicit about preserving rather than shutting down where you can.
  • Do not reboot. It achieves the same loss with extra steps.
  • Do not reimage until someone with authority has decided no image is needed. This is the single most common irreversible mistake in small incidents.
  • Do not log in as a domain administrator to investigate. You will add fresh credentials to a machine that may be harvesting them.

What to do instead: isolate it from the network. Unplug the cable and disable the wireless adapter, or use your endpoint product's network containment feature, which keeps your management channel while cutting everything else. Then photograph the screen, including any ransom note in full, and record the exact time.

If you have memory capture tooling and someone competent to use it, capture memory before anything else. If you do not, do not improvise with unfamiliar tools on a live system. Leave the machine powered on and isolated, write down its asset tag and location, and let the specialists arrive to a scene rather than a cleanup.

One Windows-specific trap: if the disk is encrypted with BitLocker, removing it and imaging it elsewhere is pointless without the recovery key. Retrieve and record the recovery key and its key identifier while you still have working access to the directory it is escrowed in.

Step 5: Image, hash, and record the hash

When a disk is collected, take a forensic image rather than copying files out of it. A file copy loses deleted content, slack space, timestamps and the file system structures that establish sequence.

Hash everything at the point of collection, including individual artifacts like an exported mailbox or a captured malware sample. On Windows, nothing extra needs installing:

  • Get-FileHash -Algorithm SHA256 D:\evidence\case1042-image.e01
  • certutil -hashfile D:\evidence\case1042-image.e01 SHA256

Write the value into your log beside the item. Hash again after any copy or transfer and confirm it matches. That one habit is the difference between an artifact and an assertion.

Step 6: Save the cloud records, because they are on a timer

This is the part small organizations lose most often, and it is the part that costs nothing to protect if done on day one.

  1. Export the sign-in and audit logs to files immediately. Do not plan to come back to the portal next week. In Exchange Online PowerShell, page through the unified audit log with a fixed session identifier and write the output to disk: Search-UnifiedAuditLog -StartDate "2026-11-10 00:00:00z" -EndDate "2026-11-18 00:00:00z" -SessionId "case1042" -SessionCommand ReturnLargeSet -Formatted, repeated until it returns nothing, with the results exported to CSV or JSON. Add -HighCompleteness when completeness matters more than speed, which in an investigation it does.
  2. Check your audit retention before you rely on it. Retention differs by audit tier and by record type, and longer retention needs a configured policy. Confirm what you actually have rather than what you assume.
  3. Put mailboxes on hold before you purge anything. A hold preserves content even if a user or an attacker deletes it. You can apply litigation hold on a mailbox with Set-Mailbox and the -LitigationHoldEnabled parameter, or create an eDiscovery hold in a case for a defined set of locations. Do this before you hard delete a phishing message from every mailbox, not after.
  4. Disable accounts, do not delete them. Deleting takes the sign-in history, registered authentication methods, consented applications and mailbox out of easy reach, and after the recycle period the object is gone entirely. Disable and revoke sessions instead; that contains just as effectively, which is why Microsoft's own compromised-account guidance prefers it.
  5. Keep the original messages. Export the .eml or .msg files and record each Network Message ID. Once a message has been hard deleted tenant-wide, it is not coming back for you to look at again.
  6. Snapshot rather than rebuild. For virtual machines, take and retain a snapshot before remediation. For a compromised web host, keep the logs and a copy of the webroot before you redeploy.

Step 7: Chain of custody, in one table

You do not need forensic software for this. A table with six columns does the job: item description, unique identifier, collected by, collected at in UTC, SHA-256 hash, and current location. Add a row every time an item moves between people, with who handed it over, who received it, and when.

Storage rules that matter more than the format:

  • Store evidence somewhere the affected environment cannot reach. An encrypted estate is a poor place to keep the proof of how it got encrypted.
  • Encrypt the storage and restrict access to the named people handling the case.
  • Keep physical items in a locked drawer or cabinet with a signed log, not on a desk.
  • Set a review date for deletion, so the evidence store does not become a permanent secondary copy of your most sensitive data.

Step 8: Collect the human evidence while it is fresh

Within the first day, get short written statements from everyone directly involved. What did you see, what did you click, what time, what did the caller say, what number did they call from, what did you do next. Memory for sequence degrades within hours, and a statement taken on day one is worth more than a careful interview on day ten.

Take screenshots of the relevant messages on phones, including the full sender address and the timestamp, and keep the originals on the device rather than only the screenshots. For anything financial, capture the payment reference, the beneficiary details as entered, and the time of the transfer, because the bank's recall process runs on those. The consumer-side version of this, which is worth sending to an affected individual, is our guide to preserving evidence after a scam.

Keep the tone of these conversations neutral. People who feel blamed remember less and say less, and you need their recollection more than you need their contrition. The same principle runs through running a post-incident review without blaming people.

Need to check a message that is part of the incident? Paste the message or link into CyberWatch AI Scan for a free check.

Step 9: Now clean up

With the log started, the legal position settled, the volatile data captured, the cloud records exported and the holds applied, remediation is unconstrained. Remove the inbox rules, purge the messages, reset the credentials, rebuild the machine, restore from a clean backup. Record each action with its timestamp as you go, and keep the record of what the attacker's configuration looked like before you changed it, since that description is often the most useful thing in the final report.

Two things to prepare now rather than during the next incident. Decide in advance who has the authority to say "do not reimage that", because in the moment it will be contested by someone who wants the user working again. And write the evidence steps into your plan as a named stage, so they are not dependent on whoever happens to pick up the phone; our walkthrough for creating an incident response plan and the broader incident response guide both cover where that stage belongs. If the incident is ransomware, read this alongside protecting against ransomware, where the preservation decision and the restore decision collide most often. And once the account side of it opens up, the sequence in investigating a suspicious login alert is written to keep the evidence intact while you contain.

Frequently asked questions

Should I shut down an infected computer?

No. Shutting down destroys the contents of memory, which is where running processes, network connections, injected code and sometimes encryption keys live. Disconnect it from the network instead, or isolate it through your endpoint product, and leave it powered on until someone has decided whether a memory capture is wanted.

Can I contain the incident and preserve evidence at the same time?

Almost always, if you sequence it. Network isolation, revoking sessions, disabling accounts and blocking a sender all stop the attack without deleting the record of it. The actions that destroy evidence are reimaging, powering off, deleting accounts, hard deleting mail and clearing logs, and those can wait a few hours.

What is the order of volatility?

The principle, set out in RFC 3227, that you collect the most perishable data first: processor and cache state, then memory, network connections and running processes, then temporary file systems, then disk, then remote logs and archived media. In cloud incidents, add log retention to the calculation, because a record that expires in seven days is more volatile than a hard disk.

Why does deleting the compromised account make things worse?

Because much of what you need is attached to the account object: its sign-in history, registered authentication methods, consented applications and mailbox. Disable it instead. If a mailbox needs to be preserved beyond the account's life, put it on hold before anything is deleted.

How do I prove a file has not changed since I collected it?

Hash it at the moment of collection and record the value in your log. On Windows, Get-FileHash -Algorithm SHA256 or certutil -hashfile with SHA256 both work with no extra tooling. Hash again after any copy or transfer and confirm the values match.

What is a chain of custody record and do we need one?

A table showing, for each item, what it is, who collected it, when in UTC, its hash, where it is stored, and every person who has held it since. You need one whenever the incident might involve an insurance claim, a regulator, a police report or a dismissal. Keeping one costs minutes and is impossible to reconstruct later.

Our cyber insurance is involved. Does that change anything?

Usually yes, and check it in the first hour. Many policies require notification within a set window and require that their appointed forensic firm handles the investigation. Imaging, reinstalling or even remediating before they engage can affect what the policy pays, so read the notification clause before you touch the affected systems.

What if we have already reimaged the machine?

Say so in the record, plainly, with the time it happened and who did it. Then collect what remains: cloud and identity logs, email records, firewall and DNS logs, backups taken before the event, and written statements from the people involved. An honest gap is manageable. A reconstructed narrative presented as evidence is not.

How long should we keep what we collect?

Longer than the incident. Keep it until the claim, report or disciplinary process is finished, and set an explicit deletion date rather than keeping it forever by accident. Store it offline or in storage the affected environment cannot reach, encrypted, with access restricted to the people handling the case.

Sources

  1. RFC 3227: Guidelines for Evidence Collection and Archiving, IETF
  2. SP 800-86, Guide to Integrating Forensic Techniques into Incident Response, NIST
  3. SP 800-61 Rev. 3, Incident Response Recommendations and Considerations for Cybersecurity Risk Management, NIST
  4. I've Been Hit By Ransomware!, CISA
  5. Get-FileHash (Microsoft.PowerShell.Utility), Microsoft Learn
  6. Search-UnifiedAuditLog (ExchangePowerShell), Microsoft Learn
  7. Manage audit log retention policies, Microsoft Learn
  8. Create eDiscovery holds in an eDiscovery case, Microsoft Learn
  9. Set-Mailbox (ExchangePowerShell), Microsoft Learn
  10. Respond to a compromised email account in Microsoft 365, Microsoft Learn
Share this article
LinkedIn WhatsApp X
For organizations

Your people get these messages at work too.

CyberWatch AI sends your staff realistic practice attacks, trains the gaps it finds, and shows management exactly where the organization stands.