Skip to content
Pwnversity
DFIR-CADENAintermediate · 12 min · upd. 2026-11

Chain of custody

ISO/IEC 27037RFC 3227UNE 71506

The chain of custody is the documented record of who has held the evidence, when, where and what they did with it, from collection until it is presented or destroyed. Without it, the best technical evidence can come to nothing: a broken chain lets the other side allege tampering and sink months of investigation. It is the legal glue of all DFIR work, and it starts before the first triage command.

A forensic analysis is only worth something if you can show the evidence is authentic (it is what it is claimed to be), intact (it has not changed since collection) and was handled with a reproducible method. The chain of custody answers the question from opposing counsel, the auditor or the regulator: “how do I know you didn’t modify that evidence?”.

It is not only for trials. An internal investigation that ends in a dismissal, an insurance claim or a notification to the data protection authority can all be disputed, and then the same traceability is demanded.

Reference What it provides
RFC 3227 (BCP 55, February 2002) Guidelines for evidence collection and archiving; defines the order of volatility and what to avoid during collection
ISO/IEC 27037:2012 Identification, collection, acquisition and preservation of digital evidence; defines the first responder (DEFR) and specialist (DES) roles
ISO/IEC 27042:2015 Analysis and interpretation of digital evidence
UNE 71505 / UNE 71506:2013 Spanish AENOR standards: electronic evidence management system and forensic analysis methodology

The principles they share: relevance (collect what serves the case), reliability (the process is repeatable and auditable) and sufficiency (collect enough to support the conclusions).

flowchart LR
    I["Identification<br/>what and where"] --> R["Collection or<br/>acquisition"]
    R --> H["Initial hash<br/>+ record"]
    H --> P["Preservation<br/>sealing and storage"]
    P --> A["Analysis<br/>on a working copy"]
    A --> PR["Presentation<br/>report and testimony"]
    PR --> D["Return<br/>or destruction"]
    P -. "every transfer is<br/>logged and re-hashed" .-> P

Every arrow is a moment when someone handles the evidence, and every one must be written down.

RFC 3227 asks you to collect first what disappears first. Its list, from most to least volatile:

# Source (RFC 3227) How it is collected in practice
1 CPU registers and cache In practice, only through the memory dump
2 Routing table, ARP cache, process table, kernel statistics, memory RAM dump (memory forensics) and network and process commands
3 Temporary file systems /tmp, /dev/shm, page files
4 Disk Forensic image or triage collection
5 Remote logging and monitoring data for the system SIEM, syslog server, EDR console, cloud provider logs
6 Physical configuration and network topology Photographs, diagrams, inventory
7 Archival media Backups, tapes

The RFC itself notes that the order adapts to the case: if remote logs rotate every 24 hours, exporting them can be more urgent than imaging a disk that is not going anywhere.

Each piece of evidence has its own form (on paper or in a management system) with at least:

  • Unique identifier (CASE-2026-014/EV-001) and description: make, model, serial number, capacity, physical condition.
  • Origin: where it was found, who owns it, who authorized the collection.
  • Acquisition: tool and version, method, date and time in UTC, operator, witnesses.
  • Hashes: algorithm and value at acquisition time.
  • Transfers: every change of hands with date, time, who hands over, who receives, reason and both signatures.
  • Storage: location, seal number, conditions (antistatic bag, safe, access control).
  • Final disposition: return, destruction or archive, with date and person responsible.

The analyst also keeps a work journal with every action and its reason, detailed enough for a third party to repeat the analysis and reach the same result.

The outputs in this section were reproduced on a 64 MiB test image in a Linux lab (dc3dd 7.2.646, ewfacquire 20140814, hashdeep 4.4).

When a disk is attached to the forensic workstation, use a hardware write blocker or, at the very least, mount it read-only. Mounting a file system read-write updates access times and, in some cases, replays the file system journal: the disk is no longer the original.

Ventana de terminal
dc3dd if=/dev/sdb of=EV-001.dd hash=sha256 log=EV-001_acquisition.log

The log stays as evidence of the process:

