Table Of ContentWireshark for Network
Forensics
An Essential Guide for IT and Cloud
Professionals
Nagendra Kumar Nainar
Ashish Panda
Wireshark for Network Forensics: An Essential Guide for IT and Cloud Professionals
Nagendra Kumar Nainar Ashish Panda
North Carolina, NC, USA Bangalore, Karnataka, India
ISBN-13 (pbk): 978-1-4842-9000-2 ISBN-13 (electronic): 978-1-4842-9001-9
https://doi.org/10.1007/978-1-4842-9001-9
Copyright © 2023 by Nagendra Kumar Nainar and Ashish Panda
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now
known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not
identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Aditee Mirashi
Development Editor: James Markham
Coordinating Editor: Aditee Mirashi
Cover image designed by eStudioCalamar
Distributed to the book trade worldwide by Springer Science+Business Media New York, 1 New York Plaza,
Suite 4600, New York, NY 10004-1562, USA. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@
springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole
member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc
is a Delaware corporation.
For information on translations, please e-mail booktranslations@springernature.com; for reprint,
paperback, or audio rights, please e-mail bookpermissions@springernature.com.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and
licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales
web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to
readers on GitHub via the book’s product page, located at www.apress.com/. For more detailed information,
please visit http://www.apress.com/source-code.
Printed on acid-free paper
Nagendra Kumar Nainar: I would like to dedicate this book to my
late Chitappah Asokan who never failed to inspire me during my
young age.
Ashish Panda: I would like to dedicate this book to my parents for
making possible everything that I have in life and to my wife and
daughter for all the encouragement and sacrifices.
Naren: I would like to dedicate my contribution to my father
Manikandan and mother Kavithamani who dedicated their time to
support and encourage me in making this contribution possible.
I would also like to dedicate this to my loving sister Dhanya.
Table of Contents
About the Authors ����������������������������������������������������������������������������������������������������xi
About the Contributor ��������������������������������������������������������������������������������������������xiii
About the Technical Reviewer ���������������������������������������������������������������������������������xv
Acknowledgments �������������������������������������������������������������������������������������������������xvii
Introduction ������������������������������������������������������������������������������������������������������������xix
Chapter 1: Wireshark Primer ������������������������������������������������������������������������������������1
Introduction �����������������������������������������������������������������������������������������������������������������������������������1
Get Me Started! �����������������������������������������������������������������������������������������������������������������������������3
macOS �������������������������������������������������������������������������������������������������������������������������������������3
Linux ����������������������������������������������������������������������������������������������������������������������������������������4
Windows Install �����������������������������������������������������������������������������������������������������������������������5
The First Capture ���������������������������������������������������������������������������������������������������������������������6
Understanding a Packet ����������������������������������������������������������������������������������������������������������7
Data Representation ��������������������������������������������������������������������������������������������������������������13
Big Picture: I/O Graphs ����������������������������������������������������������������������������������������������������������������14
Big Picture: TCP Stream Graphs ��������������������������������������������������������������������������������������������������15
Time Sequence (Stevens) ������������������������������������������������������������������������������������������������������15
Time Sequence (tcptrace)������������������������������������������������������������������������������������������������������15
Throughput ����������������������������������������������������������������������������������������������������������������������������16
Round Trip Time ���������������������������������������������������������������������������������������������������������������������17
Window Scaling ���������������������������������������������������������������������������������������������������������������������18
Bigger Picture: Following a Packet Stream ���������������������������������������������������������������������������������19
Biggest Picture: Flow Graphs ������������������������������������������������������������������������������������������������20
CloudShark: The Floating Shark ��������������������������������������������������������������������������������������������21
Summary�������������������������������������������������������������������������������������������������������������������������������������27
v
Table of ConTenTs
Chapter 2: Packet Capture and Analysis ����������������������������������������������������������������29
Sourcing Traffic for Capture ��������������������������������������������������������������������������������������������������������30
Setting Up Port Mirroring �������������������������������������������������������������������������������������������������������30
Remote Port Mirroring �����������������������������������������������������������������������������������������������������������31
Other Mirroring Options ���������������������������������������������������������������������������������������������������������34
Capture Point Placement �������������������������������������������������������������������������������������������������������35
OS-Native Traffic Capture Tools ���������������������������������������������������������������������������������������������������36
UNIX, Linux, BSD, and macOS ������������������������������������������������������������������������������������������������36
Windows ��������������������������������������������������������������������������������������������������������������������������������39
Wireshark-Based Traffic Capture ������������������������������������������������������������������������������������������������41
CLI-Based Capture with Dumpcap or Tshark �������������������������������������������������������������������������41
GUI-Based Capture with Wireshark ���������������������������������������������������������������������������������������43
Capture Modes and Configurations ���������������������������������������������������������������������������������������������45
Promiscuous Mode ����������������������������������������������������������������������������������������������������������������45
Remote Packet Capture with Extcap �������������������������������������������������������������������������������������������47
Remote Capture with Sshdump ���������������������������������������������������������������������������������������������47
Mobile Device Traffic Capture ������������������������������������������������������������������������������������������������49
Android Devices ���������������������������������������������������������������������������������������������������������������������49
Using Third-Party Android App and Sshdump ������������������������������������������������������������������������52
Capture Filtering �������������������������������������������������������������������������������������������������������������������������54
Capture Filter Deep Dive ��������������������������������������������������������������������������������������������������������56
High Volume Packet Analysis �������������������������������������������������������������������������������������������������60
Advanced Filters and Deep Packet Filter �������������������������������������������������������������������������������61
Summary�������������������������������������������������������������������������������������������������������������������������������������63
References for This Chapter��������������������������������������������������������������������������������������������������������64
Chapter 3: Capturing Secured Application Traffic for Analysis ������������������������������65
Evolution of Application Security ������������������������������������������������������������������������������������������������66
Capturing and Analyzing HTTPS ��������������������������������������������������������������������������������������������������69
Basics of HTTPS ��������������������������������������������������������������������������������������������������������������������69
Capturing and Filtering HTTPS Traffic ������������������������������������������������������������������������������������72
vi
Table of ConTenTs
Analyzing HTTPS Traffic ���������������������������������������������������������������������������������������������������������73
HTTPS Filters for Analysis ������������������������������������������������������������������������������������������������������82
Capturing and Analyzing QUIC Traffic ������������������������������������������������������������������������������������������85
Basics of QUIC �����������������������������������������������������������������������������������������������������������������������85
Capturing and Filtering QUIC Traffic ��������������������������������������������������������������������������������������89
Analyzing QUIC Traffic ������������������������������������������������������������������������������������������������������������90
Decrypting QUIC/TLS Traffic ��������������������������������������������������������������������������������������������������98
QUIC Filters for Analysis ��������������������������������������������������������������������������������������������������������98
Capturing and Analyzing Secure DNS �����������������������������������������������������������������������������������������99
Basics of DNS ������������������������������������������������������������������������������������������������������������������������99
Secure DNS �������������������������������������������������������������������������������������������������������������������������������102
Summary�����������������������������������������������������������������������������������������������������������������������������������105
References for This Chapter������������������������������������������������������������������������������������������������������105
Chapter 4: Capturing Wireless Traffic for Analysis �����������������������������������������������107
Basics of Radio Waves and Spectrum ���������������������������������������������������������������������������������������107
Basics of Wireless LAN Technology �������������������������������������������������������������������������������������110
Setting Up 802�11 Radio Tap �����������������������������������������������������������������������������������������������������117
Wireless Capture Using Native Wireshark Tool ��������������������������������������������������������������������118
Wireless Capture Using AirPort Utility ����������������������������������������������������������������������������������119
Wireless Capture Using Diagnostic Tool ������������������������������������������������������������������������������120
Wireless Operational Aspects – Packet Capture and Analysis ��������������������������������������������������121
802�11 Frame Types and Format �����������������������������������������������������������������������������������������122
Wireless Network Discovery ������������������������������������������������������������������������������������������������125
Wireless LAN Endpoint Onboarding �������������������������������������������������������������������������������������127
Wireless LAN Data Exchange �����������������������������������������������������������������������������������������������136
Wireless LAN Statistics Using Wireshark �����������������������������������������������������������������������������140
Summary�����������������������������������������������������������������������������������������������������������������������������������141
References for This Chapter������������������������������������������������������������������������������������������������������142
vii
Table of ConTenTs
Chapter 5: Multimedia Packet Capture and Analysis �������������������������������������������143
Multimedia Applications and Protocols �������������������������������������������������������������������������������������143
Multimedia on the Web ��������������������������������������������������������������������������������������������������������144
Multimedia Streaming ���������������������������������������������������������������������������������������������������������144
Real-Time Multimedia ���������������������������������������������������������������������������������������������������������146
How Can Wireshark Help �����������������������������������������������������������������������������������������������������150
Multimedia File Extraction from HTTP Capture �������������������������������������������������������������������������151
Streaming RTP Video Captures �������������������������������������������������������������������������������������������������152
Real-Time Media Captures and Analysis �����������������������������������������������������������������������������������153
Decrypting Signaling (SIP over TLS) ������������������������������������������������������������������������������������153
Decrypting Secure RTP ��������������������������������������������������������������������������������������������������������158
Telephony and Video Analysis ����������������������������������������������������������������������������������������������163
Summary�����������������������������������������������������������������������������������������������������������������������������������171
References for This Chapter������������������������������������������������������������������������������������������������������172
Chapter 6: Cloud and Cloud-Native Traffic Capture ����������������������������������������������173
Evolution of Virtualization and Cloud �����������������������������������������������������������������������������������������173
Basics of Virtualization ��������������������������������������������������������������������������������������������������������174
Hypervisor – Definition and Types ���������������������������������������������������������������������������������������177
Virtualization – Virtual Machines and Containers ����������������������������������������������������������������178
Traffic Capture in AWS Environment �����������������������������������������������������������������������������������������181
VPC Traffic Mirroring ������������������������������������������������������������������������������������������������������������182
Traffic Capture in GCP Environment ������������������������������������������������������������������������������������������187
Traffic Capture in Docker Environment �������������������������������������������������������������������������������������193
Traffic Capture in Kubernetes Environment ������������������������������������������������������������������������������195
Summary�����������������������������������������������������������������������������������������������������������������������������������201
References for This Chapter������������������������������������������������������������������������������������������������������201
Chapter 7: Bluetooth Packet Capture and Analysis ����������������������������������������������203
Introduction to Bluetooth ����������������������������������������������������������������������������������������������������������204
Communication Models �������������������������������������������������������������������������������������������������������204
Radio and Data Transfer ������������������������������������������������������������������������������������������������������205
viii
Table of ConTenTs
Bluetooth Protocol Stack �����������������������������������������������������������������������������������������������������207
Controller Operations �����������������������������������������������������������������������������������������������������������208
HCI ���������������������������������������������������������������������������������������������������������������������������������������209
Host Layer Operation �����������������������������������������������������������������������������������������������������������209
Application Profile–Specific Protocols ���������������������������������������������������������������������������������210
Tools for Bluetooth Capture �������������������������������������������������������������������������������������������������������212
Linux �����������������������������������������������������������������������������������������������������������������������������������������212
Windows �����������������������������������������������������������������������������������������������������������������������������������213
macOS ���������������������������������������������������������������������������������������������������������������������������������������214
Bluetooth Packet Filtering and Troubleshooting �����������������������������������������������������������������������215
Controller-to-Host Communication ��������������������������������������������������������������������������������������215
Pairing and Bonding ������������������������������������������������������������������������������������������������������������216
Paired Device Discovery and Data Transfer �������������������������������������������������������������������������218
Summary�����������������������������������������������������������������������������������������������������������������������������������220
References for This Chapter������������������������������������������������������������������������������������������������������220
Chapter 8: Network Analysis and Forensics ���������������������������������������������������������221
Network Attack Classification ���������������������������������������������������������������������������������������������������221
Packet Poisoning and Spoofing Attacks ������������������������������������������������������������������������������222
Network Scan and Discovery Attacks ����������������������������������������������������������������������������������225
Brute-Force Attacks �������������������������������������������������������������������������������������������������������������229
DoS (Denial-of-Service) Attacks ������������������������������������������������������������������������������������������230
Malware Attacks ������������������������������������������������������������������������������������������������������������������232
Wireshark Tweaks for Forensics �����������������������������������������������������������������������������������������������234
Autoresolving Geolocation ���������������������������������������������������������������������������������������������������234
Changing the Column Display ����������������������������������������������������������������������������������������������235
Frequently Used Wireshark Tricks in Forensics �������������������������������������������������������������������235
Wireshark Forensic Analysis Approach �������������������������������������������������������������������������������������236
Wireshark DDoS Analysis ����������������������������������������������������������������������������������������������������236
Wireshark Malware Analysis �����������������������������������������������������������������������������������������������241
Summary�����������������������������������������������������������������������������������������������������������������������������������244
References for This Chapter������������������������������������������������������������������������������������������������������244
ix
Table of ConTenTs
Chapter 9: Understanding and Implementing Wireshark Dissectors ��������������������245
Protocol Dissectors �������������������������������������������������������������������������������������������������������������������250
Post and Chain Dissectors ���������������������������������������������������������������������������������������������������253
Creating Your Own Wireshark Dissectors ����������������������������������������������������������������������������������253
Wireshark Generic Dissector (WSGD) ����������������������������������������������������������������������������������253
Lua Dissectors ���������������������������������������������������������������������������������������������������������������������254
C Dissectors�������������������������������������������������������������������������������������������������������������������������257
Creating Your Own Packet ���������������������������������������������������������������������������������������������������������258
Summary�����������������������������������������������������������������������������������������������������������������������������������261
References for This Chapter������������������������������������������������������������������������������������������������������262
Index ���������������������������������������������������������������������������������������������������������������������263
x