Module 2 - Suspicious Traffic Hunting
Module 2 - Suspicious Traffic Hunting
1 Introduction
To see the MAC Address for both the source and destination we can make a quick
change within Wireshark: View > Name Resolution > Resolve Physical Addresses.
Here we see a snapshot of a packet capture. It shows 7 ARP Request packets sent via
broadcast. Via physical address name resolution within Wireshark the source device
seems to be a Cisco device and it’s checking on the status of various devices on the network.
Even without knowing off hand what legit device can potentially have
that MAC address on your network but just based on the flow and speed
of the ARP Requests we can tell something is odd.
Below is a visualization depicting ping. We’ll see this as packets in the upcoming slides.
The packet capture below reflects Echo (Ping) Requests and Echo (Ping) Replies.
Below we see packet details for the Echo (Ping) Request packet, packet 4.
Type 8 & Code 0 both indicate that this packet is an echo request.
Type 0 & Code 0 both indicate that this packet is an echo reply.
Data should be the same random text string from echo request.
If so then ping utility will report success back to the command line.
3 Way Handshake
SYN
SYN + ACK
ACK
Time Time
We will not be digging into every packet detail for TCP but simply be able
to recognize the important parts of TCP behavior and overall packet
structure.
The 2 following slides will display the official definition from the online
Wireshark Wiki, here.
Threat Hunting - © Caendra Inc 2017 - All Rights Reserved
Normal TCP
“By default Wireshark and TShark will keep track of all TCP sessions
and convert all Sequence Numbers (SEQ numbers) and
Acknowledge Numbers (ACK Numbers) into relative numbers.
“This means that all SEQ and ACK numbers always start at 0
for the first packet seen in each conversation.
This makes the numbers much smaller and easier to read and
compare than the real numbers which normally are initialized
to randomly selected numbers in the range 0 - (2^32)-1
during the SYN phase.”
We can go into Wireshark and make a quick change, Edit > Preferences >
Protocols > TCP > Relative sequence numbers (uncheck box), to see the
sequence and acknowledgment numbers.
Below is a snapshot of a ping sweep performed with Nmap. This particular ping sweep used
Echo (Ping) Requests and TCP SYN connections to ports 80 & 443.
Remember from the ICMP section that it was mentioned to look out for Timestamp Requests
following an Echo (Ping) Request. We are seeing that combination in the packets above.
As mentioned in the suspicious TCP traffic checklist, many TCP SYN packets without the
corresponding SYN/ACK packets should raise a flag. Here we see a port scan.
Wireshark gives us a helping hand to let us know something is awry with this traffic.
Below is a visualization depicting DORA. We’ll see this as packets in the upcoming slides.
DHCP Discover
DHCP Offer
DHCP Request
DHCP Acknowledgement
Below we see DORA (DHCP Discover, DHCP Offer, DHCP Request, & DHCP ACK)
We see this is a
DHCP Discover
packet. The protocol
and ports being used
look correct.
In Wireshark DHCP is
still referenced as
BOOTP. When using
display filters BOOTP
will assist you on
filtering DHCP traffic.
This transaction,
0x3d13, will end with
the DHCP ACK packet
You can learn more, or freshen up, on DNS here and here.
Here we see 4 packets: 2 packets for DNS Queries and 2 for DNS Responses.
Also notice that there are 2 different transaction IDs for the packets:
0xde40 & 0xa620.
In the next slide we’ll look at the packets with transaction ID 0xde40.
Below we can verify that this is a UDP packet and it’s using an expected port, 53.
Here we see 3 packets & all packets share 1 transaction ID. We also see
some AXFR which let’s us know that this DNS Query is pertaining to a DNS
Zone Transfer.
Let’s take a closer look at the packet details for this zone transfer.
So why was TCP used instead of UDP? The occurs when the response to a DNS query is too
large to fit within a single UDP packet. So the query is resubmitted via TCP to retrieve the
entire contents of the response. DNS Responses for zone transfer occur over TCP/53.
In the image above we see the packet information as it pertains the different layers of the
OSI model.
• Ethernet II = MAC Addresses (SRC, DST)
• Internet Protocol Version 4 = IP Address (SRC, DST)
• Transmission Control Protocol = TCP (SRC PORT, DST PORT)
• Hypertext Transfer Protocol = HTTP
So far we can tell that the traffic is using an expected port, port 80.
Remember that this port doesn’t necessarily have to be port 80. An
organization can decide to use a different port altogether but we know
the standard port is 80 and if it’s port 80 then we’re expecting web
traffic.
Here we’re looking at the HTTP section of the packet details. The HTTP method is GET
and the host is not in FQDN format. So typically IP addresses would be suspicious but
in this case its pointing to an internal server and that is normal behavior in corporate
environments. The source host has an IP of 10.54.15.100.
If we double click the link, [Response in frame: 9], in the HTTP section of the packet details of packet 7 we’ll
jump to packet 9 which contains the packet details of the HTTP response to the HTTP request. Within this packet
we can do the same, jump back to packet 7 using the link [Request in frame: 7].
Above we notice a section called Line-based text data: text/html within the packet
details. We can clearly see that the packet is returning a login page for the server.
Now before looking at cleartext credentials let’s test our packet analysis skills.
How many TCP streams are there in packet capture below?
1. From the packet capture we can see different source ports so each different source
port will have it’s own TCP Handshake followed by it’s corresponding traffic.
2. Another way this can be done is by using a display filter and increment the number of
the TCP Stream. You will know its not a valid TCP Stream because of no visible packets.
3. Under the TCP tab in Conversations we can see there are 3 TCP Streams. From here we
can select a stream and choose Follow Stream from bottom right corner.
2. Using the Export HTTP Object feature we can quickly see pertinent information
regarding the packet. By saving the objects they can be opened later for further
inspection, especially if any binaries or scripts are exported.
Before we dive deeper into this PCAP let’s take a moment to glance at it to see if we
can spot anything that might look odd.
Glancing further at the PCAP, a few packets down we can see more indications of SQLi
attempts. Looking at packets 32 and 44 we can see that the person didn’t make a typo
request at packet 20. This is indeed an attempt to find SQLi on the server.
By looking back to the initial packet of interest, packet 20, we can look at the Line-
based text data: text/html portion of the packet details and notice that error messages
are being displayed to the individual conducting the SQLi queries.
Let’s take a closer look at packet 56. Indeed no SQLi is visible within this packet but
something else should have already jumped out at us, the User-Agent. The User-Agent
for this HTTP Get Request is Sqlmap. So the attacker didn’t quit, he/she escalated.
So clearly we see the packets are getting more interesting due to Sqlmap and it’s
attempts to find and validate SQLi.
So here we have the last HTTP Get Request showing a very long query to test for SQLi
on the internal web server and again Sqlmap seems to be the tool that is being used by
the culprit and from here we can inspect the web server logs to investigate further.
Before inspecting the logs pertaining to the web server of interest we already
have a good idea of the source host from which these queries originated from,
10.124.211.200, which is on the same subnet as the web server.
We also know that the individual manually tested for SQLi before running
Sqlmap against the web server.
Now the hunt goes to find out if this is an malicious employee or someone has
infiltrated the network. That quest is for another time ...
We will not dive too deep into the handshake used by HTTPS traffic
but there are certain details within the packets that we should be
familiar with. Those details will be pointed out in the upcoming
slides. If you want to dive deeper into how HTTPS establishes
secure communications please refer to RFC 6101 for SSL 3.0 & RFC
5246 for TLS 1.2.
The traffic is unreadable but if this is internal traffic within our corporate environment
then it is feasible to decrypt this traffic using the private key from the internal server.
Most enterprise appliances has this feature built-in but you will need to perform
this task manually if you wish to read the decrypted traffic.
Threat Hunting - © Caendra Inc 2017 - All Rights Reserved
Normal HTTPS
Note: This packet capture using SSLv3 and the handshake is different from what we seen
in the previous packet capture which used TLSv1.2.
Before doing so, let’s take a look at the Export HTTP object list
to see if anything is shown that we can export from the
packet capture.
We see from the screenshot below that there is nothing shown that we can export.
Here is the information which was entered. Your configuration should look similar
except for the location of the key file of course.
If after you enter the information for the key file and the
packet capture is not showing decrypted traffic, try closing
Wireshark and re-opening it. That might resolve your issue if
everything was configured correctly.
Threat Hunting - © Caendra Inc 2017 - All Rights Reserved
Normal HTTPS
Both threats also employed a custom protocol via TCP Port 443 to
communicate with their command-and-control (C&C) servers.” –
Trend Labs
Let’s start by taking a look at the different protocols within this packet capture,
Statistics > Protocol Hierarchy
Next we can look at Statistics > Endpoints. We see there is a lot of traffic to several
countries of concern, meaning that malware is known to originate from these destinations.
Now we’ll look at Statistics > Conversations. We are noticing a lot of traffic on port 443 to
85.14.243.9. This matches to what we seen within the Endpoints window.
We don’t see any packets showing the SSL/TLS Handshake that is required for encrypted
communication between both nodes.
One last thing to point out is that the Secure Sockets Layer field of the
packet shouldn’t be empty like how we see it in the packet details below.
You can read more about the AOL Instant Messenger (AIM)
dissector, here.
To properly use the AIM dissector with this PCAP, we need to set the
fields as such.
This is packet 167 prior to decoding the traffic with the AIM
dissector.
You can read more about that here. You can also find
dissectors on the web.
This is ascreenshot
of the
NetworkMiner
interface.
We will look at
NetworkMiner
closer within the
Videos section and
you’ll be using it
within the Labs
section.
We have covered:
Wireshark Dissector
NetworkMiner
(Add)