Capture, Filter, and Navigate: The Wireshark Workflow
From Raw Packets to Security Insights
Wireshark is the most widely used network protocol analyzer. It captures raw network traffic and presents it in a structured, human-readable format. For security professionals, Wireshark is both a diagnostic tool and a forensic instrument — it lets you see exactly what crossed the wire, which is the ground truth that no log file can contradict.
Capturing Traffic
Wireshark captures traffic by putting the network interface into promiscuous mode, allowing it to see all traffic on the network segment, not just traffic addressed to the capturing host.
Capture options that matter for security:
Capture filter: Applied at the kernel level before packets are stored. Use
host 192.168.1.100 and port 443to capture only traffic to/from a specific host on a specific port. Capture filters use BPF (Berkeley Packet Filter) syntax.Promiscuous mode: Captures all traffic on the segment, not just traffic addressed to the capturing host. Essential for seeing other hosts' traffic on a shared network.
Monitor mode (wireless): Captures all wireless traffic on a channel, not just traffic associated with your network. Required for wireless security analysis.
# Command-line capture with tshark (Wireshark's CLI equivalent)
tshark -i eth0 -f "host 192.168.1.100" -w capture.pcap
# Capture only DNS traffic
tshark -i eth0 -f "port 53" -w dns_capture.pcap
# Capture with ring buffer (rotate files every 100MB)
tshark -i eth0 -b filesize:100000 -w capture.pcap
Display Filters: Isolating What Matters
A capture file may contain millions of packets. Display filters let you isolate the traffic relevant to your investigation. Display filters are applied after capture and use Wireshark's filter syntax.
Essential display filters for security analysis:
# Filter by IP address
ip.addr == 192.168.1.100
ip.src == 192.168.1.100
ip.dst == 192.168.1.100
# Filter by port
tcp.port == 443
udp.port == 53
# Filter by protocol
http
dns
arp
icmp
# Filter by TCP flags (useful for scan detection)
tcp.flags.syn == 1 && tcp.flags.ack == 0 # SYN packets (connection attempts)
tcp.flags.reset == 1 # RST packets (connection resets)
tcp.flags.fin == 1 # FIN packets (connection close)
# Filter by HTTP attributes
http.request.method == "POST"
http.response.code == 404
http.host == "example.com"
http.user_agent contains "sqlmap"
# Filter by DNS attributes
dns.qry.name contains "tunnel"
ns.qry.type == 16 # TXT records (tunneling indicator)
# Combine filters
ip.addr == 192.168.1.100 && tcp.port == 443
http.request.method == "POST" && http.host == "bank.example.com"
The Wireshark Interface: Three Panes
Wireshark displays captured traffic in three panes:
Packet list (top): One line per packet — number, time, source, destination, protocol, length, info. This is your overview. Color coding highlights protocol types and anomalies.
Packet details (middle): The protocol stack for the selected packet, expandable to show each layer's fields. This is where you inspect individual packet contents.
Packet bytes (bottom): The raw hexadecimal and ASCII representation of the packet. This is the ground truth — what actually crossed the wire.
Color Coding and Expert Info
Wireshark color-codes packets by protocol and anomaly:
- Light blue: TCP traffic
- Light purple: UDP traffic
- Light green: HTTP traffic
- Red: Errors (TCP retransmissions, malformed packets, RST)
- Black: Packets with problems (duplicate ACKs, zero windows)
Expert Info (Analyze → Expert Information) aggregates anomalies:
- Errors: Malformed packets, checksum errors
- Warnings: Retransmissions, duplicate ACKs, zero windows
- Notes: Keep-alive, window updates, TCP window full
- Chats: Connection establishment, teardown
For security analysis, focus on Errors and Warnings — they indicate network problems, scanning activity, or evasion attempts.
Following Streams, Detecting Anomalies, and Reconstructing Sessions
The Analysis Techniques That Find Attacks
Following TCP Streams
The most powerful feature for security analysis is Follow TCP Stream (right-click a packet → Follow → TCP Stream). This reassembles all packets in a TCP connection in order, showing the complete application-layer conversation.
# Example: Following an HTTP session
# The stream shows the full request/response:
GET /api/users/1 HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOi...
HTTP/1.1 200 OK
Content-Type: application/json
{"id": 1, "username": "admin", "email": "admin@example.com"}
Forensic value: You see exactly what data was transmitted, including credentials in Authorization headers, session tokens in cookies, and payloads in POST bodies. This is the ground truth — no application log can contradict what you see in the TCP stream.
Color coding in stream view: Red is client-to-server traffic, blue is server-to-client traffic. This makes it easy to distinguish requests from responses.
Detecting Port Scans
Port scans produce distinctive packet patterns:
SYN scan (half-open scan):
# Attacker sends SYN to many ports, never completes handshake
# Wireshark filter:
tcp.flags.syn == 1 && tcp.flags.ack == 0
# Pattern: one SYN packet to each port, no response or RST response
# High volume of SYN packets from a single source to many ports = SYN scan
Connect scan (full handshake):
# Attacker completes the three-way handshake on each port
# Pattern: SYN → SYN-ACK → ACK → RST (immediate close)
# Look for: many short-lived connections from a single source
NULL/FIN/Xmas scans:
# Attacks that send packets with unusual flag combinations to evade detection
# NULL: no flags set
# FIN: only FIN flag set
# Xmas: FIN, PSH, URG flags set (like a Christmas tree)
# Wireshark filter for unusual flag combinations:
tcp.flags == 0x001 # FIN only
tcp.flags == 0x000 # NULL (no flags)
tcp.flags == 0x029 # Xmas (FIN+PSH+URG)
Detection: A single source IP sending SYN packets to hundreds of ports within seconds is almost certainly a port scan. Use Wireshark's Statistics → Conversations to see which source IP has the most connections.
Detecting ARP Spoofing
ARP spoofing produces a distinctive pattern: multiple IP addresses mapped to the same MAC address.
# Wireshark filter for ARP traffic
arp
# Look for:
# 1. Multiple ARP replies from the same MAC address claiming different IPs
# 2. Gratuitous ARP replies (ARP reply without a preceding request)
# 3. ARP replies where the sender MAC differs from the Ethernet source MAC
# Wireshark filter for gratuitous ARP:
arp.opcode == 2 # ARP reply (opcode 2) without a request
Detection: In the packet list, look for ARP replies where the same MAC address appears as the sender for multiple IP addresses. This indicates the ARP spoofer is claiming to be multiple devices.
Detecting Data Exfiltration
Data exfiltration through network traffic shows several patterns:
Large outbound transfers:
# Use Statistics → Conversations to find the largest data transfers
# Look for: a single internal host sending large amounts of data to an external IP
# Filter for large packets:
frame.len > 10000
DNS tunneling:
# Filter for DNS queries with long subdomain names:
dns.qry.name.len > 50
# Filter for TXT record queries (rare in normal traffic):
dns.qtype == 16
# Look for: high volume of DNS queries from a single host to the same domain
Periodic beaconing:
# Command-and-control traffic often shows regular intervals
# Use Statistics → I/O Graph to visualize traffic over time
# Look for: regular spikes at consistent intervals (e.g., every 60 seconds)
Protocol Hierarchy and Conversations
Statistics → Protocol Hierarchy shows the breakdown of traffic by protocol. A sudden increase in an unusual protocol (e.g., ICMP, Teredo, or a proprietary protocol) may indicate tunneling or malware communication.
Statistics → Conversations shows all communication pairs (who talked to whom, how much data, how long). For security analysis:
- Sort by bytes — the largest transfers may indicate exfiltration
- Sort by duration — long-lived connections may indicate persistent access
- Look for internal hosts communicating with unexpected external IPs
- Look for internal hosts communicating with each other on unusual ports (lateral movement)
Practical Investigation Workflow
When investigating a security incident with Wireshark:
Start with the timeline: When did the incident occur? Filter to that time window.
Identify the involved hosts: Filter by the affected IP addresses.
Follow the TCP streams: Reconstruct the application-layer conversations to see what data was transmitted.
Look for anomalies: Use Expert Info to find errors, retransmissions, and unusual patterns.
Correlate with other data: Compare packet findings with firewall logs, EDR alerts, and authentication logs.
Document findings: Export specific packets (File → Export Specified Packets) as evidence.
Practice Problems
Solution
This is DNS tunneling exfiltration. The indicators: (1) high volume of DNS queries from a single host, (2) long random-looking subdomains (data encoded in the subdomain labels), (3) newly registered domain (attackers use fresh domains to avoid blocklists). To confirm and quantify: (1) Use the display filter dns.qry.name.len > 50 to isolate the tunneling queries. (2) Follow the DNS queries and extract the subdomain labels — these contain the encoded data (usually base64 or hex). (3) Use Statistics → Conversations to quantify the total bytes transferred via DNS. (4) Reassemble the data by concatenating the subdomain labels in order and decoding them. (5) Check the TXT record responses — they may contain command-and-control instructions from the attacker. The total volume of DNS queries × average subdomain length gives you the approximate amount of data exfiltrated. Solution
This is ARP spoofing (ARP cache poisoning). The attacker is sending gratuitous ARP replies associating their MAC address (00:11:22:33:44:55) with both the gateway's IP and the workstation's IP, causing traffic between the gateway and workstation to flow through the attacker's machine. To confirm in Wireshark: (1) Filter for ARP traffic: arp. (2) Look for ARP replies (opcode 2) without preceding requests — these are gratuitous ARP replies, which are normal in small numbers but suspicious when they claim multiple IPs. (3) Check if the same MAC address appears as the sender for multiple IP addresses — this is the definitive indicator. (4) To identify the attacker's machine: the MAC address 00:11:22:33:44:55 is the attacker's NIC. Look up the OUI (first 3 bytes: 00:11:22) in the IEEE OUI database to identify the manufacturer. (5) Use Statistics → Endpoints to find all traffic from this MAC address — this reveals what other systems the attacker is targeting. (6) Check the switch's MAC address table (via SNMP or switch CLI) to identify the physical port the attacker is connected to. Quiz
1. In Wireshark, what is the difference between a capture filter and a display filter?
2. What Wireshark feature would you use to reconstruct a complete HTTP session including all request headers, response headers, and body content?
3. You are analyzing a capture and notice a single source IP sending SYN packets to 500 different ports on a target host within 10 seconds. No other traffic is present. What does this indicate, and what Wireshark filter would isolate this activity?
Flashcards
Question
What is the difference between capture filters and display filters in Wireshark?
Click to reveal answer
Answer
Capture filters use BPF syntax and are applied at the kernel level during capture (determines what is stored). Display filters use Wireshark syntax and are applied after capture (determines what is displayed).
Question
What Wireshark feature reconstructs a complete TCP session?
Click to reveal answer
Answer
Follow TCP Stream (right-click → Follow → TCP Stream). Reassembles all packets in a TCP connection in order, showing the full application-layer conversation.
Question
What Wireshark filter detects SYN scan activity?
Click to reveal answer
Answer
tcp.flags.syn == 1 && tcp.flags.ack == 0 — isolates SYN packets (connection initiation attempts) that are not part of an established connection. High volume from a single source to many ports indicates a SYN scan.
Question
How do you detect ARP spoofing in Wireshark?
Click to reveal answer
Answer
Filter for ARP traffic (arp) and look for multiple IP addresses mapped to the same MAC address. Gratuitous ARP replies (opcode 2 without a preceding request) claiming different IPs are the definitive indicator.
Question
What Wireshark features help identify data exfiltration?
Click to reveal answer
Answer
Statistics → Conversations (find largest transfers), dns.qry.name.len > 50 (DNS tunneling), frame.len > 10000 (large packets), and Statistics → I/O Graph (periodic beaconing patterns).
Question
What is Wireshark's Expert Info and why is it useful for security analysis?
Click to reveal answer
Answer
Analyze → Expert Information aggregates anomalies: Errors (malformed packets), Warnings (retransmissions, duplicate ACKs), Notes (keep-alive, window updates). Useful for quickly identifying network problems, scanning activity, and evasion attempts without manually inspecting every packet.
Revision Notes
Key Takeaways
- 1. Capture filters (BPF syntax) determine what is stored; display filters (Wireshark syntax) determine what is displayed
- 2. Follow TCP Stream is the most powerful feature for reconstructing application-layer sessions
- 3. SYN scans are detected by filtering for SYN packets without ACK from a single source to many ports
- 4. ARP spoofing is identified by finding the same MAC address claiming multiple IP addresses
- 5. DNS tunneling is detected by long subdomain names and high query volume to newly registered domains
- 6. Statistics → Conversations and Protocol Hierarchy provide quick overviews of traffic patterns and anomalies
Interview Tips
- • Be ready to write Wireshark display filters for specific scenarios — this is a common practical interview exercise
- • Explain how you would use Wireshark to investigate a specific incident (e.g., suspected data exfiltration, ARP spoofing, port scan)
- • Discuss the difference between capture filters and display filters and when to use each
- • Describe how Follow TCP Stream helps reconstruct application-layer data and why this is the ground truth
- • Connect packet analysis to defense — the same techniques used for investigation can be used for proactive threat hunting
Cheat Sheet
Packet Analysis with Wireshark Cheat Sheet
Phase: Networking for Security | Level: intermediate
Essential Display Filters:
ip.addr == 192.168.1.100 # Traffic to/from a host
tcp.port == 443 # Traffic on a port
http.request.method == "POST" # HTTP POST requests
tcp.flags.syn == 1 && tcp.flags.ack == 0 # SYN packets (scan detection)
arp.opcode == 2 # ARP replies (spoofing detection)
dns.qry.name.len > 50 # Long DNS subdomains (tunneling)
http.response.code == 404 # 404 responses (enumeration)
Key Analysis Techniques:
- Follow TCP Stream: Reconstruct complete sessions (credentials, tokens, payloads)
- Statistics → Conversations: Find largest transfers, unusual connections
- Statistics → Protocol Hierarchy: Identify unexpected protocols
- Statistics → I/O Graph: Visualize traffic patterns (beaconing detection)
- Analyze → Expert Info: Aggregate anomalies (errors, warnings)
Attack Detection Patterns:
| Attack | Indicator | Filter |
|---|---|---|
| SYN scan | SYN to many ports | tcp.flags.syn==1 && tcp.flags.ack==0 |
| ARP spoofing | Same MAC, multiple IPs | arp.opcode==2 |
| DNS tunneling | Long subdomains, TXT queries | dns.qry.name.len>50 |
| Exfiltration | Large outbound transfers | frame.len>10000 |
| Beaconing | Regular interval spikes | I/O Graph visualization |
Investigation Workflow:
- Filter to incident time window
- Identify involved hosts
- Follow TCP streams
- Check Expert Info for anomalies
- Correlate with other log sources
- Export evidence packets
Continue Learning
Before You Start
- No prerequisites listed.