Computer forensics and its uses
Overview of computer forensics: definitions, process steps, evidence handling (chain of custody, imaging, hashing), practical calculations (imaging time and storage), common exam points and pitfalls.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Computer forensics is used by engineers and investigators to discover, collect, preserve and explain digital evidence so it can be used in criminal investigations, internal company incident response and civil litigation. A practising engineer needs to know how to make a forensically sound copy of storage, prove integrity, and document the chain of custody so evidence remains admissible.
Key ideas
Start from first principles and simple definitions: define each term before use.
Computer forensics — the discipline and set of methods for identifying, preserving, collecting, analysing and reporting digital evidence in a way that maintains its integrity and supports its use in legal or administrative proceedings. Use this as the umbrella term for the whole process.
Digital evidence — any information stored or transmitted in binary form that may be relied on in court. This includes files, logs, memory contents, network packets, metadata and configuration artifacts. Once we call data "evidence" we must treat it under the rules for preservation and chain of custody.
Chain of custody — a written, chronological record that shows who had control of the evidence, when, where, and under what conditions. The chain of custody proves continuity of possession and helps show the evidence was not altered.
Forensic image — a bit-for-bit copy of storage media that reproduces every allocated and unallocated sector. The exact phrase "bit-for-bit" means every binary value on the source medium is copied, not just visible files.
Write blocker — a hardware or software device that allows reading of storage media while preventing any write or modification to the source. Always use a write blocker when making a forensic image of physical media; prefer hardware blockers where possible and record the device make/model and serial in your notes.
Hash function (cryptographic) — a deterministic function H that maps a variable-length input (data) to a fixed-length output (digest) such that: (1) it is infeasible to find an input that maps to a given digest (pre-image resistance); (2) it is infeasible to find two different inputs with the same digest (collision resistance); and (3) a small change in input produces a large unpredictable change in digest (avalanche effect). Common examples used in forensics are SHA-256 and SHA-1 (SHA-1 is now considered weak against collisions — do not use for new evidence hashing unless required for compatibility and accompanied by stronger checks).
Integrity verification — after imaging, compute a cryptographic hash of the source and the image. If the hashes match, the image is a faithful copy (under the assumptions of the hash function). Record the hash algorithm, full digest, date/time, and tool used.
Volatile vs non-volatile data — volatile data (for example contents of RAM, running processes, network connections) is lost on power-off; non-volatile data (disk files, persistent logs) remains when power is removed. Live acquisition is required for volatile data; dead acquisition (after shutdown) is sufficient for most non-volatile storage. Also state the order of volatility: CPU registers and caches, routing tables/ARP caches/process tables, RAM, temporary file systems, disk, remote logging, and archival media.
Live acquisition — collecting data from a running system (RAM, running processes, open network connections). This risks modifying the system state; document all changes and prefer trusted tools.
Dead acquisition — collecting data after the system is powered down (or by mounting storage on a separate forensic workstation via write blocker). Dead acquisition avoids modifying volatile state.
Triage and prioritisation — in incident response with many devices, decide which systems to image first based on volatility, relevance, and ease of access.
Admissibility criteria (practical summary) — evidence should be relevant, authentic (identifiable source), preserved with integrity (hashes, write blockers), reliable (widely-accepted tools or validated methods) and documented (chain of custody, tool logs). Specific legal rules vary by jurisdiction; learn local law separately (see other topics: Legal aspects of forensic evidence).
Diagrams to draw in an exam:
- Forensic process flowchart: draw six boxes left-to-right labeled "Identification", "Preservation", "Collection", "Examination", "Analysis", "Reporting". Connect arrows in that order. Under "Preservation" draw a small box attached labeled "write blocker". Under "Collection" draw two arrows down labeled "Live" and "Dead".
- Disk imaging setup: draw a source disk, a write blocker (between source and imaging PC), an imaging workstation, and two outputs: "forensic image file" and "hash value". Label arrows and show that the original is write-protected.
Assumptions to state when answering exam questions: write-blocker usage, hash algorithm chosen and justification, units for storage and transfer rates (define whether you use decimal SI units or binary units), and whether acquisition was live or dead. Also record system time and timezone/NTP status at collection, and state how timestamps are normalised (UTC vs local) in your report.
Formulas
digest = H(data) — digest is the fixed-length output of cryptographic hash function H applied to data. No SI unit (hex string). Use when verifying integrity.
t = S / R — time to transfer or image data. t is time in seconds (s), S is data size in bytes (B), R is transfer rate in bytes per second (B/s). Use for imaging time estimates.
S_total = S_source + S_overhead — total storage required for evidence is source size plus file-system and tool overhead (bytes). Use when planning storage.
H_shannon = -Σ p_i · log2(p_i) — Shannon entropy for a discrete distribution {p_i}. Units: bits per symbol. Use to characterise randomness in data; in forensics, commonly used to detect encrypted or compressed containers; do not claim bits-of-entropy for a specific password from a single observed value.
Unit conversions to state in answers (define which you use):
1 KiB = 1024 B, 1 MiB = 1024 KiB, 1 GiB = 1024 MiB, 1 TiB = 1024 GiB (binary units). If using decimal SI units, 1 kB = 1000 B, 1 MB = 10^6 B, 1 GB = 10^9 B, 1 TB = 10^12 B. Always state which convention you choose.
Worked examples
- Imaging time estimate (numerical)
- Problem: Calculate time to image a 1 TB disk at a sustained transfer rate of 100 MB/s. State assumption: we use decimal MB so 1 TB = 10^12 B and 100 MB/s = 100·10^6 B/s.
- Formula:
t = S / R. - Numbers:
S = 1·10^12 B,R = 100·10^6 B/s. - Calculation:
t = 1·10^12 / (100·10^6) = 10^12 / 10^8 = 10^4 s = 10,000 s. - Convert to hours:
10,000 s / 3600 s/h = 2.777... h ≈ 2.78 h. - Final answer: ≈ 2.78 hours (state assumptions). If instead you use binary units (1 TiB = 2^40 B ≈ 1.0995·10^12 B) and 100 MiB/s (100·2^20 B/s), recompute and state difference.
- Hash verification (short procedure answer)
- Scenario: You make a forensic image and compute SHA-256 on the source and on the image. Suppose the recorded hex digests are identical:
a3f1...on both. - Model answer: State algorithm and exact full digest, show command or tool used, date/time, and that identical digests imply the image is bit-for-bit identical to the source under the preimage/second-preimage and collision resistance assumptions of SHA-256. Conclude the image integrity is verified. If digests differ, list possible causes (imaging error, tampering, wrong source) and next steps (re-image, check hardware, document).
- Chain of custody (theory / model answer)
- Question: Draft an entry for chain of custody when taking a seized laptop.
- Model answer should include: item description (make/model, serial number), date/time seized, location, identity of seizing officer (name, badge), condition on seizure (power state: on/off), actions taken (placed in bag, used a write blocker, imaged on [date/time]), storage location and identifier, signatures and dates for each transfer, reasons for transfer, and unique evidence ID. Provide an example line showing these fields filled.
Common mistakes
- Computing a hash of the wrong file (e.g., hashing the image file copy on the workstation rather than the image file on the secure evidence storage) — always state file path and tool.
- Claiming identical hash proves absolute authenticity without stating hash algorithm assumptions (pre-image/collision resistance) and tool correctness.
- Not recording tool versions, settings or command lines — exam answers should include these for reproducibility.
- Treating volatile data as unimportant; forgetting to collect RAM for live incidents.
For your exam
Kinds of questions and what full answers include:
- Definitions and short notes: define terms (forensic image, chain of custody, volatile data, write blocker) and give one-line examples.
- Process and diagrams: draw the forensic process flowchart and label write blocker and live/dead acquisition. Full marks require correct sequence and clear labels.
- Procedure/stepwise answers: explain step-by-step how to seize and image a laptop (power state, photograph, bag, label, write-block, image, hash, document chain of custody). Include required tools and reasons for each step.
- Numericals: imaging time and storage planning problems. State units and conversion assumptions, show formula
t = S / R, show intermediate steps and final units. - Practical/short lab programs or commands: list common forensic commands you might be expected to remember (for Unix-like systems, examples):
dcflddorddwithconv=sync,noerror,ewfacquire,hashing tools like sha256sum. Explain flags and why used (e.g.,noerrorto continue despite read errors). Always state tool versions in an actual lab. Also know common image formats: raw (dd), E01/EWF (EnCase), and AFF4; note features like embedded metadata, optional compression, and internal checksums/hashes, and be able to justify your choice of format in an answer. - Long answer / model scenario: chain of custody entries, sample report structure (summary, evidence list, methods, findings, conclusions). Full-marks answer is precise, chronological, and cites integrity checks and tools used.
Quick check
- What is a write blocker and why is it used?
- Give the formula to estimate time to image and state units.
- Name two properties of a cryptographic hash function used in forensics.
Answers: 1) A device that prevents writes to a source disk so the original is not modified; used to preserve integrity. 2)
t = S / Rwhere t is seconds, S is bytes, R is bytes/second. 3) Pre-image resistance and collision resistance (also avalanche effect).
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?