dc3dd 7.2.646 started at 2026-11-19 22:22:39 +0100
command line dc3dd if=disco.raw of=evidencia.dd hash=sha256 log=adquisicion.log
sector size: 512 bytes (assumed)
67108864 bytes ( 64 M ) copied ( 100% ), 0.300744 s, 213 M/s
input results for file `disco.raw':
131072 sectors in
792a955206b4b1c9f1c3e75ce6453c0ad5f13351bbed2fe02c3c2194e4e2af78 (sha256)
output results for file `evidencia.dd':
131072 sectors out

dc3dd hashes what it reads from the source while copying, so the value documents the state of the original at acquisition time.

The EWF format (E01) compresses, splits into segments and stores the case details and a verification hash inside the image itself:

Ventana de terminal
ewfacquire -t EV-001 -f encase6 -c fast -S 0 -d sha256 \
-C CASE-2026-014 -E EV-001 -D "Finance laptop" -e "Analyst" -N "HW write blocker" /dev/sdb
ewfverify EV-001.E01
ewfinfo EV-001.E01
MD5 hash stored in file: a877ce0fc1549d67cb33305c733ef442
MD5 hash calculated over data: a877ce0fc1549d67cb33305c733ef442
ewfverify: SUCCESS
Acquiry information
Case number: CASO-2026-014
Description: Portatil finanzas
Examiner name: Analista
Evidence number: EV-001

Manifest and audit of the whole set (hashdeep)

Section titled “Manifest and audit of the whole set (hashdeep)”

For collections with many files (triage, log exports, mailboxes), generate a manifest and audit it on every transfer:

Ventana de terminal
hashdeep -c sha256 -l -r case/ > manifest.txt # on receiving the evidence
hashdeep -c sha256 -a -k manifest.txt -l -r case/ # on every transfer
hashdeep: Audit passed

If someone modifies a file, the audit fails and verbose mode (-vv) counts it as a known file missing plus a new file:

New files found: 1
Known files not found: 1
  • SHA-256 as the primary algorithm.
  • MD5 and SHA-1 have known practical collisions: they must not be the only hash, even if kept for compatibility with tools or formats that only support them.
  • Always hash at acquisition and after every transfer; record both matching values.
  • Memory: it cannot be acquired again in the same state; the hash certifies the dump file, not the state of RAM. Document the tool, exact time and the machine’s state.
  • Cloud and SaaS: there is no disk to seal. Export logs (IdP audit, CloudTrail, Microsoft 365 unified audit log), hash them on download and record the exact query, the account used and the time range.
  • Mobile devices: isolate them from the network (Faraday bag or airplane mode) to prevent remote wipes and document the lock state (mobile forensics).
  • Network captures: hash PCAPs as each rotation file is closed (network forensics).

The “adversary” of the chain of custody is not just the attacker but anyone who can challenge the evidence, including your own team:

  • Analyzing the original instead of a working copy.
  • Not hashing, or hashing only at the end.
  • Unsigned transfers or unexplained time gaps.
  • Storage without access control.
  • Undocumented tools or versions: the analysis is not reproducible.
  • Unnormalized clocks: mixing local time and UTC without saying so invalidates the timeline.
  • Attacker anti-forensics: secure deletion, timestomping, volume encryption or wipers that trigger when the response is detected. They do not break the chain, but they force you to document what was found and in what state.
  • Casey Anthony trial (Florida, 2011): the prosecution argued that a page about chloroform had been visited 84 times on the family computer, based on a report generated with the CacheBack tool. Another police report, produced with NetAnalysis, showed a single visit. After the trial, CacheBack’s own developer said he had found an error in his software and that the page was visited only once. Lesson: validate your tools, cross-check critical results with a second tool and document versions, because the forensic report gets argued in court.
  • NotPetya at Maersk (2017): the only surviving domain controller, offline because of a power cut in Ghana, was physically carried to the recovery center in the UK. A piece like that is both a recovery asset and evidence: record who carries it, when and in what state, just as for a seized disk.
  • Collection authorization and scope documented before starting
  • Order of volatility applied and justified
  • Write blocker or read-only mount
  • Image with SHA-256 hash calculated at acquisition
  • Tool log kept alongside the image
  • Custody record with identifier, origin, tools, versions and UTC time
  • Every transfer signed, with a matching re-hash
  • Sealed storage with controlled access
  • Analysis always on a working copy
  • Critical results cross-checked with a second tool
  • Final disposition documented