Network forensics answers what crossed the wire, and it does so from copies
of captures, never from live interception of traffic you have no authority
to collect. A pcap is a time-ordered record of packets, and Zeek turns that
record into structured logs for connections, DNS, HTTP, TLS, and files. The
discipline is the same as disk forensics. Hash the capture, work on a copy,
normalize timestamps to UTC, and tie every claim to a packet number, a flow,
or a log line. Scope: analyze captures you are authorized to handle, such as
your own lab traffic, captures supplied under an investigation, or CTF
files. Treat captures as sensitive, because they can contain credentials,
private messages, and internal addresses.
Quick Workflow
- Hash the capture and record its time range, capture point, and filter.
- Get the capture summary: protocol hierarchy, top talkers, and endpoints.
- Extract Zeek logs or tshark fields for connections, DNS, HTTP, and TLS.
- Hunt the suspicious pattern: beaconing intervals, odd DNS names, large
uploads, and connections to rare external addresses.
- Follow the interesting streams: reassemble HTTP objects and DNS queries.
- Extract files and indicators: hashes, URLs, domains, IPs, and JA3 hashes
where the TLS handshake is visible.
- Correlate with host evidence: process start times, log entries, and disk
artifacts must line up with the network events.
- Report with UTC timestamps, packet or flow references, and the limits of
what encryption hid from view.
1. Capture integrity and summary
# Hash the capture before analysis, and keep the original untouched
sha256sum case01_traffic.pcapng
cp case01_traffic.pcapng case01_work.pcapng
# Time range and packet count in one pass
capinfos case01_work.pcapng
# Protocol hierarchy and top talkers
tshark -r case01_work.pcapng -q -z io,phs
tshark -r case01_work.pcapng -q -z endpoints,ip
tshark -r case01_work.pcapng -q -z conv,ip
A capture whose time range does not cover the incident window is a finding
in itself. Note the gap, do not silently extrapolate beyond it. If the
capture was truncated by a snapshot length, payloads may be cut off, and
file extraction from it will be incomplete.
2. Triage with tshark display filters
# DNS queries only, with query name and type
tshark -r case01_work.pcapng -Y "dns.flags.response == 0" \
-T fields -e frame.time_epoch -e ip.src -e dns.qry.name -e dns.qry.type
# HTTP requests and responses, with host, method, and status
tshark -r case01_work.pcapng -Y "http" \
-T fields -e frame.time_epoch -e ip.src -e http.request.method \
-e http.host -e http.request.uri -e http.response.code
# TLS handshakes: server name indication and negotiated version
tshark -r case01_work.pcapng -Y "tls.handshake.type == 1 or tls.handshake.type == 2" \
-T fields -e frame.time_epoch -e ip.src -e ip.dst -e tls.handshake.extensions_server_name \
-e tls.handshake.version
# Follow one TCP stream to read the full conversation
tshark -r case01_work.pcapng -q -z follow,tcp,ascii,3
Read the filter before trusting the output. A filter that is too narrow
hides the surrounding traffic that proves whether a connection was normal
or anomalous. Always check the unfiltered conversation count for the host
before concluding that a single stream was the whole story.
3. Zeek logs for structured hunting
# Generate Zeek logs from a pcap into a separate output directory
mkdir -p /evidence/case01/zeek
zeek -r case01_work.pcapng -C /evidence/case01/zeek
# Top external destinations by connection count
cat /evidence/case01/zeek/conn.log | zeek-cut id.resp_h | sort | uniq -c | sort -nr | head -20
# DNS queries that returned no answer or an unusual type
cat /evidence/case01/zeek/dns.log | zeek-cut ts query qtype_name rcode_name | grep -v "NOERROR" | head -40
# Files seen on the wire, with hashes where Zeek could compute them
cat /evidence/case01/zeek/files.log | zeek-cut ts tx_hosts mime_type md5 sha256 | head -40
Zeek logs are only as complete as the capture. Encrypted traffic still
yields connection metadata, DNS, TLS handshake fields, and certificate
details, but not plaintext content. Say so explicitly in the report rather
than implying that encryption was broken.
4. Beaconing and exfiltration checks
# Per-destination connection intervals with Python, to spot regular beacons
python3 - <<'PY'
import collections, statistics
from datetime import datetime, timezone
flows = collections.defaultdict(list)
with open("/evidence/case01/zeek/conn.log") as fh:
for line in fh:
if line.startswith("#") or not line.strip():
continue
parts = line.rstrip("\n").split("\t")
if len(parts) < 10:
continue
try:
ts = float(parts[0])
except ValueError:
continue
flows[(parts[2], parts[4])].append(ts)
for (src, dst), times in sorted(flows.items()):
if len(times) < 10:
continue
times.sort()
gaps = [b - a for a, b in zip(times, times[1:])]
print(src, dst, "count", len(times),
"median_gap_s", round(statistics.median(gaps), 1),
"stdev_s", round(statistics.pstdev(gaps), 1))
PY
# Large uploads: total bytes sent per destination, largest first
tshark -r case01_work.pcapng -q -z conv,ip | sort -k 10 -nr | head -20
# Extract HTTP objects for hashing and further analysis
tshark -r case01_work.pcapng --export-objects http,/evidence/case01/http_objects
ls -l /evidence/case01/http_objects
sha256sum /evidence/case01/http_objects/* 2>/dev/null | head -40
Regular intervals with low variance are a beaconing signal, not proof of
malware on their own. Scheduled updates, keepalives, and polling services
beacon too. Compare the destination against known-good traffic from the
same host before calling it malicious, and check whether the beacon
started at the same time as a suspicious process or download.
Edge cases
- The capture starts after the intrusion. Host logs, proxy logs, and flow
records may still cover the missing window, so pivot to those sources
instead of claiming the network was quiet.
- Traffic is fully encrypted and no TLS handshake details survive. Use
connection size, timing, DNS, and destination reputation, and state the
plaintext gap plainly.
- The capture contains NAT addresses. Internal hosts behind one public
address cannot be separated from the pcap alone, so correlate with host
logs or firewall records to attribute a flow.
- DNS over HTTPS or DNS over TLS hides queries from a passive capture.
Endpoint DNS cache artifacts and proxy logs become the primary source.
- Clock skew between the capture host and the endpoints shifts times.
Anchor the timeline with an event seen in both sources, such as a known
login, and record the offset applied.
Key references
- NIST SP 800-86 (Guide to Integrating Forensic Techniques into Incident
Response).
- RFC 3227 (Guidelines for Evidence Collection and Archiving).
- Wireshark documentation on display filters and protocol dissection.
- Zeek documentation on connection, DNS, HTTP, TLS, and files logs.
See also
ctf-forensics-challenges-pcap-analysis: Use it instead for the competition version, framed around analyzing a packet capture to find a flag.
1---2name: network-forensics3description: Use when investigating network traffic from a packet capture or4 flow record during an authorized incident response or forensic examination.5 Covers pcap triage with tshark and tcpdump, Zeek connection and DNS logs,6 TLS and HTTP artifact recovery, DNS tunneling and beaconing detection, and7 building a network timeline that corroborates host evidence. Use when a host8 looks compromised, when data exfiltration is suspected, or when you need to9 prove what a system sent and received and when.10version: 1.0.011domain: forensics12lifecycle: stable13last_verified: "2026-10-27"14requires: []15extends: []16relates: [forensics-fundamentals, log-forensics, incident-response]17tools:18 - name: Wireshark19 version: 4.420 - name: tcpdump21 version: 4.99.522 - name: Zeek23 version: 7.024 - name: Python25 version: "3.12"26metadata:27 source: https://skillmd.com/skills/mizazhaider-ceh/network-forensics28---2930Network forensics answers what crossed the wire, and it does so from copies31of captures, never from live interception of traffic you have no authority32to collect. A pcap is a time-ordered record of packets, and Zeek turns that33record into structured logs for connections, DNS, HTTP, TLS, and files. The34discipline is the same as disk forensics. Hash the capture, work on a copy,35normalize timestamps to UTC, and tie every claim to a packet number, a flow,36or a log line. Scope: analyze captures you are authorized to handle, such as37your own lab traffic, captures supplied under an investigation, or CTF38files. Treat captures as sensitive, because they can contain credentials,39private messages, and internal addresses.4041## Quick Workflow42431. Hash the capture and record its time range, capture point, and filter.442. Get the capture summary: protocol hierarchy, top talkers, and endpoints.453. Extract Zeek logs or tshark fields for connections, DNS, HTTP, and TLS.464. Hunt the suspicious pattern: beaconing intervals, odd DNS names, large47 uploads, and connections to rare external addresses.485. Follow the interesting streams: reassemble HTTP objects and DNS queries.496. Extract files and indicators: hashes, URLs, domains, IPs, and JA3 hashes50 where the TLS handshake is visible.517. Correlate with host evidence: process start times, log entries, and disk52 artifacts must line up with the network events.538. Report with UTC timestamps, packet or flow references, and the limits of54 what encryption hid from view.5556## 1. Capture integrity and summary5758```bash59# Hash the capture before analysis, and keep the original untouched60sha256sum case01_traffic.pcapng61cp case01_traffic.pcapng case01_work.pcapng6263# Time range and packet count in one pass64capinfos case01_work.pcapng6566# Protocol hierarchy and top talkers67tshark -r case01_work.pcapng -q -z io,phs68tshark -r case01_work.pcapng -q -z endpoints,ip69tshark -r case01_work.pcapng -q -z conv,ip70```7172A capture whose time range does not cover the incident window is a finding73in itself. Note the gap, do not silently extrapolate beyond it. If the74capture was truncated by a snapshot length, payloads may be cut off, and75file extraction from it will be incomplete.7677## 2. Triage with tshark display filters7879```bash80# DNS queries only, with query name and type81tshark -r case01_work.pcapng -Y "dns.flags.response == 0" \82 -T fields -e frame.time_epoch -e ip.src -e dns.qry.name -e dns.qry.type8384# HTTP requests and responses, with host, method, and status85tshark -r case01_work.pcapng -Y "http" \86 -T fields -e frame.time_epoch -e ip.src -e http.request.method \87 -e http.host -e http.request.uri -e http.response.code8889# TLS handshakes: server name indication and negotiated version90tshark -r case01_work.pcapng -Y "tls.handshake.type == 1 or tls.handshake.type == 2" \91 -T fields -e frame.time_epoch -e ip.src -e ip.dst -e tls.handshake.extensions_server_name \92 -e tls.handshake.version9394# Follow one TCP stream to read the full conversation95tshark -r case01_work.pcapng -q -z follow,tcp,ascii,396```9798Read the filter before trusting the output. A filter that is too narrow99hides the surrounding traffic that proves whether a connection was normal100or anomalous. Always check the unfiltered conversation count for the host101before concluding that a single stream was the whole story.102103## 3. Zeek logs for structured hunting104105```bash106# Generate Zeek logs from a pcap into a separate output directory107mkdir -p /evidence/case01/zeek108zeek -r case01_work.pcapng -C /evidence/case01/zeek109110# Top external destinations by connection count111cat /evidence/case01/zeek/conn.log | zeek-cut id.resp_h | sort | uniq -c | sort -nr | head -20112113# DNS queries that returned no answer or an unusual type114cat /evidence/case01/zeek/dns.log | zeek-cut ts query qtype_name rcode_name | grep -v "NOERROR" | head -40115116# Files seen on the wire, with hashes where Zeek could compute them117cat /evidence/case01/zeek/files.log | zeek-cut ts tx_hosts mime_type md5 sha256 | head -40118```119120Zeek logs are only as complete as the capture. Encrypted traffic still121yields connection metadata, DNS, TLS handshake fields, and certificate122details, but not plaintext content. Say so explicitly in the report rather123than implying that encryption was broken.124125## 4. Beaconing and exfiltration checks126127```bash128# Per-destination connection intervals with Python, to spot regular beacons129python3 - <<'PY'130import collections, statistics131from datetime import datetime, timezone132flows = collections.defaultdict(list)133with open("/evidence/case01/zeek/conn.log") as fh:134 for line in fh:135 if line.startswith("#") or not line.strip():136 continue137 parts = line.rstrip("\n").split("\t")138 if len(parts) < 10:139 continue140 try:141 ts = float(parts[0])142 except ValueError:143 continue144 flows[(parts[2], parts[4])].append(ts)145for (src, dst), times in sorted(flows.items()):146 if len(times) < 10:147 continue148 times.sort()149 gaps = [b - a for a, b in zip(times, times[1:])]150 print(src, dst, "count", len(times),151 "median_gap_s", round(statistics.median(gaps), 1),152 "stdev_s", round(statistics.pstdev(gaps), 1))153PY154155# Large uploads: total bytes sent per destination, largest first156tshark -r case01_work.pcapng -q -z conv,ip | sort -k 10 -nr | head -20157158# Extract HTTP objects for hashing and further analysis159tshark -r case01_work.pcapng --export-objects http,/evidence/case01/http_objects160ls -l /evidence/case01/http_objects161sha256sum /evidence/case01/http_objects/* 2>/dev/null | head -40162```163164Regular intervals with low variance are a beaconing signal, not proof of165malware on their own. Scheduled updates, keepalives, and polling services166beacon too. Compare the destination against known-good traffic from the167same host before calling it malicious, and check whether the beacon168started at the same time as a suspicious process or download.169170## Edge cases171172- The capture starts after the intrusion. Host logs, proxy logs, and flow173 records may still cover the missing window, so pivot to those sources174 instead of claiming the network was quiet.175- Traffic is fully encrypted and no TLS handshake details survive. Use176 connection size, timing, DNS, and destination reputation, and state the177 plaintext gap plainly.178- The capture contains NAT addresses. Internal hosts behind one public179 address cannot be separated from the pcap alone, so correlate with host180 logs or firewall records to attribute a flow.181- DNS over HTTPS or DNS over TLS hides queries from a passive capture.182 Endpoint DNS cache artifacts and proxy logs become the primary source.183- Clock skew between the capture host and the endpoints shifts times.184 Anchor the timeline with an event seen in both sources, such as a known185 login, and record the offset applied.186187## Key references188189- NIST SP 800-86 (Guide to Integrating Forensic Techniques into Incident190 Response).191- RFC 3227 (Guidelines for Evidence Collection and Archiving).192- Wireshark documentation on display filters and protocol dissection.193- Zeek documentation on connection, DNS, HTTP, TLS, and files logs.194195## See also196197- `ctf-forensics-challenges-pcap-analysis`: Use it instead for the competition version, framed around analyzing a packet capture to find a flag.