Evidence handling & forensics basics
Collect evidence in order of volatility and keep a chain of custody.
By Invicly Tech, , in Cyber Security Fundamentals. About 10 minutes to read.
In short
Digital forensics collects and preserves evidence so conclusions hold up. Volatile data like memory is captured before disk, every item is hashed for integrity, and a chain of custody records who handled what. A timeline ties the artefacts together.
Explained simply
Digital forensics is the careful collection and study of evidence from computers, so that what you conclude is true and can be proven. In incident response it answers questions like: how did they get in, what did they touch, and when?
Some evidence disappears fast. What is in memory (RAM) is gone when a machine powers off, and network connections change by the second. Files on disk last much longer. So you collect in order of volatility: the most fragile evidence first.
Evidence must be provably unchanged. Right after collecting an item, you compute its hash, a kind of digital fingerprint. If even one bit changes later, the hash changes. A chain of custody form records who had each item, when and why.
Finally, you put everything on a timeline: logins, programs run, files changed and network connections, all in UTC and in order. A good timeline turns thousands of scattered clues into a short story you can explain to anyone.
Press Play on a diagram to walk through it one step at a time.
- 1CPU and memory
Most volatile, capture first.
- 2Network state
Connections and caches.
- 3Disk
Files and logs.
- 4Archives and backups
Least volatile.
- Machine still running
- Captures memory and connections
- Changes the system slightly
- Fast answers during an incident
- Machine powered off
- Disk image only, no memory
- Cleanest for court use
- Slower, more complete for disk data
- Who logged in?
- Security 4624 and 4625
- RDP logs
- Entra ID sign-ins
- What ran?
- Prefetch
- Amcache
- Sysmon 1 or 4688
- What files changed?
- $MFT timestamps
- USN journal
- LNK and Jump Lists
- Where did it connect?
- Sysmon 3 and 22
- Firewall and proxy logs
- Memory netscan
In depth
Order of volatility in detail
RFC 3227, the classic guide to evidence collection, lists sources from most to least volatile: CPU registers and cache; then the routing table, ARP cache, process table, kernel statistics and memory; temporary file systems; disk; remote logging and monitoring data; physical configuration and network layout; and finally archival media such as backups.
In practice, on a live Windows or Linux host you capture memory first, then a quick record of running processes and network connections, then either a full disk image or a targeted collection of key files. Every action you take changes the system a little, so run trusted tools from external media or a network share, write output to a different drive, and log each command with its time. In the cloud, snapshot the disk volumes and capture memory before stopping an instance, because stopping it loses RAM.
Capturing memory and disks
Memory capture tools include WinPmem, DumpIt and Magnet RAM Capture on Windows, and AVML or LiME on Linux. A memory image shows what was running: processes, command lines, network connections, injected code and sometimes keys or passwords. Volatility 3 is the standard free tool to analyse it.
For disks you choose between a full image and a triage collection. A full image copies every sector, including deleted data, and can take hours. A triage collection with tools like KAPE or Velociraptor grabs the most useful files (event logs, registry hives, Prefetch, browser history) in minutes, which is often enough to start. Physical drives should be read through a write blocker, a device that prevents any writes. Common image formats are raw (made with dd) and E01, which also stores case notes and hashes inside the file.
- vol -f mem.raw windows.pstree: process tree
- vol -f mem.raw windows.cmdline: command lines
- vol -f mem.raw windows.netscan: network connections
- vol -f mem.raw windows.malfind: possible injected code
Hashing and chain of custody
Hash every evidence item as soon as it is collected, again after each transfer, and before analysis. Use SHA-256. MD5 and SHA-1 have known collision attacks, although many tools still record them alongside SHA-256 for compatibility. Analyse a verified copy and keep the original untouched.
The chain of custody is the paper trail. For each item record: a unique ID, a description (make, model, serial number), the hash, who collected it, when (in UTC), where it was found, and every handover after that: from whom, to whom, when and why. Store evidence in a locked, access-controlled place. If a case could end up with police, a court or a regulator, a gap in this record can make the evidence useless, so involve legal counsel early.
- Responder to Evidence store: Image plus SHA-256, signed in with time1Image plus SHA-256, signed in with time
- Evidence store to Analyst: Working copy signed out, reason noted2Working copy signed out, reason noted
- 3Re-hash: matches the recorded valueAnalyst to Analyst: Re-hash: matches the recorded value
- Analyst to Evidence store: Copy returned, hash checked again4Copy returned, hash checked again
Building a timeline from artefacts
An artefact is any trace a system leaves behind. On Windows, useful ones include event logs, Prefetch files (C:\Windows\Prefetch, which show programs that ran), Amcache, the NTFS Master File Table ($MFT) with created, modified, accessed and changed times, LNK files and Jump Lists (recently opened files), registry key last-write times and browser history. On Linux: auth logs, the journal, wtmp and btmp (read with last and lastb), shell history and file timestamps.
Plaso (log2timeline) parses hundreds of artefact types into one super timeline; Timeline Explorer or a SIEM makes it easy to filter. Start from a pivot point, such as the alert time, and work outwards. Normalise everything to UTC, since some logs use local time. Be alert to timestomping: attackers can fake a file's standard timestamps, but the $FILE_NAME timestamps in the $MFT are much harder to change.
- 1Collect
Logs, $MFT, Prefetch, registry
- 2Parse
Plaso builds one super timeline
- 3Filter
Window around the pivot time
- 4Annotate
Mark attacker steps and ATT&CK IDs
- 5Narrate
Short story of what happened
Learn it in 4 short steps
About 45m each. Track them with a timer in your plan.
- 1Explain order of volatility~45m
- 2Keep a chain of custody record~45m
- 3Hash evidence for integrity~45m
- 4Build a timeline from artefacts~45m
Key points
- Capture the most volatile evidence first.
- Hash evidence so later changes are detectable.
- A chain of custody records every handler.
- A timeline turns artefacts into a narrative.
Key terms
Tap a card to flip it. 0/4 known
Examples
Imaging a USB drive and proving integrity
A USB stick was found plugged into a compromised server. Step 1: identify the device with lsblk. Step 2: make the block device read-only (a hardware write blocker is better if you have one). Step 3: copy every sector to an image file. Step 4: hash both the device and the image; they should match. Step 5: save the hash to a file and record it on the chain of custody form. Before any later analysis, verify the hash again. Note: if the drive has bad sectors, conv=noerror,sync fills them with zeros, so the image hash may not match the device; record that in your notes.
lsblk # find the device, e.g. /dev/sdb
sudo blockdev --setro /dev/sdb
sudo dd if=/dev/sdb of=/cases/2026-014/usb.img bs=4M conv=noerror,sync status=progress
sudo sha256sum /dev/sdb /cases/2026-014/usb.img
sha256sum /cases/2026-014/usb.img > /cases/2026-014/usb.img.sha256
# later, before analysis
sha256sum -c /cases/2026-014/usb.img.sha256First look at a memory image with Volatility 3
You have a RAM capture from a laptop that raised an EDR alert. Step 1: confirm Volatility recognises the image and the Windows version. Step 2: view the process tree and look for odd parents, such as a shell under an Office app. Step 3: print the command line of the suspicious process (PID 4312 here). Step 4: list its network connections. Step 5: check it for injected code. Record each finding with the PID, time and plugin used, so someone else can repeat it.
pip install volatility3
vol -f mem.raw windows.info
vol -f mem.raw windows.pstree
vol -f mem.raw windows.cmdline --pid 4312
vol -f mem.raw windows.netscan | grep -i established
vol -f mem.raw windows.malfind --pid 4312Quick reference
- RFC 3227: collect memory and network state before disk, and disk before backups
- Isolate, do not power off: shutting down destroys memory evidence
- Hash with SHA-256 at collection and after every transfer; analyse copies only
- Chain of custody: item, hash, who, when (UTC), where stored, every handover and why
- Volatility 3 plugins: windows.pstree, windows.cmdline, windows.netscan, windows.malfind
- Windows execution evidence: Prefetch, Amcache, Sysmon 1, Security 4688
- Linux logins: last reads wtmp (sessions), lastb reads btmp (failed logins)
- Plaso (log2timeline) builds one super timeline from many artefact types
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Create a text file, hash it with SHA-256, change one character, and hash it again. Explain what this shows about evidence integrity.
- Exercise 2medium
Write a complete chain of custody entry for a laptop collected from an employee's desk, including one handover to an analyst.
- Exercise 3hard
On a Linux server, build a mini timeline for 08 March 2026 09:00 to 12:00 UTC: successful SSH logins, reboots and files changed under /etc and /usr/local/bin in that window.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Can I just copy files instead of making a full disk image?
- For a fast first look, a targeted triage collection is common and fine. A plain file copy can change access times and misses deleted data, so use proper tools and record what you collected.
- Is MD5 still acceptable for hashing evidence?
- Use SHA-256 as your main hash. MD5 has known collision attacks, so it is only kept alongside SHA-256 for compatibility with older tools and records.
- Do I need forensics if we are going to rebuild the machine anyway?
- Yes, collect first. Without evidence you cannot tell how the attacker got in, what they took or whether other systems are affected, and you may need it for legal or insurance reasons.
- What is the difference between forensics and incident response?
- Incident response manages the whole incident, from detection to recovery. Forensics is one part of it: collecting and analysing evidence carefully enough that the conclusions can be trusted.