Wireshark Traffic Analysis
In this TryHackMe room, we will be using basic and advanced Wireshark techniques of traffic analysis to detect suspicious activities.
What is the total number of the “TCP Connect” scans?
To answer this question, we need to figure out what a TCP Connect scan is.
Using Nmap, TCP Connect scans are usually conducted using “nmap -sT” command. The scan type relies on the TCP three-way handshake to identify hosts/services. It can be used by non-root users and has a windows size larger than 1024 bytes.
The hand shake process differs on whether the TCP port is open or closed
-
SYN —>
<—SYN, ACK
ACK —>
(RST, ACK —>)
-
SYN —>
<— RST,ACK
Using Wireshark, we will have to create a display filter to figure out how many TCP Connects scans were conducted.
Whether the TCP port is open or closed, we know that our SYN flag has to be set to 1. We do not need to validate whether our server sent a SYN/ACK packet back because it’s asking about what the server received. We should also include the window size being greater than 1024 just incase. Therefore, our filter will be
tcp.flags.syn == 1 and tcp.flags.ack == 0 and tcp.window_size > 1024
Which scan type is used to scan the TCP port 80?
To answer this question, we need to figure out what packets were sent to our server via port 80. We can verify this using this filter command:
tcp.port == 80
After looking at the initial packet, we can identify the following steps:
A SYN packet was sent from source port 42026 to the destination port 80.
The port 80 then sent a SYN/ACK packet back to port 42026
Afterwards, port 42026 sent an ACK packet back to port 80.
An additional RST/ACK packet was then sent by port 42026 to port 80 to establish the end of the connection.
This is a textbook TCP Acknowledgement. Therefore it has to be a TCP Connect Scan.
How many “UDP close port” messages are there?
To answer this question, we need to figure out how a UDP scan works. The command is usually conducted using “nmap -sU”.
It does not require a handshake process. Specifically, it shows an ICMP type 3 error message (Destination unreachable) for closed UDP ports and no message for open UDP ports.
We can investigate the amount of UDP close port messages by using this filter:
icmp.type == 3
Which UDP port in the 55-70 port range is open
To answer this question, we will need to figure out a filter that will only give us the ports between 55 and 70. To be even more specific, we need to specify that we only want UDP packets, not TCP. We also need to specify that we want to see connections made only to our ports.
Therefore, the filter will be:
udp.dstport > 55 && udp.dstport < 70
What is the number of ARP requests crafted by the attacker?
To answer this question, we first need to identify which mac address was the target of the attacker. We can verify this by looking for a “duplicate IP address detected” error. We would then type this into the filter:
arp.duplicate-address-detected
The next step is to type the duplicated MAC address into the filter. Because the question is asking about only the attacker, you want to indicate that source MAC address, not the destination. Therefore the filter command will be:
(arp.opcode == 1) && (arp.src.hw_mac == 00:0c:29:e2:18:b4)
We added (arp.opcode ==1) because we only want to filter for requests, not responses.
The final answer is 284
What is the number of HTTP packets received by the attacker?
We know that the attackers spoofed mac address is 00:0c:29:e2:18:b4. Therefore, we need to filter our results to only include the destination of the spoofed mac address and look for HTTP packets. The filter command is:
eth.dst == 00:0c:29:e2:18:b4 && http
What is the number of sniffed username&password entries?
To answer this, we need to find unencrypted HTTP POST Method. If we scroll to the right, we have some.
In order to find the total count of username and password entries, we will add this specific POST request to our filter.
http.request.full_uri == "http://testphp.vulnweb.com/userinfo.php"
What is the password of the "Client986"?
Inside of one of the packets, you will find the answer in the packet details box under “HTML Form URL Encoded”.
The answer is clientnothere!
What is the comment provided by the "Client354"
Remove everything out of the display filter and then press “Ctrl+F” to view the Find tool. Afterwards, type in the name “Client354” and view the packet details box under “HTML Form URL Encoded” to view the comment left behind.
The answer is Nice work!
DHCP, NetBIOS, and Kerberos
-
DHCP (Dynamic Host Configuration Protocol) is the protocol responsible for automatically assigning IP addresses and other communications parameters to devices connected to the network.
Options:
Option 3 = DHCP Request
Option 5 = DHCP ACK
Option 6 = DHCP NAK
Option 12 = Hostname
Option 15 = Domain name
Option 50 = Requested IP address
Option 51 = Requested IP lease time
Option 56 = Message (rejection details/reason)
Option 61 = Client's MAC address
-
NetBIOS (Network Basic Input/Output System) is responsible for allowing applicatications on seperate computers to communicate over a LAN.
-
Kerberos is the default authentication service for Microsoft Windows. It is responsible for authenticating service requests between two or more computers over an untrusted network. It works on the basis of tickets to allow nodes communicating over a non-secure network to prove their identity to one another in a secure manner.
pvno = Protocol version.
realm = Domain name for the generated ticket.
sname = Service and domain name for the generated ticket.
addresses = Client IP address and NetBIOS name.
Lab Questions:
What is the MAC address of the host "Galaxy A30"?
How many NetBIOS registration requests does the "LIVALJM" workstation have?
Which host requested the IP address "172.16.13.85"?
What is the IP address of the user "u5"? (Enter the address in defanged format.)
What is the hostname of the available host in the Kerberos packets?
What is the MAC address of the host "Galaxy A30"?
To find this, first type dhcp.option.dhcp == 3 into the filter to search for packets that contain hostname information. We can then utilize the Find tool to look for the packet that contains “Galaxy-A30”
How many NetBIOS registration requests does the "LIVALJM" workstation have?
To find this, first type in nbns.name contains “LIVALJM” into the filter.
Which host requested the IP address "172.16.13.85"?
To find this, filter for DHCP option 3 by typing dhcp.option.dhcp == 3. Now open the Find tool and type in the IP address (172.16.13.85).
What is the IP address of the user "u5"? (Enter the address in defanged format.)
We are trying to find the IP address of a user named “u5”. This user authenticated via Kerberos so we should also specify Kerberos in the filter. This will be our filter: kerberos.CNameString == "u5"
What is the hostname of the available host in the Kerberos packets?
This one was a little confusing. To find the hostnames, we need to do a global search by typing kerberos into the filter. Since we are looking for a hostname, we need to look for CNames. There are two ways we can do this. We can look through each packet or put Cname into its own column.
The column choice seems much easier.
In the Packet Details pane, expand Kerberos -> as-req -> req-body -> cname -> cname-string
You will then see “CNameString:”. Right click on it and click “Apply as Column”.
ICMP and DNS
-
ICMP is designed for diagnosing an reporting network communication issus. It isused in error reporting and testing. It is also used for denial of service attacks. Attackers use utilize ICMP in data exfiltration and C2 tunneling.
-
DNS translates IP domain addresses to IP addresses. It is the “phonebook” of the internet. Attackers commonly use it in data exfiltration and C2 activities.
Both ICMP and DNS attacks begin to appear after malware execution(s) or vulnerability exploitation.
Lab Questions:
Investigate the anomalous packets. Which protocol is used in ICMP tunnelling?
Investigate the anomalous packets. What is the suspicious main domain address that receives anomalous DNS queries? (Enter the address in defanged format.)
Investigate the anomalous packets. Which protocol is used in ICMP tunnelling?
An average ICMP packet is usually 64 bytes. Bigger ICMP packets might show ICMP tunneling. To find unusual packets, use the filter: data. len > 64 && icmp
Investigate the anomalous packets. What is the suspicious main domain address that receives anomalous DNS queries? (Enter the address in defanged format.)
In order to scope out suspecious domain addresses, we want to investigate what IP addresses are making malicious connections. To do this go to Statistics —> Conversations —> IPv4.
HTTPS
HTTPS (Hypertext Transfer Protocol Secure) is the extension of HTTP (Hypertext Transfer Protocol). It has enhanced security against spoofing, sniffing, and intercepting attacks. HTTPS uses TLS (Transport Layer Security) to encrypt communications; thereby, making it impossible to decrypt the traffic without key pairs.
TLS has its own handshake process, similar to TCP. The first two steps are client requests (Server Hello) and server requests (Client Hello)
TLS Types:
Type 1: Client Request
Type 2: Server Response
Lab Questions:
What is the frame number of the "Client Hello" message sent to "accounts.google.com"?
Decrypt the traffic with the "KeysLogFile.txt" file. What is the number of HTTP2 packets?
Go to Frame 322. What is the authority header of the HTTP2 packet? (Enter the address in defanged format.)
Investigate the decrypted packets and find the flag! What is the flag?
What is the frame number of the "Client Hello" message sent to "accounts.google.com"?
The question is asking us for “Client Hello”, meaning the server is communicating with the client. Therefore, our TLS Type in the filter should be Type 1.
tls.handshake.type==1
Decrypt the traffic with the "KeysLogFile.txt" file. What is the number of HTTP2 packets?
To decrypt the traffic, we need to configure Wireshark to read the KeysLogFile.
Investigate the decrypted packets and find the flag! What is the flag?
Because the question is asking specifically about the decrypted packets, we know that is has to be HTTP related. Therefore, we should type HTTP2 into the filter. Afterwards, there will be 115 packets displayed. Upon further examination of the packets, packet 1576 has something worth questioning.