Network Forensics: PCAP Analysis Lab

Analyze captured traffic in Wireshark: display filters, TCP stream reconstruction, beaconing detection, DNS tunneling, and extracting IOCs for detection engineering.

Hard 70m 3 tasks

Learning Objectives

  • Navigate a PCAP file in Wireshark using display filters to isolate relevant traffic
  • Use 'Follow TCP Stream' to reconstruct an application-layer conversation from raw packets
  • Identify beaconing behavior (periodic C2 check-ins) in captured traffic
  • Recognize DNS tunneling as a data-exfiltration technique hidden inside DNS queries
  • Extract concrete IOCs from a PCAP for use in detection rules

From Live Capture to Static Evidence

The Linux roadmap's networking lesson covered live tcpdump capture. This lab goes the other direction: analyzing an already-captured .pcap file after the fact — the standard workflow when investigating an incident from previously collected network evidence, in Wireshark, the standard GUI tool for this work.

Display Filters: Isolating the Signal

A raw PCAP from a busy network can contain hundreds of thousands of packets. Wireshark's display filter syntax narrows this down to exactly what matters:

Filter Isolates
ip.addr == 203.0.113.7 All traffic to/from a specific host
http.request Only HTTP request packets
dns Only DNS traffic
tcp.port == 4444 Traffic on a specific port (recall: a classic Metasploit default)
tcp.flags.syn == 1 and tcp.flags.ack == 0 Only the initial SYN of new TCP connections

Follow TCP Stream: Reconstructing the Conversation

Individual packets are hard to read in isolation. Wireshark's "Follow TCP Stream" feature reassembles every packet belonging to one TCP conversation into readable order — turning a scattered sequence of raw segments into the actual HTTP request/response, plaintext credentials, or command-and-control traffic exchanged between two hosts.

Beaconing: Spotting Periodic C2 Check-Ins

Command-and-control malware frequently "beacons" — checking in with its controller at regular intervals to fetch new instructions. In a PCAP, this shows up as connections to the same external host at suspiciously regular time intervals (e.g. exactly every 60 seconds), often with near-identical packet sizes each time. Statistics > Conversations in Wireshark, sorted by frequency and interval, is a fast way to spot this pattern against a large capture.

DNS Tunneling: Exfiltration Hidden in Plain Sight

DNS is rarely blocked by outbound firewalls, which makes it an attractive covert channel. DNS tunneling encodes data (often base32/base64) into subdomain labels of queries to an attacker-controlled domain:

d29ybGQgc2VjcmV0cw.exfil.attacker-domain.com

Indicators include: abnormally long subdomain labels, unusually high query volume to one domain, or queries for record types (e.g. TXT) more consistent with data transfer than name resolution.

Extracting IOCs for Detection

A network forensics investigation's actual deliverable is usually a set of concrete Indicators of Compromise: the C2 server's IP address, the malicious domain name, any file hashes for payloads observed being transferred, and specific beacon intervals or user-agent strings — these feed directly into the Sigma rules and SIEM correlation logic from the Blue Team Detection Engineering lesson.

Common Pitfalls

  • Trying to manually review every packet in a large capture instead of filtering down to what's relevant first
  • Missing beaconing because it was checked visually rather than sorted/aggregated by interval and destination
  • Assuming DNS traffic is inherently safe to ignore, when it's one of the most common covert exfiltration channels precisely because it's rarely blocked
  • Extracting an IOC but never feeding it forward into an actual detection rule, wasting the investigation's most actionable output

A pure SYN packet (no ACK) marks the very first packet of a new TCP handshake, a common starting point for narrowing down a large capture.

✦ Answer the questions to complete this task

Which Wireshark display filter isolates only the initial SYN packet of new TCP connections?

Malware checking in with its controller tends to do so on a consistent, predictable schedule.

✦ Answer the questions to complete this task

What pattern in a PCAP is a strong indicator of C2 beaconing?

Tunneling encodes actual data into what should just be a hostname label.

✦ Answer the questions to complete this task

Which characteristic of a DNS query is most indicative of tunneling rather than normal name resolution?

💪 Exercises & Challenges

📝 MCQ Hard +20 XP

Network Forensics: PCAP Analysis Lab MCQ

Test your understanding of Network Forensics: PCAP Analysis Lab.

Start →
⚙️ Practical Hard +35 XP

Filter and Extract IOCs from a Described Capture

Given a described PCAP showing: repeated connections every 45 seconds to 198.51.100.23 on port 8443, each connection transferring roughly the same 1.2KB of data, write (1) the Wireshark display filter

Start →
🚩 Challenge Hard +60 XP

Identify the Exfiltration Technique

A PCAP investigation finds DNS queries like the following, repeated hundreds of times over an hour, all resolving TXT records against the same domain: aGVsbG8gd29ybGQ.data-relay.badhost.net c2VjcmV0I

Start →