Dissecting network traffic
Protocol Dissectors
What sets Wireshark apart from the rest of the packet-sniffing programs is its large number of protocol dissectors. In effect, Wireshark is able to understand each major network protocol (SSH, Telnet, NTP, etc.) in depth and not only display information in a more friendly format but allow you to filter it with more options. With Wireshark, you can filter not only for web traffic,
tcp.dstport == 80 or tcp.dstport == 443
but also for specific components within an HTTP connection, such as a response code (only show 404 errors):
http.response.code == 404
Or, you can find any cookies containing the string sessionid:
http.cookie contains "sessionid"
HTTP isn't the only protocol that Wireshark understands; at last count, Wireshark had around 1,000 protocol dissectors (although not all are as complete as the HTTP protocol dissector). Unfortunately, these protocol dissectors can also be a significant problem, with around 85 vulnerabilities [4] ranging from simple denial-of-service problems to buffer overflows with code execution.
GeoIP
Wireshark now also supports GeoIP, which is a set of libraries that can be used to query the MaxMind Geographic IP database (basically a list of IPs and networks and the countries they physically reside in). For free, you can get access to the country data, which means you can create filters in Wireshark to show all traffic from a specific country,
ip an ip.geoip.country == "China"
such as China.
Build a Network Recorder
Unless you run Wireshark 24 hours a day, you will have to recreate any problems while examining the network traffic with Wireshark. Or will you?
The good news is that hard drives are ridiculously cheap now (a terabyte is less than US$ 100 for the raw disk space), and each terabyte disk means you can store 30GB per day for 30 days (more if your network is quiet on the weekends). The tshark program makes storing a ring buffer with a set amount of data (100GB worth of traffic, 2TB, etc.) very easy. The -b option
tshark -i eth0 -b filesize:10240 -b files:1000 -w if-eth0
monitors the interface eth0 and creates up to 1,000 files of about 10MB each (for a total of 1GB) with timestamped file names (YYYYMMDDHHMMSS):
if-eth0_00001_20090920041232 if-eth0_00002_20090920041252 if-eth0_00003_20090920041258
These files can then be merged by mergecap if traffic you are interested in spans multiple capture files. The advantage of a ring buffer is that you don't need to rotate files, and you can set a maximum amount of data capture and never worry about it accidentally filling up your hard drive.
Another way to capture network data for later analysis is to use the tcpdump tool. Recent versions of tcpdump usually support the -C option, which starts writing to a new capture file after a specified number of bytes, and the -W option, which limits the number of files created by overwriting old ones when it creates the maximum number of files (thus creating a ring buffer).
Note that you don't need to capture all network traffic to create a log that is useful for tracking down problems; simply recording DNS traffic (port 53 TCP and UDP) will help with many security incidents, such as drive-by downloads, which generate DNS queries to strange domains.
On the other hand, you can simply log outgoing port 80 traffic, which will give you a record of all requests (but not the replies, which would be significantly larger). Much like a video camera, it will not prevent security incidents, but it can give you a pretty good idea of what has happened, and with any luck, it will let you know how many systems were affected by an attack.
« Previous 1 2 3 Next »
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Gnome Fans Everywhere Rejoice for the Latest Release
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.