Skip to content
Tutorials Center
My learning

Topics

Lesson 19 of 36 ยท Network and Log Forensics

Network Forensics Overview

Learn what network forensics is, which evidence sources exist (packets, flows, logs), how they differ, and how investigators move from alert to conclusions.

Network forensics is the collection and analysis of network traffic and the records that describe it, in order to reconstruct what happened between systems. Where disk forensics asks "what is on this machine?", network forensics asks "who talked to whom, when, how much, and what did they say?" Network evidence is often the only record of an intrusion that left nothing on disk, and it is frequently the way an investigation starts.

This chapter is defensive and legal in scope. You analyze traffic you are authorized to examine, such as your own organization's sensors or a case file you were given. All examples use small synthetic data generated inside the page, so you can run everything safely in your browser.

Capturing or inspecting other people's traffic without authorization can be a crime in many countries (wiretapping and computer-misuse laws). Always work under written authority, a policy, or a court order. See legal frameworks.

The evidence pyramid

Network data comes in layers. The more detail you keep, the more storage you need and the more privacy you touch.

Source What it holds Size Typical question it answers
Full packet capture (PCAP) Every byte of every packet Huge What exactly was sent?
Flow records (NetFlow, IPFIX) Who, whom, ports, bytes, times Small Who talked to whom and how much?
Application and server logs Requests, logins, errors Small What did the service do?
DNS, proxy and firewall logs Names looked up, URLs, allow/deny Medium Which domains did a host contact?
Alerts (IDS/IPS) Rule matches Tiny Which known pattern fired?

Most organizations keep flows and logs for months and full packets for hours or days. Good investigators start with the cheap, long-lived sources and move to packets only when needed.

A typical workflow

flowchart LR
  A["Alert or report"] --> B["Scope: hosts, time window"]
  B --> C["Collect: logs, flows, PCAP"]
  C --> D["Preserve and hash"]
  D --> E["Analyze and correlate"]
  E --> F["Report findings"]

Evidence is preserved before it is analyzed, just as with disks.

  1. Scope. Which hosts and which time window? Write them down. Clocks matter: note every source's time zone and drift.
  2. Collect from the closest source to the incident (a sensor, firewall or log server), using read-only access.
  3. Preserve. Hash each file immediately and keep the originals untouched (see the evidence manifest project).
  4. Analyze a working copy, and correlate sources: a DNS lookup, then a connection, then a download.
  5. Report what the data shows and what it cannot show (report writing).

What network evidence can and cannot prove

Network data proves that an IP address sent bytes at a time, not that a particular person did. NAT, shared Wi-Fi, VPNs and proxies all blur identity. Encryption (TLS) hides content but not metadata: addresses, ports, sizes, timing and often the server name remain visible. A careful report says "the host 10.0.0.7 contacted a server at 14:03 UTC", then separately argues who was using the host.

Flows from synthetic data

A flow is a summary of a conversation. The program below builds a small list of flow records and answers the first questions an analyst asks: who sent the most data, and which destinations are unusual?

Python Summarize flow records

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The host sending millions of bytes to an unusual port stands out immediately. That is a lead to investigate, not proof of wrongdoing: a backup job could look the same.

Baselines make anomalies visible

"Unusual" only means something against a baseline of normal behavior. Compare a host with its own history and with peers doing the same job.

Python Compare against a baseline

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Common mistakes

  • Trusting timestamps from different devices without checking their clocks.
  • Treating an IP address as a person.
  • Analyzing the original capture file instead of a hashed copy.
  • Collecting more than you are authorized to collect.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which network evidence source is smallest and usually kept the longest?

    Flow records summarize conversations without payloads, so months of them fit where hours of packets would not.
  2. 2. TLS encryption hides which of the following?

    The payload is encrypted. Addresses, ports, sizes and timing remain visible as metadata.
  3. 3. What does an IP address in a log prove?

    It identifies a network endpoint at a time, not a person; attribution needs more evidence.
  4. 4. Why build a baseline?

    Anomalies are deviations from normal behavior, so you need to measure normal first.

Summary

  • Network forensics reconstructs communication from packets, flows and logs.
  • Cheap long-lived sources (flows, logs) guide when to dig into packets.
  • Preserve and hash evidence before analysis; record time zones and clock drift.
  • Network data identifies endpoints, not people.
  • Baselines turn raw numbers into findings.

Next: Packet Capture and PCAP Parsing