Domain 1Recon & ReportingCORE

Chain of Custody for Evidence

Guide to maintaining chain of custody for penetration test evidence, including documentation requirements, evidence handling best practices, and legal considerations.

Domain: Domain 1: Reconnaissance & Reporting•Updated: 2026-09-01
#chain-of-custody#evidence-integrity#legal#forensics#oscp-exam

OSCP Report Writing: Chain of Custody for Evidence

1. What is Chain of Custody?

Definition

Chain of Custody is a documented process that tracks evidence from the moment it is collected through its entire lifecycle until final disposal. It ensures that evidence remains intact, unaltered, and admissible in legal or compliance proceedings.

Why Chain of Custody Matters

Context Importance
Legal Proceedings Evidence must be proven unaltered to be admissible in court
Compliance Audits Auditors require evidence of proper evidence handling
Professional Integrity Demonstrates professional standards and accountability
Dispute Resolution Provides a record if findings are challenged
OSCP Exam While not strictly required, demonstrates professionalism

Chain of Custody Elements

Element Description Example
Collector Who collected the evidence John Doe, Penetration Tester
Date/Time When evidence was collected 2026-08-15 14:30 UTC
Location Where evidence was collected Remote, via VPN to 10.10.10.0/24
Method How evidence was collected Screenshot, packet capture, terminal output
Storage Where evidence is stored Encrypted volume /evidence/
Hash Cryptographic hash of evidence SHA256: a1b2c3d4e5f6…
Access Log Who accessed the evidence Audit trail of all accesses
Disposition How evidence will be disposed Secure deletion after 90 days

2. Chain of Custody Log Template

Standard Log Format

#### Chain of Custody Log

Evidence Item: VULN-001 SQL Injection Screenshots
Description: Screenshots demonstrating SQL injection vulnerability on webapp.example.com

| Date/Time (UTC) | Action | Performed By | Witness | Notes |
|---|---|---|---|---|
| 2026-08-15 14:30 | Evidence collected | J. Doe | - | Screenshot of SQLi exploit taken during engagement |
| 2026-08-15 14:31 | File hashed | J. Doe | - | SHA256: abc123def456... |
| 2026-08-15 14:35 | Stored in secure location | J. Doe | - | Moved to encrypted volume /evidence/VULN-001/ |
| 2026-08-20 09:00 | Accessed for report writing | J. Doe | - | Read-only access for report documentation |
| 2026-08-25 10:00 | Included in final report | J. Doe | - | Screenshots embedded in PDF report |
| 2026-09-15 10:00 | Evidence archived | J. Doe | - | Moved to cold storage, access restricted |
| 2026-12-15 10:00 | Evidence disposed | J. Doe | J. Smith | Secure deletion performed, verified by witness |

Evidence Inventory Template

#### Evidence Inventory

| Evidence ID | Description | Type | Date Collected | Hash (SHA256) | Storage Location |
|---|---|---|---|---|---|
| EVD-001 | SQL injection screenshot | PNG | 2026-08-15 | abc123... | /evidence/VULN-001/ |
| EVD-002 | nmap scan output | TXT | 2026-08-15 | def456... | /evidence/misc/ |
| EVD-003 | Burp Suite request/response | JSON | 2026-08-15 | ghi789... | /evidence/VULN-001/ |
| EVD-004 | Root shell screenshot | PNG | 2026-08-16 | jkl012... | /evidence/VULN-002/ |
| EVD-005 | user.txt capture | TXT | 2026-08-16 | mno345... | /evidence/VULN-002/ |

3. Evidence Handling Best Practices

Collection Phase

Practice Description
Hash on collection Hash evidence immediately upon collection to establish baseline integrity
Document metadata Record who, what, when, where, and how for each piece of evidence
Use write blockers Use hardware write blockers when imaging disks to prevent modification
Preserve originals Never work on original evidence; always work on copies
Secure transfer Use encrypted channels (SCP, SFTP) when transferring evidence

Storage Phase

Practice Description
Encrypted storage Store evidence in encrypted volumes or containers
Access control Restrict access to authorized personnel only
Backup Maintain multiple copies in separate, secure locations
Environment control Store in controlled environment (temperature, humidity, security)
Access logging Log every access to evidence files with timestamp and reason

Access Phase

Practice Description
Read-only access Access evidence in read-only mode whenever possible
Document access Log every access with reason and duration
Verify integrity Re-hash evidence after access to confirm no alteration
Minimal access Limit the number of people who can access evidence

Disposal Phase

