Goal. By the end you can preserve evidence in the right order, read the main Windows and Linux traces, capture and inspect memory, triage a suspicious file safely in an isolated virtual machine, and write up what you found.
Why it matters#
Evidence is perishable and mistakes are permanent. A reboot clears memory. "Cleaning" a host overwrites traces. Running an unknown file on your own laptop turns the investigator into the victim. Forensics answers the questions an incident turns on: how they got in, what they touched and whether they are still there. Its habits (copies, hashes, notes) are what make the answers trustworthy.
What you will learn#
Principles#
- Order of volatility. Evidence disappears at different speeds, and RFC 3227 ranks the sources from shortest-lived: processor registers and cache; memory, process and network state; temporary file systems; disk; remote logging; archival media. In practice, capture memory and live activity before you touch the disk.
- Chain of custody. A log that follows each item: who took it, when, where from and by what method, its hash, where it is kept and every later handover. It lets you show nothing was changed, which matters if the case reaches HR, a regulator or a court.
- Work on copies. Hash the original with SHA-256, analyse a copy and keep the original read-only.
- Triage or full image? A triage collection (chosen artefacts plus memory) takes minutes and scales across many hosts. A full disk image takes hours and suits the few hosts that matter. NIST SP 800-86 covers fitting forensics into incident response.
- Be honest about weak evidence. Most artefacts are circumstantial. A file being present is not proof it ran.
Windows traces#
| Trace | It tells you | Caveat |
|---|---|---|
| Security log: logons (4624, 4625), process creation (4688), scheduled task created (4698) | Who logged on from where, what ran, what was scheduled | Needs auditing switched on, and command lines are logged only if enabled |
| System log: service installed (7045) | A new service, a common persistence trick | Logs roll over, and attackers clear them |
| PowerShell script block logging (4104) | The script text that ran | Only if enabled |
| Sysmon, if deployed: process (1), network (3), file creation (11) | Rich process, network and file activity | Only what your configuration records |
| Prefetch, Amcache, Shimcache | A program existed or ran | Shimcache shows presence, not execution. Prefetch is often off on servers |
| NTFS master file table and USN journal | Creation, rename and deletion timeline | The journal wraps. Needs parsing tools |
| Run keys, scheduled tasks, services, WMI subscriptions | Persistence | Autoruns lists many in one view |
| Browser history, shortcut and jump-list files | What the user opened, and from where | Per user, and can be cleared |
Linux traces#
- Authentication:
/var/log/auth.logon Debian-family systems,/var/log/secureon Red Hat-family ones, andjournalctlon systemd hosts. Login records live inwtmpandbtmp(last,lastb). - Shell history:
~/.bash_historyis written when a shell exits, so it is often missing or cleared. - Persistence: cron (
/etc/cron*and user crontabs), systemd units and timers,~/.ssh/authorized_keys, startup scripts. - Running state:
/proc/<pid>/(executable, command line, open files),ps,ss. A process can keep running after its binary is deleted. - Favourite hiding places:
/tmpand/dev/shm. Remember that timestamps can be altered.
Memory#
Running processes, network connections, injected code and decrypted data may exist only in memory. Acquire it with WinPmem on Windows or AVML on Linux, from a trusted copy of the tool, writing to external storage rather than the suspect disk. Hash the result. Expect a file as big as the machine's RAM, and note that acquisition changes the system slightly, so record what you ran.
Analyse with Volatility 3. Useful Windows plugins are windows.pslist (processes), windows.pstree (parent and child), windows.cmdline (command lines), windows.netscan (connections) and windows.malfind (memory regions that look injected). Linux analysis needs symbol tables matching the kernel. Even listing processes and connections often answers the first question.
Cloud services often give you no machine to copy, so the provider's records of who did what are your main evidence. Snapshot volumes, export those records to protected storage and cut off network access instead of terminating. Stage 7 covers containers.
Triage a suspicious file safely#
Safety first. Never open or run an unknown file on your own computer or a work machine. Use an isolated virtual machine with:
- a snapshot you can revert to;
- no network, or a host-only network with nothing valuable on it;
- no shared folders, shared clipboard or drag and drop;
- nothing in it you care about: no real accounts, no password manager.
Then follow the funnel:
- Record and hash. Where it came from, when, and under what name. Take the SHA-256 and size before anything else.
- Identify the type. Use
file, not the extension. - Look without running. Read the strings, and use FLOSS for obfuscated ones. Check headers and imports, and treat high entropy as a hint of packing.
capasummarises capabilities and maps them to ATT&CK. For scripts and documents, read the text and decode it, but never execute it. - Check the hash. Search for the hash. Do not upload files that contain confidential data, because public services may share what you submit.
- Run it only if you must, in the VM, under a sandbox such as CAPE, watching processes, files, registry and network. Some samples detect virtual machines or wait before acting, so "nothing happened" does not mean safe.
- Report. Hashes, behaviour, indicators (domains, addresses, paths), your confidence and what you did not test. Copy ATT&CK technique IDs from the live site.
Get-FileHash .\sample.bin -Algorithm SHA256sha256sum sample.bin; file sample.bin; strings -n 8 sample.bin | head -40What this stage does not ask. It does not ask you to download live malware, and it links to none. Practise on harmless files you create yourself and on published analysis reports. If you later study real samples, do it only in a dedicated isolated lab, following a course that supplies and explains them.
Reporting#
A forensic report has seven parts: a short executive summary that stands alone, a timeline in UTC, scope and impact, root cause, the actions taken with times, evidence and indicators with custody, and recommendations with owners. Keep what you observed apart from what you infer ("the account signed in from a hosting address" versus "this suggests takeover, with medium confidence"), and write in layers so leaders, engineers and Legal can each stop reading when they have what they need.
Do this#
- Leave traces, then find them (3–4 hours). In a Windows lab VM, create a local user, schedule a harmless task, run a script and browse a page. Collect a triage package and find each trace. Write a table of action, artefact and location.
- Capture and read memory (2–3 hours). Acquire memory in the same VM, hash it, and list the processes and connections with Volatility 3. Find your own activity.
- Build a timeline (2 hours). Run Hayabusa or Plaso on the VM's logs and check that the timeline reproduces what you did.
- Triage harmless files (2–3 hours). Make a script holding an encoded string (as in Stage 2) and a text file renamed
.exe. In an isolated VM, follow the funnel. Runcapaand FLOSS on a legitimate tool to see real output. - Practise custody (1 hour). Write a custody log for your memory image and triage package, and verify the hashes after copying.
- Write the report (1–2 hours). One page, using the seven parts above.
Resources#
Free first
- RFC 3227 and NIST SP 800-86 - evidence collection and forensics in incident response. NIST's guide dates from 2006: the principles hold, the tools have moved on.
- Windows Forensic Analysis poster (free account) - a one-page map of where Windows keeps its traces.
- Velociraptor and Eric Zimmerman's tools - free tools to collect and parse artefacts.
- WinPmem, AVML and Volatility 3 - memory capture on Windows and Linux, and analysis.
- Plaso, Timesketch and Hayabusa - timelines from disk artefacts and Windows event logs.
- Tool Analysis Result Sheet - JPCERT/CC's record of the log traces common attacker tools leave.
- FLARE-VM and REMnux - toolkits for building a Windows or Linux analysis VM.
- capa, FLOSS and YARA - capability detection, string extraction and file matching rules.
- CAPE Sandbox - a self-hosted sandbox. Heavier to set up, so optional.
Paid or needs an account
- None needed beyond the free SANS account above.
Checkpoint#
You are ready to move on when you can:
Go deeper (optional)#
- Read the Volatility 3 documentation on plugins, and compare
pslistwithpsscanto see how hidden processes are found. - Read the JPCERT/CC sheet for one tool you know, and write the detection it suggests.
- Threat Hunting stage 5 uses the same endpoint evidence to look for what no alert caught.