Defensive methodology
Forensics (DFIR)
Collecting and analysing the traces left on a machine to answer three questions: how the attacker got in, what they did, and what they took. With one golden rule: never alter the evidence.
DefensiveVolatilityKAPEEric Zimmerman's tools
Principles
- Integrity: work on a copy, never on the original; compute the hash before and after.
- Chain of custody: record who handled the evidence, when and why.
- Reproducibility: document every tool, every version, every command.
Order of volatility
Collect what disappears fastest first (RFC 3227).
- CPU registers and cache
- Memory: processes, network connections, ARP table, decrypted content
- Temporary files and swap
- Disk
- Remote logs and monitoring data
- Backups and archives
Memory analysis with Volatility 3
vol -f mem.raw windows.info vol -f mem.raw windows.pslist vol -f mem.raw windows.pstree vol -f mem.raw windows.cmdline vol -f mem.raw windows.netscan vol -f mem.raw windows.malfind
What to look forA process with the wrong parent or the wrong path, an almost-correct name (
scvhost.exe), outbound connections, injected executable memory regions (malfind).Windows artefacts
| Artefact | What it reveals |
|---|---|
| Prefetch | Programs executed, run count and run times. |
| Amcache / Shimcache | Evidence that binaries were present or executed, with hashes (Amcache). |
| UserAssist, RecentDocs | Programs launched and files opened by a user. |
| ShellBags | Folders browsed in Explorer, even if since deleted. |
| LNK and Jump Lists | Recently opened files, including on removable media. |
| $MFT, $UsnJrnl | File creation, modification and deletion on NTFS. |
| SRUM | Network usage per application: useful for exfiltration. |
| Run keys, services, tasks | Persistence mechanisms. |
| .evtx logs | See the Windows logs page. |
Linux artefacts
/var/log/auth.logor/var/log/secure: logons, sudo, SSH.~/.bash_history: commands typed (unless wiped)./etc/crontab,/etc/cron.*, systemd timers: persistence.~/.ssh/authorized_keys: added keys./etc/passwd,/etc/shadow: accounts created or modified./tmp,/dev/shm: temporary file drops.
Building the timeline
- CollectKAPE or Velociraptor to gather the key artefacts.
- ParseEric Zimmerman's tools (MFTECmd, PECmd, EvtxECmd…).
- MergeA single timeline (Timeline Explorer, Plaso).
- PivotStart from the suspicious time and look around it.
Collection checklist
- Photograph / note the machine's state and system time
- Capture memory
- Collect volatile artefacts (connections, processes) if memory capture is impossible
- Take a disk image or a targeted collection
- Compute the hash of every collected item
- Fill in the chain-of-custody form
- Store the evidence safely, read-only