Detecting and Analyzing Suspicious Traffic with Wireshark

Ronald Farrer
3 min readJul 24, 2023
Photo by Rasyid Maulana on Unsplash

In this post, we’re going to dive into the robust world of packet analysis using Wireshark, one of the most widely utilized network protocol analyzers available today. Our main goal is to understand how to capture and analyze suspicious network traffic, specifically focusing on a case where a Remote Code Execution (RCE) exploit has been performed. In this hypothetical scenario, we have three main actors:

  1. Suspicious Source IP — 192.168.0.66
  2. Victim IP — 192.168.0.33
  3. Local IP (our device) — 192.168.0.77

Our mission is to detect and analyze the suspicious traffic between the source and victim IPs, with a view of better understanding the nature of the potential attack and aid in planning a response.

Setting up Wireshark

The first step is installing and configuring Wireshark, which can be downloaded from its official website. Once installed, launch Wireshark and select the appropriate network interface that you want to monitor. This would typically be the interface that is connected to the same network as your suspicious source and victim IPs.

Capturing Suspicious Traffic

With Wireshark running and the right network interface selected, we can start capturing packets. But we don’t want to capture everything — that could potentially lead to information overload. Instead, we want to apply a filter that specifically targets traffic from our suspicious source IP to the victim IP.

In the Wireshark filter bar, we can input the following expression:

ip.src == 192.168.0.66 && ip.dst == 192.168.0.33

This will capture packets originating from 192.168.0.66 (the suspicious IP) and heading to 192.168.0.33 (the victim IP).

Analyzing the Capture

Once you’ve captured sufficient data, stop the packet capture by clicking on the stop button. Now it’s time to dig into the data.

As we’re interested in a potential RCE attack, we should be looking for unusual patterns or protocols that could indicate such an exploit. Common signs may include unexpected incoming traffic on ports commonly associated with services that can execute remote code (such as HTTP or SMB), repeated attempts to connect to a specific port, or evidence of a shell running on the victim machine (like reverse shell connections).

Look at the different protocols involved, the ports used, the frequency of the connections, and the payload of the packets. Right-click on a packet and select ‘Follow TCP/UDP Stream’ for a closer look at the packet content.

Using Additional Tools

Wireshark is an excellent tool, but sometimes additional tools can aid in our analysis. For instance, NetworkMiner can help reconstruct files or sessions from pcap data, which can be useful in getting a clearer picture of an attack.

Wrapping up

Once you’ve analyzed the data, you should have a better understanding of what the suspicious traffic was trying to do. In the case of an RCE exploit, you might be able to determine what code was attempted to be executed, and on which service. This information is vital for network administrators to patch vulnerabilities and ensure the future security of the system.

Remember, network monitoring and packet analysis is a continuous process. Attackers are continually evolving, and so too should our strategies for defense. Stay vigilant, keep learning, and keep your networks safe.

I Love Coffee! https://ko-fi.com/canutethegreat

--

--