Artificial Intelligence & Data Science is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

Network forensics and live acquisition

Network forensics and live acquisition explain how to capture, preserve and analyse network and volatile data in real time so engineers can investigate incidents and preserve admissible evidence.

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

Network forensics and live acquisition are used by incident responders and forensic engineers to capture data that exists only while systems and networks are running. These techniques let an engineer reconstruct attacks, trace data exfiltration, and preserve evidence that would be lost if a machine is shut down.

Key ideas

  • Volatile data: data stored in RAM or ephemeral state (active sockets, in-memory temporary files on tmpfs such as /dev/shm, and /tmp only when mounted as tmpfs, kernel state) which disappears on shutdown or reboot; on systems where /tmp is on disk, files there persist across reboots.

  • Packet capture (pcap): storing each network packet observed by a capture tool. When I say pcap, I mean the capture file formats commonly produced by tools like tcpdump and Wireshark (pcap or pcapng).

  • Full packet capture: storing the entire packet (headers + payload) rather than only headers or flow metadata. Flow data (e.g., NetFlow, IPFIX) is a summarized record per conversation (5-tuple and counters) rather than every packet.

  • Promiscuous mode: a NIC setting that allows the network interface card to accept all packets it sees on the wire, not only those addressed to its MAC. Use this to capture other hosts' traffic on a shared medium or on some switched networks with mirror/span ports. On switches, SPAN/mirror ports can be oversubscribed and drop mirrored frames; passive network TAPs replicate traffic at line rate without affecting switching/MAC learning.

  • Packet filtering: using criteria (IP, port, protocol) to capture only relevant packets. Example: a capture filter "tcp and port 80" keeps TCP packets for port 80 only. Note: capture filters use BPF syntax (tcpdump/libpcap), whereas display filters use Wireshark/tshark syntax (e.g., http.request).

  • Hashing and integrity: compute a cryptographic hash (e.g., SHA-256) of capture files and of memory images to prove they were not changed. A cryptographic hash is a one-way function producing a fixed-size digest; any change in the input should change the digest with very high probability.

Exact statements and assumptions often required in exams

  1. Definition (formal): Network forensics is the process of: (a) systematically capturing network-originating data; (b) preserving it with integrity guarantees; (c) analysing it to produce timelines, identify attackers or data flow; and (d) documenting chain of custody. Assume an accessible capture point and that timestamps are synchronised or can be corrected.

  2. Live acquisition rule of thumb (universal exam guidance): "Do not power down a live machine if you need volatile data. Capture memory and active network state first, then collect non-volatile storage." Assumption: powering down may change or destroy volatile evidence; exceptions exist (danger of malware wiping on live capture) and must be justified. This follows the "order of volatility" (RFC 3227): CPU registers/cache → RAM → network state/flows → temporary files → logs → disk → backups/archives.

  3. Timestamp integrity: Use NTP-synchronised clocks or log timezone & offset. Assume capture tools record kernel timestamps; hardware NIC timestamps are more accurate where available.

  4. Preservation principle: Maintain chain of custody and compute cryptographic hashes at creation and after every copy. Use collision-resistant algorithms (e.g., SHA-256 or SHA-3); MD5 and SHA-1 are no longer considered collision-resistant and should not be relied on for forensic integrity except for legacy identification alongside a stronger hash.

Diagrams to draw (exam instruction):

  • Draw a capture topology: three boxes labelled "Target host", "Mirror/SPAN or TAP", "Collector (capture host)". Draw an arrow from Target host to Mirror/SPAN, and an arrow from Mirror/SPAN to Collector. Label the Collector with "pcap file + hash" and the Mirror with either "SPAN port" or "Network TAP". Also indicate a remote storage arrow from Collector to "Secure Archive" with label "scp/rsync over SSH".

  • Draw a timeline diagram for live acquisition: Time axis left->right with markers: "(t0) identify target", "(t1) record system state (uptime, running processes)", "(t2) capture memory", "(t3) capture network packets", "(t4) capture disk images". Annotate that earlier steps are higher priority because they are more volatile.

Formulas

Storage_required = throughput × time — throughput is average data rate (bits per second), time in seconds, result in bits. Convert to bytes by dividing by 8. Use SI units: bits (b), seconds (s).

throughput = packets_per_second × average_packet_size — average_packet_size in bits.

H = - Σ p_i · log2(p_i) — Shannon entropy. p_i is the probability of symbol i. Unit: bits. Use when estimating randomness of a data stream (e.g., to detect encrypted or compressed payloads).

