PIVTR-D

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

#ItemOwner
1Decide for each host whether to collect before or after isolating, and record it in T3Incident Commander
2Run collection tools from external media or a share, and write output off the hostOperations
3Capture memory from each affected host before a reboot, a shutdown, or an isolation that drops sessionsOperations
4Save the network connections and the process list before isolationOperations
5Forward logs to central storage the attacker cannot reachOperations
6Export cloud and software as a service (SaaS) audit logs before retention deletes themIntelligence/Investigations
7Hash each item with SHA-256 and enter it in the registerIntelligence/Investigations
8Store evidence write-once, with access logging onLogistics
9Confirm legal hold and law enforcement handling for the evidence setLegal advisor

Order of volatility

OrderEvidenceLost when
1Memory: running processes, decrypted credentials, in-memory malware, web shell configuration, active command and control sessionsReboot or power off. Live command and control sessions also end at isolation.
2Live state: network connections, running processes and services with parent-child relationships, temporary files and cachesIsolation, process exit, normal cleanup
3Logs that rotate or can be deleted: security, authentication, application, Domain Name System (DNS), firewall, flow, cloud auditRotation, retention limits, attacker log clearing
4System artifacts: registry hives, event logs, Prefetch, ShimCache, AmCache, browser historyMostly survive restarts and containment
5Disk images of systems with unique evidence: the initial point of compromise, hosts where the attacker deployed custom toolsReimaging 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.

FieldExample
ItemIR-2026-0142-001, memory image of FS01
SourceFS01, 10.20.8.21, Chicago data center
Collected byDana Ruiz
Time (UTC)2026-10-02T07:30:12Z
SHA-2565c417ce1d05901f29f940b7ba42c12d790cc9a2c2695436cd36bb677861c3373
Storage locations3://northgate-ir-evidence/IR-2026-0142/
CustodianDana Ruiz

Collection commands

Run as administrator or root. Replace every highlighted placeholder. Write output to external media or a share.

PlatformTaskCommand
WindowsCapture memory with WinPMEMgo-winpmem_amd64_1.0-rc2_signed.exe acquire --nosparse <case>-<host>.dmp
WindowsCollect triage files with KAPEkape.exe --tsource C: --target KapeTriage --tdest <output-dir>
WindowsCollect triage files with VelociraptorBuild 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.
LinuxCapture memory with LiMELoad a module built for the running kernel: insmod ./lime-$(uname -r).ko "path=<output-file> format=lime"
LinuxCapture memory with AVMLavml acquire <output-file>
Linux, macOSCollect triage files with UAC./uac -p ir_triage <output-dir>
macOSCollect triage files with AftermathGrant Full Disk Access to the terminal first: sudo ./aftermath -o <output-dir>
macOSCollect unified logsName 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 365Export the Unified Audit Log from the portalIn the Purview portal, open Audit, run a search, then export the results to CSV.
Microsoft 365Connect to Exchange Online PowerShellConnect-ExchangeOnline
Microsoft 365Export the Unified Audit Log with PowerShellRepeat 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 IDConnect to Microsoft GraphConnect-MgGraph -Scopes AuditLog.Read.All,Directory.Read.All
Entra IDExport interactive and non-interactive sign-insThe 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 IDExport directory audit logsGet-MgAuditLogDirectoryAudit -All | ConvertTo-Json -Depth 10 > <case>-audit.json
Entra IDDownload sign-in and audit logs from the portalIn the Entra admin center, choose Download on the Sign-in logs and Audit logs pages.
AWSExport CloudTrail event historyRun once for every Region: aws cloudtrail lookup-events --start-time <utc-start> --end-time <utc-end> --region <region> > <case>-<region>.json
AWSSnapshot an EBS volumeaws ec2 create-snapshot --volume-id <volume-id> --description "<case>" --tag-specifications 'ResourceType=snapshot,Tags=[{Key=IR-Case,Value=<case>}]'
AzureExport the Activity LogRun 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
AzureSnapshot a managed diskaz snapshot create -g <resource-group> -n <case>-<disk> --source <disk-name-or-id>
GCPExport Cloud Audit LogsRun once for every project: gcloud logging read 'logName:"cloudaudit.googleapis.com" AND timestamp>="<utc-start>"' --project=<project> --format=json > <case>-audit.json
GCPSnapshot a persistent diskgcloud compute snapshots create <case>-<disk> --source-disk=<disk> --source-disk-zone=<zone>
WindowsHash a fileGet-FileHash -Algorithm SHA256 <file>
LinuxHash a filesha256sum <file>
macOSHash a fileshasum -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

LogDefault retention
Entra ID sign-in and audit logs7 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 history90 days, management events only, per Region
Azure Activity Log90 days
GCP Admin Activity audit logs (_Required bucket)400 days, fixed
GCP Data Access audit logs (_Default bucket), if enabled30 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.

Watch out
  • Command-line interface (CLI) exports stop early by default. az monitor activity-log list returns 50 events unless you set --max-events, and Search-UnifiedAuditLog returns 100 results unless you set -ResultSize. Check the record count before you call an export complete.
  • Each export covers one scope. lookup-events covers one Region per call, the Activity Log one subscription and gcloud logging read one project. Repeat for each.
  • Page Search-UnifiedAuditLog until moreRecordsAvailable in the AuditSearchRequestMetadata output is false. ResultCount is 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.
Adapts material from Dynamic Incident Response: A Framework for Security Teams by Joshua Wright, © 2026 The Escal Institute of Advanced Technologies, Inc. d/b/a SANS Institute, licensed under CC BY 4.0. Figures reproduced under that license. Changes were made. Not published by, endorsed by, or affiliated with the SANS Institute.