Tshark Exercise
Last updated
Last updated
You are a security investigator at a relatively small company. You have just been notified that there might have been a computer virus going around the office and infecting the workstations. Your team managed to capture the network traffic in the office for you to analyze. The
.pcap
file (a data file created using Wireshark that contains the packet data of a network) has been transferred to your remote Ubuntu workstation. In this module, you will use TShark, a free alternative tool to capture network traffic and view already captured data.
In some cases you might not have access to a graphical user interface and therefore can't use tools like Wireshark. This module is focused on basic .pcap
file analysis using TShark. During the module, you will be using TShark to capture files and other data from the .pcap
file.
Without an input file, TShark simply acts like tcpdump. It will capture traffic from the first available network and display its packets to standard output. Alternatively, you can use the -r
flag to specify the network capture file
This may seem complicated, but remember that the command-line output of TShark mirrors the Wireshark interface! The fields from left to right in the command line output are:
Packet number | Time | Source | Destination | Protocol | Length | Info |
---|---|---|---|---|---|---|
The Time field shows when the packet was captured. The Source and Destination fields show the source IP and destination IP of that packet. The Protocol field displays the protocol used. The Length field shows the length of the packet. And finally, the Info field displays any additional info about the packet.
You can filter these packet summaries by piping TShark's output into grep. For example, this command will output the packets with a “200 OK” HTTP status code.
Investigate the .pcap
file with TShark:
The .pcap
file location is /home/student/capture3.pcap
.
The suspicious file you need to investigate is named upgrade-windows-defender.exe
.
You are currently interested in HTTP traffic
How many times has the malicious file been downloaded in the network?
Name one of the IP addresses where the malicious file was downloaded from.
First we have to set a filter:
With just that filter alone, we can't see anything interessting so far, because there are to many http get requests in that capture:
Beside the http get request filter we can grep the name of the suspiscious file:
As we can see the suspiscious file was downloaded 10 times and one of the IP's where the file was downloaded from is: 113.10.152.202
In a previous exercise I did allready learn different methods howto extract files from a tcp dump file. In this case I'll use tshark to extract files relating to http. It's not possible to extract just a single file. I've to extract everything:
I'll grep for upgrade-windows-defender and I'll also take the md5 hashes.
Just a short analysis from virustotal shows that the file is maliscious!
You can also specify the output format for the decoded packet data using the -T
flag. For example, this command will display all HTTP GET requests in JSON format.
Finally, you can process the output from TShark by piping it into other command-line tools such as grep.
Since your preliminary investigation on the virus is done, you decide to analyze the rest of the .pcap
file to see if everything is secure and the traffic encrypted. If malware has been moving around in the network you should make sure that there are no plain text passwords moving around as well.
You remember that you can easily filter what you are looking for in the .pcap
file. When dealing with passwords, you need to filter for POST requests.
Investigate the .pcap
file further with TShark and answer the questions:
What is the password used by the user MozellRobel-EiZ?
What is the password for the user Manager?
What is Archie Shepherd's username?
To get the password of the user MozellRobel-EiZ, run:
To get the password of the user Manager, run:
To get the username of Archie Shepherd, run:
35
29.947879
192.168.0.55
192.168.0.91
HTTP
423
HTTP/1.1 200 OK