Evidence Handoff to DFIR and Purple-Team Exercises
Two moments decide whether a SOC's work is useful beyond the alert. The first is the handoff to digital forensics and incident response (DFIR): what the SOC preserves, how, and in what state it passes it on, decides what the investigators can prove later, possibly in court. The second is the purple-team exercise: red and blue working together on purpose, running known techniques in a controlled way and checking, technique by technique, whether the SOC saw them. This lesson covers both, with a hashed evidence package in a sandbox session and the scoring of an exercise in Python.
What the SOC preserves before handing over
The SOC is usually first on the scene, and its early actions shape the evidence. The principles (taught in depth in Malware Analysis, Digital Forensics & Incident Response):
- Order of volatility: what disappears first is collected first. Memory, running processes and network connections before disk; disk before logs that are kept for months anyway. Isolating a host with the EDR keeps it running (memory intact) while cutting the attacker off; switching it off destroys memory.
- Don't clean up before collecting. Deleting the malicious scheduled task or file, or reimaging, before collection destroys evidence.
- Export, don't screenshot. SIEM query results, EDR timelines and alert details are exported in their original format with the query that produced them.
- Hash and record. Every exported item gets a cryptographic hash; a chain-of-custody record states who collected what, when, how, and to whom it was handed. Later anyone can verify that the item is unchanged.
- Write down what you did. Every action on the affected systems (isolation, a triage collection, a credential reset) goes into the case timeline with its time, because investigators must distinguish the SOC's traces from the attacker's.
A hashed evidence package
The session (in your sandbox, on files it writes itself; no network) packages three stand-in exports for case C-2301, records a custody entry, lets the receiver verify the package, and then shows what happens when someone edits a file afterwards.
# Package the SOC's exports for case C-2301 (synthetic files stand in for the real exports).
mkdir -p C-2301 && cd C-2301
printf '2026-01-15T09:58:02Z ws15 winword.exe opened invoice-0115.docm\n2026-01-15T09:59:40Z ws15 powershell.exe -nop -w hidden -enc ...\n' > edr_timeline_ws15.txt
printf '{"ts":"2026-01-15T10:05:00Z","host":"ws15","query":"upd.cdn-lab.example"}\n' > dns_ws15.jsonl
printf 'synthetic stand-in for the quarantined DLL\n' > lib.dll.quarantine
sha256sum edr_timeline_ws15.txt dns_ws15.jsonl lib.dll.quarantine > SHA256SUMS
cat SHA256SUMS
# Chain-of-custody entry: who exported what, when, how, and the manifest's own hash.
jq -n --arg case C-2301 --arg by "soc-analyst-2" --arg to "dfir-lead" --arg at 2026-01-15T11:20:00Z \
--arg manifest "$(sha256sum SHA256SUMS | cut -d' ' -f1)" \
'{case: $case, handed_over_by: $by, received_by: $to, time: $at,
method: "SIEM and EDR export, read-only share", manifest_sha256: $manifest}' > custody.json
jq -c . custody.json
echo "== receiver verifies"
sha256sum -c SHA256SUMS
echo "== later: someone edits the timeline"
echo '2026-01-15T10:00:00Z ws15 (note added)' >> edr_timeline_ws15.txt
sha256sum -c SHA256SUMS 2>/dev/null || echo "verification FAILED: do not use the changed copy as evidence"aa473cc02e3edeafe9385ff7c4eda35dd871a4e7eadb3acaadbfd733c00df92e edr_timeline_ws15.txt
43b52b6eb6c03f7d72dc74f2bfc197129040a580c4ae2f2a10daa926586bd162 dns_ws15.jsonl
c4d5c07e081ebe7f8ee1e5480e55da8af63cde49847f0c3a3d7f610aed7b16cc lib.dll.quarantine
{"case":"C-2301","handed_over_by":"soc-analyst-2","received_by":"dfir-lead","time":"2026-01-15T11:20:00Z","method":"SIEM and EDR export, read-only share","manifest_sha256":"e7c2b08324d6a2655be68e4536f06592955b7f0dbd510a11fa1931b95df3c682"}
== receiver verifies
edr_timeline_ws15.txt: OK
dns_ws15.jsonl: OK
lib.dll.quarantine: OK
== later: someone edits the timeline
edr_timeline_ws15.txt: FAILED
dns_ws15.jsonl: OK
lib.dll.quarantine: OK
verification FAILED: do not use the changed copy as evidence
The manifest SHA256SUMS lists one SHA-256 per file, and the custody record contains the hash of the manifest itself, so the whole package is pinned by one value that can be written into the case. The receiver's check passes; after the edit, sha256sum -c names the changed file. That does not mean the edit was malicious (here it was an analyst's note), only that the changed copy is no longer the evidence that was handed over: notes go into the case, never into evidence files. In real handoffs the package is written to write-once storage or an evidence system, and memory or disk images are collected by DFIR tools that hash during acquisition.
Purple-team exercises
In a purple-team exercise, the red side runs specific, agreed techniques in a controlled scope, and the blue side watches in real time, technique by technique: was it prevented, alerted, only logged (visible to a hunter, but no alert), or not seen at all? Every gap becomes a work item: a data source to enable, a detection to write, a playbook to fix. Unlike a red-team engagement, nothing is hidden from the defenders; the goal is learning, not winning (Red, Blue and Purple Teams).
Atomic Red Team (an open-source library by Red Canary) supports this: small, documented tests ("atomics"), each mapped to one ATT&CK technique, with the command it runs, its prerequisites and a cleanup step, executed with a runner such as the Invoke-AtomicRedTeam PowerShell module. Similar frameworks include MITRE Caldera for chaining techniques automatically. They are used only on lab systems or on production systems with written approval, a defined scope, a time window and a rollback plan, exactly like any other test (Authorization, Scope and Rules of Engagement). This course doesn't reproduce test commands; the scoring below uses the results of a lab exercise.
Scoring an exercise
import pandas as pd
results = pd.DataFrame([ # technique, test description (lab), outcome, minutes to alert (None if no alert)
("T1059.001", "PowerShell with encoded command", "alerted", 2),
("T1204.002", "Office document starts a script host", "prevented", None),
("T1053.005", "scheduled task created from command line", "alerted", 4),
("T1003.001", "read of LSASS memory by a test tool", "prevented", None),
("T1021.002", "remote service via admin share, lab DC01 to WS02", "logged", None),
("T1087.002", "domain account discovery with net.exe", "logged", None),
("T1685.005", "clear the Security event log", "alerted", 1),
("T1567.002", "upload test file to a cloud storage site", "not seen", None),
("T1218.011", "rundll32 loads DLL from a user folder", "alerted", 3),
("T1547.001", "Run key autostart entry", "not seen", None),
], columns=["technique", "test", "outcome", "min_to_alert"])
order = ["prevented", "alerted", "logged", "not seen"]
summary = results.outcome.value_counts().reindex(order, fill_value=0)
print(summary.to_string())
print(f"\nvisible to the SOC (prevented, alerted or logged): {results.outcome.isin(order[:3]).mean():.0%}")
print(f"alerted or prevented: {results.outcome.isin(order[:2]).mean():.0%}, median time to alert: "
f"{results.min_to_alert.median():.1f} min")
print("\nBACKLOG")
for r in results[results.outcome.isin(["logged", "not seen"])].itertuples():
todo = "write and test a detection on existing data" if r.outcome == "logged" else "enable a data source, then detect"
print(f" {r.technique:10} {r.test:49} -> {todo}")outcome
prevented 2
alerted 4
logged 2
not seen 2
visible to the SOC (prevented, alerted or logged): 80%
alerted or prevented: 60%, median time to alert: 2.5 min
BACKLOG
T1021.002 remote service via admin share, lab DC01 to WS02 -> write and test a detection on existing data
T1087.002 domain account discovery with net.exe -> write and test a detection on existing data
T1567.002 upload test file to a cloud storage site -> enable a data source, then detect
T1547.001 Run key autostart entry -> enable a data source, then detect
Ten tests, four outcomes. Two techniques were prevented outright (the Office child-process block and LSASS protection), four alerted within a median of 2.5 minutes, two were only logged and two were not seen. 80 % visible sounds good; the number that matters to the backlog is that 4 of 10 techniques produced no alert. The backlog sorts itself by cost: "logged" items need a rule written and tested on data that already exists, "not seen" items need a data source first. After the work, the same tests are run again, and only a passing retest closes an item.
How exercises go wrong, and the fix
- Testing only what you already detect. Pick techniques from the threat profile and the coverage gaps (Coverage Mapping), not from the list of rules.
- No retest. A backlog item is closed only when the same test, rerun, alerts.
- Production surprises. Unannounced tests on production trigger real incident response; agree scope, time windows, contacts and a stop word in writing, and tell the incident lead.
- Cleanup forgotten. Each test's cleanup step runs, and its success is checked; leftover test artefacts (tasks, registry keys) confuse the next investigation.
Pitfalls
- Handing over conclusions instead of evidence. DFIR needs the raw exports and the queries, not only the analyst's summary.
- Hashes computed after transfer. Hash at export time, on the source side; a hash computed after an unverified copy proves nothing about the original.
- Treating "logged" as covered. Data that nobody looks at is not detection; it only helps hunts and investigations.
Practice
1. Which two items of volatile evidence should be collected from ws15 before anything else, and why isolate rather than shut down?
Memory (the DLL may exist decrypted only in memory; network connections and the injected code live there) and the list of running processes and network connections. Isolation cuts the attacker off while keeping the machine running, so memory survives; shutting down loses it.
2. The custody record contains the manifest's hash, not each file's hash. Is that enough?
Yes, as long as the manifest itself is kept: the manifest pins each file, and the custody record pins the manifest. Verifying means checking the manifest against the recorded hash, then each file against the manifest.
3. In the exercise, which backlog item would you do first?
T1021.002 (remote service via admin shares) and T1087.002 are "logged": the data exists, so a detection is a few days of work. T1021.002 matters more (lateral movement, and a priority technique in the coverage lesson). The two "not seen" items need data sources first (proxy or CASB logs for cloud uploads, registry auditing or EDR registry events for Run keys).
Test yourself
Why does the SOC isolate a compromised host instead of switching it off?
- It is faster
- Isolation cuts off the attacker while keeping memory and running state for forensics
- Switching off is illegal
- Isolation deletes the malware
What did sha256sum -c show after the timeline file was edited?
- All OK
- The edited file FAILED, the others OK
- It deleted the file
- It fixed the hash
In a purple-team exercise, what does the outcome 'logged' mean?
- The technique was blocked
- The telemetry exists, but no alert fired
- Nothing was recorded
- The test failed to run
What is Atomic Red Team?
- A malware family
- A library of small tests, each mapped to an ATT&CK technique, used to validate detections in authorised tests
- A SIEM
- A threat-intelligence feed