Digital Forensics and Evidence Handling
Preserve and analyse digital evidence in a defensible way, from order of volatility and disk imaging to timelines and clear reporting.
By the end, you’ll be able to…
- Apply the order of volatility and decide what evidence to collect first.
- Capture memory and image disks with verified hashes and documented methods.
- Maintain a chain of custody that supports integrity and legal review.
- Analyse file system, browser, email, and memory artefacts into a timeline.
- Write a forensic report that separates observation, inference, and limitation.
01Forensics Is a Chain of Decisions
Digital forensics reconstructs what happened on a system from the traces it left behind. The work supports incident response, fraud investigations, employee misconduct cases, and legal proceedings. The technical method is only half of it. You also need authorisation, a defined scope, respect for privacy, and a clear understanding of who may see the evidence. A forensic analyst who browses unrelated personal files has damaged the case and the organisation's trust.
Four habits keep the work defensible. Preserve the original and work on a copy. Document every action, tool, version, and result. Verify integrity with cryptographic hashes. Keep a chain of custody that shows who handled the evidence, when, where, and why. The ACPO principles express the same idea: do not change the original; if you must, explain why; keep an audit trail; and make sure the person doing the work is competent. These habits matter even in a lab, because they are the difference between a finding and an anecdote.
Order of volatility decides what to collect first. Registers and CPU cache disappear almost instantly. Memory, swap, and pagefiles are next. Network connections, running processes, logged-in users, and open files change by the second. Temporary files, disk contents, remote logs, and backups change more slowly. Capture the most volatile evidence first when it is safe to do so, but never let a checklist override safety or containment. A ransomware event may require isolating the host before a perfect memory capture. Document the trade-off.
02Memory and Volatile Data Capture
Memory contains what disks often do not: running malware, injected code, encryption keys, network connections, command history, and unsaved documents. Capture it before a reboot or shutdown if the investigation needs it. Use a trusted acquisition tool from external media, record the tool name and version, and write the image to a separate evidence drive. LiME and AVML are common Linux options; WinPmem and Magnet RAM Capture are common Windows options. Do not rely on dd if=/dev/mem on modern systems; kernel restrictions make it incomplete and unreliable.
Live collection is a compromise. Every command changes the system a little, so use trusted static binaries, minimise interaction, and record exactly what you ran. Capture the date and time in UTC, hostname, collector identity, running processes, network connections, logged-in users, open files, mounts, and scheduled tasks. Hash the output files and store the hash log with the evidence. On Windows, Get-Process, Get-NetTCPConnection, and Get-CimInstance Win32_Process are useful starting points. On Linux, ps, ss, who, lsof, and mount are familiar and relatively low-impact.
Analysis is where memory becomes a story. Volatility 3 can list processes, show process trees, recover command lines, inspect network connections, and look for injected code. The exact plugin names depend on the operating system and the image. Start with process and network views, then move to malware-specific plugins. Memory is noisy: legitimate software can look suspicious, and a missing plugin or a mismatched symbol table can produce empty results. Correlate memory findings with disk artefacts and logs before drawing a conclusion.
# Lab VM only. Write outputs to an external evidence volume.date -u | tee collection-time.txthostname | tee -a collection-time.txtwhoami | tee -a collection-time.txtps auxww > processes.txtss -tunap > connections.txt 2>&1who > users.txtsudo lsof -nP > open-files.txt 2>&1mount > mounts.txtsha256sum processes.txt connections.txt users.txt open-files.txt \ mounts.txt | tee volatile-sha256.txt# Memory acquisition examples. Use a trusted, pre-installed tool.# sudo avml /evidence/memory.lime# Windows: winpmem_mini_x64.exe C:\evidence\memory.raw# Analyse a memory image with Volatility 3.vol -f /evidence/memory.raw windows.pslistvol -f /evidence/memory.raw windows.netscanvol -f /evidence/memory.raw windows.malfind2026-11-01T11:42:03+00:00 web01 analyst wrote processes.txt (218 lines) wrote connections.txt (34 lines) wrote volatile-sha256.txt
03Disk Imaging, Hashing, and Chain of Custody
Disk imaging captures the entire storage device, including deleted files, slack space, and unallocated areas that a file copy would miss. Use a hardware write blocker when possible. A software read-only flag is useful defence in depth but is not a substitute for a physical blocker. Identify the device carefully with lsblk, blkid, and the serial number. Imaging the wrong disk is a serious incident. Record the device model, serial, capacity, and connection type before you begin.
dd is the classic imaging tool. dcfldd adds hashing and progress reporting. A typical command reads the source device, writes an image file, and computes a SHA-256 hash while it works. Hash the image again afterwards and compare the values. If the tool supports it, create an E01 image with ewfacquire for compression and embedded integrity metadata. Whatever format you choose, store the image, the hash log, and the acquisition notes together, encrypt the evidence drive, and restrict access.
Chain of custody is a chronological record of the evidence. At minimum, record a case identifier, the item and its serial number, where it was found, who collected it, the date and time, the acquisition tool and version, the hash algorithm and value, the storage location, and every transfer with signatures. Use tamper-evident packaging, a locked evidence store, and an access log. Verify the hash before each analysis session. If the evidence may go to court, follow your legal team's requirements and be prepared to explain every step.
# Lab only. Identify the device and confirm it is the right one.lsblk -o NAME,SIZE,RO,MODEL,SERIALsudo blockdev --setro /dev/sdb# Preferred: use a hardware write blocker in front of the disk.# Software read-only is a backup control, not a replacement.sudo dcfldd if=/dev/sdb of=/evidence/case-042/disk.img bs=4M \ hash=sha256 hashlog=/evidence/case-042/disk.sha256sha256sum /evidence/case-042/disk.img | tee -a /evidence/case-042/disk.sha256# Alternative with dd, then hash both the source and the image.sudo dd if=/dev/sdb of=/evidence/case-042/disk.img bs=4M \ conv=noerror,sync status=progresssha256sum /dev/sdb /evidence/case-042/disk.img# E01 imaging example (tool must be installed in the lab).# ewfacquire -t /evidence/case-042/disk /dev/sdbNAME SIZE RO MODEL SERIAL sdb 32G 0 Lab USB Storage LAB-2026-0042 records in: 67108864, records out: 67108864 sha256: 4b1e... /evidence/case-042/disk.img
04Artefacts, Timeline, and Reporting
File system artefacts answer questions about creation, modification, access, and deletion. NTFS stores metadata in the Master File Table; ext4 uses inodes. Tools such as The Sleuth Kit can list files, recover deleted content, and show file system statistics. Autopsy provides a graphical layer over the same ideas. Timestamps are powerful but not infallible: time zones, clock drift, and deliberate timestomping can mislead. Record the source and confidence of every timestamp you use.
Browsers and email clients hold a surprising amount of context. Browser history, downloads, cookies, cache, and bookmarks can show what a user visited and when. Email headers, attachments, and mailbox files can show delivery paths and social-engineering content. Operating-system artefacts add persistence and execution evidence: Windows event logs, registry hives, Prefetch, Amcache, Shimcache, and SRUM; Linux authentication logs, systemd journal, shell history, and cron. Cloud audit logs complete the picture when the activity happened outside the endpoint.
A timeline turns isolated artefacts into a narrative. Normalise every event to UTC, include the source and a confidence note, and mark gaps. Plaso and Timesketch can build and explore large timelines; Autopsy and Volatility add specialised views. Test alternative explanations. A login at 02:00 may be an attacker or a scheduled backup. The report should state the scope, authorisation, methodology, evidence inventory, findings, timeline, limitations, and conclusion. Have a peer review the work, redact personal data where required, and retain the evidence according to policy.
# File system listing and deleted-file recovery (lab image).fls -r -p /evidence/case-042/disk.img | head -40fsstat /evidence/case-042/disk.img | head -40icat /evidence/case-042/disk.img 12345 > recovered.bin# Memory analysis: processes and network connections.vol -f /evidence/case-042/memory.raw windows.pslistvol -f /evidence/case-042/memory.raw windows.netscan# Browser history is often a SQLite database. Work on a copy.# sqlite3 History "select datetime(last_visit_time/1000000-11644473600,'unixepoch'), url from urls order by last_visit_time desc limit 20;"d/d 5: Users r/r 12345: Users/student/Downloads/invoice.pdf.exe r/r 12346: Users/student/AppData/Local/Temp/update.bin Volatility 3: 42 processes, 7 network connections
The ideas worth keeping.
- Preserve the original, work on a copy, verify hashes, and document every action.
- Collect volatile evidence first when it is safe, but let safety and containment override a rigid checklist.
- Use write blockers, full-device imaging, and a chain of custody to protect integrity.
- A timeline and a report must distinguish observation from inference and state their limitations.
Make it yours.
Type and test your code right here in the interactive workspace. Run your solution, check the output, and compare with the worked guide when ready.
Exercise 1: Collect under pressure
A lab VM is showing ransomware notes and files are being encrypted. The disk is still accessible and memory may contain the encryption key. List your first five actions in order, explain why, and name one thing you must not do.
Explore a worked solution
1. Isolate the VM from the network without powering it off, if the platform allows, to stop spread and preserve volatile state. 2. Notify the incident lead and record the time, scope, and decision. 3. Capture memory to an external evidence volume, if the process and tooling allow, because it may contain keys and running malware. 4. Collect volatile data such as processes, connections, users, and open files, and hash the outputs. 5. Image the disk with a write blocker or read-only control, hash the image, and document the chain of custody. Do not pull the power or reboot before deciding what volatile evidence you need, because that destroys memory and can interrupt encryption in ways that complicate recovery.Containment and evidence preservation are balanced. Memory is highly volatile, but safety and spread prevention come first. Document every decision.
Exercise 2: Write a chain-of-custody and imaging plan
A USB drive is found in a lab and may contain malware. Write the steps you would take to preserve it, image it, and record custody. Include the commands and the fields on the form.
Explore a worked solution
Photograph the drive and its label, record the location, time, finder, and serial number, and place it in a tamper-evident bag. Do not mount it on a normal workstation. Connect it through a hardware write blocker to an analysis machine, identify it with lsblk, and image it with dcfldd to an encrypted evidence drive, computing a SHA-256 hash. Hash the image again and compare. Record the case ID, item, serial, capacity, collector, date and time, tool and version, hash, storage location, and every transfer with signatures. Work only on the copy. If the drive is evidence in a legal matter, follow counsel's instructions and preserve the original.The plan protects integrity from the moment of seizure through analysis. A hash and a custody log let another examiner verify that the copy is faithful.
What stayed with you?
Check the ideas while they’re fresh. Your answers stay in this page and feedback appears as you go.
Keep exploring.
The official references behind this lesson, when you want a second angle or the full details.
One lesson closer.
Reading is a start. Trying it yourself makes the connection.