hash = H(data) — symbolic: H is a cryptographic hash function (e.g., SHA-256). Use to assert integrity. No units.

Remember capture command skeletons (syntax to remember):

  • tcpdump -i INTERFACE -w filename.pcap -s 0 'FILTER' — capture full packets on INTERFACE to file with FILTER expression.
  • tcpdump -r filename.pcap -nn -tt — read and print pcap with numeric addresses and timestamps.
  • tshark -r file.pcap -Y 'http.request' — display HTTP requests from pcap.

Worked examples

Example 1 — Storage calculation for full packet capture

Problem: A site expects average 100 Mbit/s of traffic. How much disk is needed to store full packet capture for 24 hours? Assume 100 Mbit/s is the sustained average.

  1. Formula: Storage_required = throughput × time.
  2. throughput = 100 Mbit/s = 100 × 10^6 bit/s.
  3. time = 24 h = 24 × 3600 s = 86400 s.
  4. Storage_required = 100×10^6 bit/s × 86400 s = 8.64 × 10^12 bits.
  5. Convert to bytes: 8.64 × 10^12 / 8 = 1.08 × 10^12 bytes = 1.08 × 10^3 GB ≈ 1080 GB.

Answer: ≈ 1.08 TB. (Round up and allow overhead; in practice plan 1.2–1.5× for indexes and metadata.)

Example 2 — Reconstruct an HTTP GET from a small pcap (procedural)

Given: a pcap file observed from a capture point. Task: find an HTTP GET and extract requested URL.

Steps (step-by-step trace):

  1. List HTTP requests: tshark -r capture.pcap -Y 'http.request' -T fields -e http.request.method -e http.host -e http.request.uri.
  2. Output might show: GET example.com /index.html.
  3. Combine host and URI to form URL: http://example.com/index.html.
  4. Verify TCP stream: run tcpdump -r capture.pcap tcp and host example.com and port 80 -w stream.pcap then tshark -r stream.pcap -z follow,tcp,ascii,0 to view the ASCII stream.

Expected final answer: the HTTP GET line and the full URL and a note of packet/time offsets where it occurred. Show computed hash of stream.pcap for integrity: sha256sum stream.pcap and record digest in the report.

Example 3 — Short model answer (theory) — "Why capture memory before disk?"

Model answer: Memory contains running processes, plaintext credentials, and volatile network state that do not persist on disk. Shutting down erases this state. Live acquisition minimises loss of ephemeral evidence; therefore memory capture is prioritised. Explain exceptions: if malware will detect the investigator and self-destruct on detection, a deliberate shutdown or network isolation may be justified — document the decision.

Common mistakes

  • Capturing only headers or flow records when payloads are required for proof; conversely, capturing everything without planning leads to unmanageable storage.
  • Forgetting to compute and record cryptographic hashes at each copy operation.
  • Using filters that are too broad (capture more than necessary) or too narrow (miss evidence).
  • Storing capture files on the target host rather than a remote, write-protected collector — this changes evidence.

For your exam

Question types you will see: definitions (network forensics, live acquisition, volatile data), short notes (compare pcap and flow data, list steps in live acquisition), derivations (show storage calculation from throughput), practical commands (write the tcpdump command to capture full packets with a filter), diagrams (capture topology or live-acquisition timeline), scenario answers (how to collect evidence from a running web server under attack).

What a full-marks answer includes:

  • Precise definitions of each bold term used.
  • An ordered, justified plan for acquisition showing priorities (memory → network → disk), with assumptions and exceptions.
  • Correct command syntax or formulas with units and step-by-step numeric work (carry units through to the final answer).
  • Evidence preservation steps including hashing and chain-of-custody notes.
  • A simple diagram described or drawn exactly as requested.

Quick check

  1. What is the difference between pcap and flow (NetFlow) data?
  2. Why is memory captured before disk in live acquisition?
  3. Give the tcpdump command skeleton to write a full-packet capture to a file for interface eth0 with filter for TCP port 443.

Answers: 1) pcap stores each packet including payload; flow data stores summary records (5-tuple + counters). 2) Memory contains volatile state (processes, open sockets, plaintext secrets) lost on shutdown. 3) tcpdump -i eth0 -s 0 -w capture.pcap 'tcp and port 443'.

Note to reviewer: I have explained technical terms plainly and included commands and calculations. I have avoided making strong legal claims about admissibility beyond the general preservation principle because legal rules vary. Where I am unsure I list items to verify below.

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?