Practice Description
Retention policy Define how long evidence is retained (e.g., 90 days, 1 year)
Secure deletion Use secure deletion methods (shred, degauss, physical destruction)
Document disposal Record the disposal process with date, method, and witness
Verification Verify that evidence has been completely and irrecoverably destroyed

4. Evidence Hashing

Why Hashing Matters

Hashing creates a unique fingerprint of a file that can be used to verify its integrity. If the file is altered in any way, the hash will change.

Hashing Commands

# SHA256 hash of a single file
sha256sum evidence/VULN-001/screenshot.png

# Output:
# abc123def456ghi789jkl012mno345pqr678stu901vwx234yz /evidence/VULN-001/screenshot.png

# Hash all files in a directory
find evidence/ -type f -exec sha256sum {} \; > evidence_hashes.txt

# Verify hashes later
sha256sum -c evidence_hashes.txt

# MD5 hash (less secure, but still used)
md5sum evidence/VULN-001/screenshot.png

# SHA1 hash (less secure than SHA256)
sha1sum evidence/VULN-001/screenshot.png

Hash Comparison

Algorithm Output Length Security Level Recommended?
MD5 128-bit Weak (collision attacks known) No
SHA1 160-bit Weak (collision attacks known) No
SHA256 256-bit Strong Yes (recommended)
SHA512 512-bit Very strong Yes (for high-security)

5. Evidence Types and Handling

Screenshot Evidence

Aspect Guidance
Format PNG (lossless) preferred over JPEG (lossy)
Metadata Preserve EXIF data (timestamp, tool used)
Naming Use consistent naming convention (see Chapter 8)
Storage Store in organized directory structure
Hashing Hash each screenshot file

Terminal Output Evidence

Aspect Guidance
Format Plain text (.txt) or script session recording
Capture Use script command for complete session recording
Metadata Include timestamp and user context
Storage Store in organized directory structure
Hashing Hash each output file

Network Capture Evidence

Aspect Guidance
Format PCAP (Wireshark/tcpdump format)
Capture Use tcpdump or Wireshark for packet capture
Metadata Include capture start/end time and interface
Storage Store in organized directory structure (can be large)
Hashing Hash each capture file

File Evidence

Aspect Guidance
Format Preserve original format
Handling Never modify original files; work on copies
Metadata Record file size, permissions, and timestamps
Storage Store in organized directory structure
Hashing Hash each file

6. Chain of Custody in OSCP Context

OSCP Requirements

For the OSCP exam, chain of custody is not strictly required but demonstrates professionalism. The key evidence requirements are:

  1. Screenshots of exploitation for each finding
  2. Proof of flag capture (user.txt and root.txt/proof.txt)
  3. Clear documentation of the exploitation steps

Professional Best Practices for OSCP

Even though the OSCP exam doesn’t require formal chain of custody, following these practices demonstrates professionalism:

  1. Organize evidence clearly. Use a consistent directory structure and naming convention.
  2. Document timestamps. Record when each piece of evidence was collected.
  3. Preserve original evidence. Don’t modify screenshots or output files.
  4. Include all evidence. Don’t leave out evidence that supports your findings.

When Chain of Custody is Critical

Scenario Chain of Custody Required?
OSCP Exam No (but good practice)
Internal penetration test Recommended
Client engagement Yes (professional standard)
Legal investigation Yes (mandatory)
Compliance audit Yes (required)
Incident response Yes (mandatory)

For evidence to be admissible in legal proceedings:

  1. Authenticity: The evidence must be proven to be what it claims to be.
  2. Integrity: The evidence must not have been altered since collection.
  3. Reliability: The collection and handling methods must be reliable and documented.
  4. Relevance: The evidence must be relevant to the case.
  5. Chain of Custody: There must be an unbroken chain of custody from collection to presentation.

8. Key Takeaways

  1. Chain of custody tracks evidence. From collection to disposal, every action must be documented.
  2. Hashing verifies integrity. SHA256 hashes prove evidence has not been altered.
  3. Document everything. Who, what, when, where, and how for every piece of evidence.
  4. Secure storage. Encrypt evidence and restrict access to authorized personnel.
  5. Preserve originals. Never work on original evidence; always work on copies.
  6. For OSCP: Not strictly required, but demonstrates professionalism and attention to detail.
  7. Legal engagements: Chain of custody is mandatory for legal admissibility.

9. Further Reading

  • NIST SP 800-72 Guide to Security Logging and Monitoring
  • ACPO (National Police Chiefs’ Association) Guidelines for Digital Evidence
  • ISO 27037 Guidelines for Identification, Collection, Acquisition, and Preservation of Digital Evidence
  • “Digital Forensics and Incident Response” by Jason T. Luttgens