Evidence collection
Evidence decays on a clock. Memory is gone at the next reboot, network connections end when a host is isolated, and logs roll off at the provider's default retention.
Collect the most transient data first, record every item as you take it, and move copies off the system before anyone changes it. Collection runs code on a compromised host and changes it, so run tools from external media or a share, write output off the host, and log exactly what you ran.
Chapter 12, pp. 221 to 222 and 242 to 243.
Collection checklist
| # | Item | Owner |
|---|---|---|
| 1 | Decide for each host whether to collect before or after isolating, and record it in T3 | Incident Commander |
| 2 | Run collection tools from external media or a share, and write output off the host | Operations |
| 3 | Capture memory from each affected host before a reboot, a shutdown, or an isolation that drops sessions | Operations |
| 4 | Save the network connections and the process list before isolation | Operations |
| 5 | Forward logs to central storage the attacker cannot reach | Operations |
| 6 | Export cloud and software as a service (SaaS) audit logs before retention deletes them | Intelligence/Investigations |
| 7 | Hash each item with SHA-256 and enter it in the register | Intelligence/Investigations |
| 8 | Store evidence write-once, with access logging on | Logistics |
| 9 | Confirm legal hold and law enforcement handling for the evidence set | Legal advisor |
Order of volatility
| Order | Evidence | Lost when |
|---|---|---|
| 1 | Memory: running processes, decrypted credentials, in-memory malware, web shell configuration, active command and control sessions | Reboot or power off. Live command and control sessions also end at isolation. |
| 2 | Live state: network connections, running processes and services with parent-child relationships, temporary files and caches | Isolation, process exit, normal cleanup |
| 3 | Logs that rotate or can be deleted: security, authentication, application, Domain Name System (DNS), firewall, flow, cloud audit | Rotation, retention limits, attacker log clearing |
| 4 | System artifacts: registry hives, event logs, Prefetch, ShimCache, AmCache, browser history | Mostly survive restarts and containment |
| 5 | Disk images of systems with unique evidence: the initial point of compromise, hosts where the attacker deployed custom tools | Reimaging or rebuild |
Chapter 12, pp. 221 to 222, 242 to 243, and Step 6, pp. 272 to 273.
The book's default is isolate first, then collect, because data taken before containment can be incomplete or tampered with. That works only if something outside the host recorded the connections, such as flow logs, Sysmon network events or network detection and response (NDR).
Without that source, run Get-NetTCPConnection or ss -tanp and capture memory before isolating. The Incident Commander makes this call and records it in T3. See When containment cannot wait.
Chain of custody
Every item goes in the evidence register when it is collected. Every transfer after that adds a line with who handed it over, who received it, when, and why. Hash at collection and again on each transfer.
Tag cloud snapshots with the case number. Store evidence write-once: S3 Object Lock in compliance mode, Azure immutable blob storage, or a Google Cloud Storage retention policy with bucket lock.
Chapter 7, p. 74. Chapter 12, pp. 247 and 274. Chapter 18, pp. 583 to 584.
One register entry has these fields. The example is the first item from the fictional Northgate Supply incident in the Incident Command worked example.
| Field | Example |
|---|---|
| Item | IR-2026-0142-001, memory image of FS01 |
| Source | FS01, 10.20.8.21, Chicago data center |
| Collected by | Dana Ruiz |
| Time (UTC) | 2026-10-02T07:30:12Z |
| SHA-256 | 5c417ce1d05901f29f940b7ba42c12d790cc9a2c2695436cd36bb677861c3373 |
| Storage location | s3://northgate-ir-evidence/IR-2026-0142/ |
| Custodian | Dana Ruiz |
Collection commands
Run as administrator or root. Replace every highlighted placeholder. Write output to external media or a share.
| Platform | Task | Command |
|---|---|---|
| Windows | Capture memory with WinPMEM | go-winpmem_amd64_1.0-rc2_signed.exe acquire --nosparse <case>-<host>.dmp |
| Windows | Collect triage files with KAPE | kape.exe --tsource C: --target KapeTriage --tdest <output-dir> |
| Windows | Collect triage files with Velociraptor | Build an offline collector in the Velociraptor GUI, then run the generated binary as administrator with no arguments. It writes a zip of the results and a log file beside it. |
| Linux | Capture memory with LiME | Load a module built for the running kernel: insmod ./lime-$(uname -r).ko "path=<output-file> format=lime" |
| Linux | Capture memory with AVML | avml acquire <output-file> |
| Linux, macOS | Collect triage files with UAC | ./uac -p ir_triage <output-dir> |
| macOS | Collect triage files with Aftermath | Grant Full Disk Access to the terminal first: sudo ./aftermath -o <output-dir> |
| macOS | Collect unified logs | Name a path on external media, because the archive otherwise lands in the current directory: sudo log collect --output <output-dir>/<host>.logarchive --last <days>d |
| Microsoft 365 | Export the Unified Audit Log from the portal | In the Purview portal, open Audit, run a search, then export the results to CSV. |
| Microsoft 365 | Connect to Exchange Online PowerShell | Connect-ExchangeOnline |
| Microsoft 365 | Export the Unified Audit Log with PowerShell | Repeat with the same SessionId to page through up to 50,000 records: Search-UnifiedAuditLog -StartDate <utc-start> -EndDate <utc-end> -SessionId <case> -SessionCommand ReturnLargeSet -ResultSize 5000 |
| Entra ID | Connect to Microsoft Graph | Connect-MgGraph -Scopes AuditLog.Read.All,Directory.Read.All |
| Entra ID | Export interactive and non-interactive sign-ins | The v1.0 cmdlet returns interactive sign-ins only, so use the beta cmdlet. Add a user filter where scope allows: Get-MgBetaAuditLogSignIn -All -Filter "createdDateTime ge <utc-start> and signInEventTypes/any(t: t eq 'interactiveUser' or t eq 'nonInteractiveUser')" | ConvertTo-Json -Depth 10 > <case>-signins.json |
| Entra ID | Export directory audit logs | Get-MgAuditLogDirectoryAudit -All | ConvertTo-Json -Depth 10 > <case>-audit.json |
| Entra ID | Download sign-in and audit logs from the portal | In the Entra admin center, choose Download on the Sign-in logs and Audit logs pages. |
| AWS | Export CloudTrail event history | Run once for every Region: aws cloudtrail lookup-events --start-time <utc-start> --end-time <utc-end> --region <region> > <case>-<region>.json |
| AWS | Snapshot an EBS volume | aws ec2 create-snapshot --volume-id <volume-id> --description "<case>" --tag-specifications 'ResourceType=snapshot,Tags=[{Key=IR-Case,Value=<case>}]' |
| Azure | Export the Activity Log | Run once for every subscription, with --max-events above the expected count: az monitor activity-log list --start-time <yyyy-mm-dd> --offset <days>d --max-events <n> > <case>-activity.json |
| Azure | Snapshot a managed disk | az snapshot create -g <resource-group> -n <case>-<disk> --source <disk-name-or-id> |
| GCP | Export Cloud Audit Logs | Run once for every project: gcloud logging read 'logName:"cloudaudit.googleapis.com" AND timestamp>="<utc-start>"' --project=<project> --format=json > <case>-audit.json |
| GCP | Snapshot a persistent disk | gcloud compute snapshots create <case>-<disk> --source-disk=<disk> --source-disk-zone=<zone> |
| Windows | Hash a file | Get-FileHash -Algorithm SHA256 <file> |
| Linux | Hash a file | sha256sum <file> |
| macOS | Hash a file | shasum -a 256 <file> |
WinPMEM command from Listing 72, Chapter 13, pp. 298 to 299; memory capture on a 32 GB host finished in under a minute. The book names WinPMEM, Linpmem and LiME on pp. 100, 222 and 242. The other commands follow each tool's README, documentation or vendor command reference, checked October 2026. Tools: go-winpmem source and release notes, KAPE documentation, Velociraptor offline collector documentation, and the LiME, AVML, UAC and Aftermath READMEs. Platforms: the macOS log(1) manual, the Microsoft Search-UnifiedAuditLog and Graph signIn references, and the AWS CloudTrail, Azure CLI and gcloud references.
Retention that forces early export
| Log | Default retention |
|---|---|
| Entra ID sign-in and audit logs | 7 days on Free; 30 days on P1 and P2 |
| Microsoft 365 audit log, Audit (Standard) | 180 days |
| Microsoft 365 audit log, Audit (Premium) | 1 year for Exchange, SharePoint, OneDrive and Entra records; 180 days for other activity. Applies to users with an Office 365 or Microsoft 365 E5 license, a Microsoft Purview Suite license, or the E5 eDiscovery and Audit add-on; other users get 180 days. |
| AWS CloudTrail event history | 90 days, management events only, per Region |
| Azure Activity Log | 90 days |
| GCP Admin Activity audit logs (_Required bucket) | 400 days, fixed |
| GCP Data Access audit logs (_Default bucket), if enabled | 30 days unless the bucket retention was changed |
Vendor documentation, checked October 2026: Microsoft Entra data retention, Microsoft Purview audit log retention policies, the Search-UnifiedAuditLog cmdlet reference, AWS CloudTrail event history, Azure Monitor activity log, Google Cloud Logging storage. Chapter 12, p. 273, says to export cloud audit logs before retention deletes them. Check your tenant's license and settings.
- Command-line interface (CLI) exports stop early by default.
az monitor activity-log listreturns 50 events unless you set--max-events, andSearch-UnifiedAuditLogreturns 100 results unless you set-ResultSize. Check the record count before you call an export complete. - Each export covers one scope.
lookup-eventscovers one Region per call, the Activity Log one subscription andgcloud logging readone project. Repeat for each. - Page
Search-UnifiedAuditLoguntilmoreRecordsAvailablein the AuditSearchRequestMetadata output is false.ResultCountis a running count while the search runs, after message center notice MC1310672 (May 14, 2026). - The memory tool leaves traces in the image. The WinPMEM driver shows up in the driver list of a Windows capture (Chapter 13, p. 300). Record the tool, version and time in the register so analysts can exclude it.
- LiME needs a module compiled for the exact running kernel. Build modules for your standard kernels during preparation, or carry AVML, which needs no on-target compilation. AVML cannot read memory when kernel lockdown is enabled.