Chain of Custody and Evidence Integrity
Six months after an incident, the company's lawyer asks a simple question: "Can you show that the disk image your report is based on is an exact copy of the laptop's disk, and that nobody changed it since?" The answer must be yes, with documents: who seized the laptop, when, how it was imaged, the hash of the image at the time, every person who handled it since, and a hash check before each analysis. That record is the chain of custody. Without it, the findings may still be true, but they are much easier to challenge, in court, in an insurance claim, in a dispute with a supplier, or in a disciplinary case.
Definitions
- Evidence item: a physical object (laptop, disk, phone, USB stick) or a digital artefact (an image, a memory dump, a log export), each with a unique ID.
- Chain of custody: the chronological record of the seizure, custody, control, transfer, analysis and disposition of an item, showing it was always in the control of a named person or a secure store.
- Forensic image: a bit-for-bit copy of a storage device, including unallocated space. Formats: raw (
dd, a plain byte copy), E01 (EnCase/Expert Witness format, with compression, case metadata and embedded hashes;ewfacquirefrom libewf), AFF4 (an open, extensible format). - Write blocker: hardware (or, less preferred, software) that lets a device be read but never written, so that imaging doesn't change the original (not even an access time or a journal replay).
- Verification hash: the hash of the source computed during acquisition and the hash of the image computed afterwards; equal values show a faithful copy. Record SHA-256 (often MD5 and SHA-1 as well, which older tools and courts expect, never alone).
A chain-of-custody form
Each item gets one form, kept with the item (and a copy in the case file):
| Field | Example |
|---|---|
| Case / item ID | INC-0042 / E-003 |
| Description | Laptop, LabBook 14, serial LB14-55321, asset tag 0815, with charger |
| Seized | 2026-01-15 09:35 UTC, desk 4.12, by J. Tran (IR), in presence of the user |
| Condition | Powered on, locked; network cable removed 09:33 UTC; memory captured 09:42 UTC (item E-004) |
| Image | E-003-img.E01, SHA-256 9f2c…41ab, write blocker WB-2 (serial …), tool and version, 10:02–11:32 UTC |
| Storage | Evidence locker 2, bag 7781, sealed (seal number S-11903) |
| # | Date/time (UTC) | Released by | Received by | Purpose | Hash verified | Signatures |
|---|---|---|---|---|---|---|
| 1 | 2026-01-15 11:40 | J. Tran | Evidence locker (M. Le) | storage | yes | ✓ ✓ |
| 2 | 2026-01-16 08:05 | M. Le | A. Nguyen (analyst) | analysis copy | yes | ✓ ✓ |
Verifying integrity along the chain
The example keeps a chain for a synthetic evidence image (a 1 MiB byte string standing in for a disk image) and checks it automatically: every transfer must hand over from the person who held the item, and every recorded hash must match the image as it is now. One analyst then "only mounted the image to have a look", without a write blocker, which changed one byte (a journal replay or an access time is enough).
import hashlib, random
image = bytearray(random.Random(3).randbytes(1 << 20)) # stand-in for E-003-img (1 MiB)
acquired_hash = hashlib.sha256(image).hexdigest()
chain = [ # (time UTC, from, to, purpose, sha256 recorded at that moment)
("2026-01-15 11:40", "J. Tran", "Locker (M. Le)", "storage", acquired_hash),
("2026-01-16 08:05", "Locker (M. Le)", "A. Nguyen", "analysis copy", acquired_hash),
]
image[0x4000] ^= 0x01 # mounted read-write "just to look"
chain.append(("2026-01-17 15:20", "A. Nguyen", "B. Pham", "second opinion", hashlib.sha256(image).hexdigest()))
chain.append(("2026-01-18 09:00", "C. Do", "Locker (M. Le)", "return", hashlib.sha256(image).hexdigest()))
def audit(chain, acquired):
holder, ok = chain[0][1], True
for t, frm, to, purpose, h in chain:
problems = []
if frm != holder:
problems.append(f"released by {frm}, but {holder} held it")
if h != acquired:
problems.append("hash differs from acquisition")
print(f"{t} {frm:>15} -> {to:<15} {purpose:<15} {'OK' if not problems else 'BREAK: ' + '; '.join(problems)}")
ok &= not problems
holder = to
return ok
print("acquisition sha256:", acquired_hash[:24] + "…")
print("chain intact:", audit(chain, acquired_hash))acquisition sha256: 30badd5b70d2ef6d62973598…
2026-01-15 11:40 J. Tran -> Locker (M. Le) storage OK
2026-01-16 08:05 Locker (M. Le) -> A. Nguyen analysis copy OK
2026-01-17 15:20 A. Nguyen -> B. Pham second opinion BREAK: hash differs from acquisition
2026-01-18 09:00 C. Do -> Locker (M. Le) return BREAK: released by C. Do, but B. Pham held it; hash differs from acquisition
chain intact: False
Two breaks: from the third entry on, the image no longer matches its acquisition hash, so every finding derived from it after 2026-01-16 is open to challenge; and in the fourth entry the image is returned by someone who never received it. The fix for the first is procedural (analyse only verified working copies, mount read-only, keep the original image untouched); the second shows why forms are signed by both parties at each transfer.
Creating and verifying an image in practice
A lab session (a USB stick from the lab case, attached through a hardware write blocker; device and paths are illustrative):
lab session: imaging through a write blocker (analysis workstation, lab evidence)
$ sudo blockdev --getro /dev/sdb # 1 = read-only, set by the write blocker
1
$ sudo ewfacquire -t /cases/INC-0042/E-005 -C INC-0042 -E E-005 -e "J. Tran" -d sha256 /dev/sdb
...
Acquiry completed at: Jan 15, 2026 14:21:07
Written: 7.4 GiB (8019509248 bytes) in 6 minute(s) and 12 second(s)
MD5 hash calculated over data: 5d1c…a07e
SHA256 hash calculated over data: b8a1…93fd
$ ewfverify /cases/INC-0042/E-005.E01
...
SHA256 hash stored in file: b8a1…93fd
SHA256 hash calculated over data: b8a1…93fd
ewfverify: SUCCESSWith raw images the same check is sha256sum /dev/sdb (through the blocker) and sha256sum E-005.raw, recorded on the form.
How integrity problems are detected
- Verification before every use: compare the image's hash with the form; a mismatch stops the analysis until explained.
- Audits of the custody log: unbroken holder sequence, both signatures, sealed bag numbers matching.
- Access logs of the evidence store (physical log book, digital storage with immutable audit logs).
How it is done right
- Image through a write blocker; verify; seal and store the original; analyse copies of the image.
- Use E01 or AFF4 when the case may go to court: metadata and hashes travel with the image.
- Write times in UTC, sign each transfer, never leave an item unattended or in an unlocked place.
- For cloud and SaaS evidence (audit logs, mailbox exports), record the export method, the account used, the time and the hash of the export file: the same chain, without a physical object.
Pitfalls
- Mounting an image read-write, or attaching a suspect disk without a blocker: the operating system writes to it (journal replay, access times, thumbnail caches).
- One hash algorithm only, and MD5 at that; record SHA-256.
- Gaps in the log ("left on my desk overnight").
- SSDs and TRIM: an SSD can erase deleted blocks by itself after power-on, even through a write blocker; image promptly and document it.
Practice
1. A colleague asks for "the evidence image" to run a tool that needs write access. What do you give them?
A verified working copy, never the original image: copy, hash the copy, check it matches, record the transfer. Their tool can then change the copy without affecting the evidence.
2. In the example, which finding would the lawyer worry about most, and why?
The hash mismatch from 2026-01-17 on. It shows the analysed data is not the acquired data; any conclusion drawn from it can be challenged, whereas a missing signature can sometimes be explained by other records.
3. Fill in the transfer-log row for returning the laptop to the user after the case closes.
| 3 | <UTC time> | M. Le (locker) | <user's name> | return to owner, case closed (approval: <case manager>) | n/a (physical item) | both signatures |, plus a note that the image E-003-img is retained per the retention policy.
Test yourself
What does a write blocker do?
- Encrypts a disk
- Allows a device to be read but prevents any write to it
- Speeds up imaging
- Deletes malware
Which image format embeds case metadata and hashes in the image file?
- Raw dd
- E01 (Expert Witness)
- ZIP
- ISO
In the example, why does the chain break at the third entry?
- The time is wrong
- The image's hash no longer matches the acquisition hash
- B. Pham is not an analyst
- The purpose is missing
What should analysts work on?
- The original device
- The original image
- Verified copies of the image
- Screenshots