This week, we focus on traffic analysis: once network evidence has been acquired, investigators need to break it down, understand the protocols inside it, and isolate the packets that matter. This is done through two closely related disciplines: protocol analysis and packet analysis.
Protocol Analysis
Protocol analysis is the examination of one or more fields within a protocol's data structure. It is commonly carried out for research (for example, when a protocol's specification has never been published) or as part of a network investigation.
- Best Practice: Take cryptographic checksums of all data during collection, and always work with an exact copy so the original evidence stays intact.
- Where to Find Documentation: The IETF (Internet Engineering Task Force) maintains a large public repository of documented protocols, and RFCs (Requests for Comments) are used to develop and define international internetworking standards. Other sources include the IEEE Standards Association, ISO, and documentation published by vendors and researchers.
Protocol Analysis Tools
- PDML & PSML: Packet Details Markup Language (PDML) expresses packet details for Layers 2–7 in XML format (
tshark -r capturefile.pcap -T pdml), while Packet Summary Markup Language (PSML) captures only the most important protocol details, also in XML (tshark -r capturefile.pcap -T psml). Both are part of the NetBee library, which supports packet processing. - Wireshark: Wireshark has built-in protocol dissectors that automatically interpret and display protocol details, and it supports specific filters. Its default display has three panes: the Packet List (one captured packet per line), Packet Details (every layer Wireshark can interpret for the highlighted packet), and Packet Bytes (hex and ASCII representations of the packet, including Layer 2).
- Tshark: Tshark offers the same functionality as Wireshark through a command-line interface. Useful flags include:
-
tshark -r capturefile.pcap– read a capture file -
tshark -n -r capturefile.pcap– disable name resolution so raw IP addresses and port numbers are shown -
tshark -r capturefile.pcap -T pdml– select the output format -
tshark -r capturefile.pcap -T fields -e frame.number -e ip.addr -e udp– print only specific fields -
tshark -r capturefile.pcap -d tcp.port==29008,http– "decode as" a given protocol -
tshark -r capturefile.pcap -R 'ip.addr == 192.168.1.1'– apply a filter (newer versions of tshark use-Yfor display filters)
-
Protocol Analysis Techniques
Investigators work through three main techniques when analysing protocols.
- Protocol Identification: Look for common binary, hex, or ASCII values associated with specific protocols (e.g.,
0x4500marks the start of an IPv4 packet). Use information in the encapsulating protocol (byte 9 of the IP header indicates the protocol, and0x06means TCP), check TCP/UDP port numbers (port 443 suggests TLS/SSL, so verify the packet is actually encrypted), run a WHOIS lookup on the source or destination IP to understand the server's function, and compare recognisable structures against the RFCs. - Protocol Decoding: This means interpreting frame data based on a known frame structure. Investigators can use publicly available automated decoders, decode traffic manually using public documentation, or write their own decoder.
- Exporting Fields: In Wireshark, the "Export Selected Packet Bytes" option extracts raw data. In tshark, the
-T fieldsand-eflags display only the specific fields you need, and custom Lua dissectors can be loaded with-X lua_script:(e.g., extractingoft.filenameandoft.totsizefrom an OFT file transfer).
Packet Analysis
Packet analysis is the examination of the contents and/or metadata of one or more packets. It is typically used to identify packets of interest and to plan the next steps of flow analysis and content reconstruction.
- Wireshark & Tshark Display Filters: There are over 105,000 display filters, and an open plugin architecture lets you build your own protocol parser. Wireshark's "Expressions" button helps build filters, while tshark accepts them on the command line (e.g.,
tshark -r capturefile.pcap -R "ip.src==192.168.1.158 && ip.dst==10.1.1.10"). - Ngrep: Searches for packets containing particular strings, binary sequences, or patterns, and recognises common protocols (IP, TCP, UDP, and ICMP). However, it does no flow reconstruction, so it matches individual packets rather than flows and will miss data that spans multiple packets (e.g.,
ngrep -I capturefile.pcap "string to search for" 'src host 192.168.1.20 and dst port 80'). - Hex Editors: These let investigators view and manipulate the raw bits of data, which makes them indispensable for isolating specific packet fragments and for file carving. They are especially useful when regular tools fall short; for example, the Loki tunnelling protocol is often not recognised by Wireshark, and most tools cannot see inside compressed files. Common options include Bless, WinHex, and FTK Imager.
Packet Analysis Techniques
- Pattern Matching: Also called a "dirty word search," this uses a list of strings, names, and patterns linked to suspect activity. Ngrep is the best tool for the job (e.g.,
ngrep -I evidence01.pcap 'words|search|for'). - Parsing Protocol Fields: Extracting the contents of protocol fields within packets of interest, for example pulling AIM chat messages out of traffic on port 443:
tshark -r evidence01.pcap -d tcp.port==443,aim -T fields -n -e "aim.messageblock.message". - Packet Filtering: Separating packets based on the values of fields in their protocol metadata or payload. Tcpdump with a BPF filter can dump suspicious conversations into a new file, such as
tcpdump -s 0 -r evidence01.pcap -w evidence01-talkers.pcap 'host 64.12.24.50 and host 192.168.1.158'. The same filtering can also be done in Wireshark.
Reference: Davidoff, S., & Ham, J. (2012). Network Forensics: Tracking Hackers Through Cyberspace. Boston: Prentice Hall.

