Curso de Wireshark
Curso de Wireshark
Wireshark is an essential tool in cybersecurity defense, providing visibility into network traffic to
identify vulnerabilities, detect attacks, and enhance overall security.
2
Time Display Format
Wireshark lists the packets as they are captured, so investigating the default flow is not always the best
option. By default, Wireshark shows the time in "Seconds Since Beginning of Capture", the common
usage is using the UTC Time Display Format for a better view. You can use the "View --> Time
Display Format" menu to change the time display format.
3
Expert Info
Wireshark also detects specific states of protocols to help analysts easily spot possible anomalies and
problems. Note that these are only suggestions, and there is always a chance of having false
positives/negatives. Expert info can provide a group of categories in three different severities. Details
are shown in the table below.
4
Frequently encountered information groups are listed in the table below. You can refer to Wireshark's
official documentation for more information on the expert information entries.
Deprecated protocol
Checksum Checksum errors. Deprecated
usage.
Packet comment Malformed packet
Comment Malformed
detection. detection.
Apply as Filter
This is the most basic way of filtering traffic. While investigating a capture file, you can click on the
field you want to filter and use the "right-click menu"
or "Analyse --> Apply as Filter" menu to filter the specific value. Once you apply the filter,
Wireshark will generate the required filter query, apply it, show the packets according to your choice,
and hide the unselected packets from the packet list pane. Note that the number of total and displayed
packets are always shown on the status bar.
5
Conversation filter
"Conversation Filter" option helps you view only the related packets and hide the rest of the packets
easily. You can use the"right-click menu" or "Analyse -
-> Conversation Filter" menu to filter conversations.
Colourise Conversation
This option is similar to the "Conversation Filter" with one difference. It highlights the linked
packets without applying a display filter and decreasing the number of viewed packets. This option
works with the "Colouring Rules" option ad changes the packet colours without considering the
previously applied colour rule. You can use the "right-click menu" or "View --> Colourise
Conversation" menu to colourise a linked packet in a single click. Note that you can use the "View
--> Colourise Conversation --> Reset Colourisation" menu to undo this operation.
6
Prepare as Filter
Similar to "Apply as Filter", this option helps analysts create display filters using the "right-click" menu.
However, unlike the previous one, this model doesn't apply the filters after the choice. It adds the
required query to the pane and waits for the execution command (enter) or another chosen filtering
option by using the ".. and/or.." from the "right-click menu".
7
Apply as Column
By default, the packet list pane provides basic information about each packet. You can use the
"right-click menu" or "Analyse --> Apply as
Column" menu to add columns to the packet list pane. Once you click on a value and apply it as a
column, it will be visible on the packet list pane. This function helps analysts examine the appearance
of a specific value/field across the available packets in the capture file. You can enable/disable the
columns shown in the packet list pane by clicking on the top of the packet list pane.
8
Follow Stream
Wireshark displays everything in packet portion size. However, it is possible to reconstruct the streams
and view the raw traffic as it is presented at the application level. Following the protocol, streams help
analysts recreate the
application-level data and understand the event of interest. It is also possible to view the unencrypted
protocol data like usernames, passwords and other transferred data.
You can use the"right-click menu" or "Analyse --> Follow TCP/UDP/HTTP Stream" menu to
follow traffic streams. Streams are shown in a separate dialogue box; packets originating from the
server are highlighted with blue, and those originating from the client are highlighted with red.
Once you follow a stream, Wireshark automatically creates and applies the required filter to view the
specific stream. Remember, once a filter is applied, the number of the viewed packets will change. You
will need to use the "X button" located on the right upper side of the display filter bar to remove the
display filter and view all available packets in the capture file.
Statistics
This menu provides multiple statistics options ready to investigate to help users see the big picture
in terms of the scope of the traffic, available protocols, endpoints and conversations, and some
protocol-specific details like DHCP, DNS and HTTP/2. For a security analyst, it is crucial to know
how to utilise the statical information. This section provides a quick summary of the processed
pcap, which will help analysts create a hypothesis for an investigation. You can use the
"Statistics" menu to view all available
9
options. Now start the given VM, open the Wireshark, load the "[Link]" file and go
through the walkthrough.
Resolved Addresses
This option helps analysts identify IP addresses and DNS names available in the capture file by
providing the list of the resolved addresses and their hostnames. Note that the hostname information is
taken from DNS answers in the capture file. Analysts can quickly identify the accessed resources by
using this menu.
Thus they can spot accessed resources and evaluate them according to the event of interest. You can use
the "Statistics --> Resolved Addresses" menu to view all resolved addresses by Wireshark.
Protocol Hierarchy
This option breaks down all available protocols from the capture file and helps analysts view the
protocols in a tree view based on packet counters and percentages. Thus analysts can view the overall
usage of the ports and services and focus on the event of interest. The golden rule mentioned in the
previous
room is valid in this section; you can right-click and filter the event of interest. You can use the
"Statistics --> Protocol Hierarchy" menu to view this info.
10
Conversations
Conversation represents traffic between two specific endpoints. This option provides the list of the
conversations in five base formats; ethernet, IPv4, IPv6, TCP and UDP. Thus analysts can identify
all conversations and contact endpoints for the event of interest. You can use the "Statistic -->
Conversations" menu to view this info.
11
Endpoints
The endpoints option is similar to the conversations option. The only difference is that this option
provides unique information for a single information field (Ethernet, IPv4, IPv6, TCP and UDP ). Thus
analysts can identify the unique endpoints in the capture file and use it for the event of interest. You can
use
the "Statistics --> Endpoints" menu to view this info.
Wireshark also supports resolving MAC addresses to human-readable format using the manufacturer
name assigned by IEEE. Note that this conversion is done through the first three bytes of the MAC
address and only works for the known manufacturers. When you review the ethernet endpoints, you can
activate this option with the "Name resolution" button in the lower-left corner of the endpoints
window.
12
Name resolution is not limited only to MAC addresses. Wireshark provides IP and port name
resolution options as well. However, these options are not enabled by default.
If you want to use these functionalities, you need to activate them through the "Edit -->
Preferences --> Name Resolution" menu. Once you enable IP and port name resolution,
you will see the resolved IP address and port names in the packet list pane and also will be
able to view resolved names in the "Conversations" and "Endpoints" menus as well.
13
Endpoint menu view with name resolution:
Besides name resolution, Wireshark also provides an IP geolocation mapping that helps analysts
identify the map's source and destination
14
addresses.
But this feature is not activated by default and needs supplementary data like the GeoIP
database. Currently, Wireshark supports MaxMind databases, and the latest versions of the
Wireshark come configured MaxMind DB
resolver. However, you still need MaxMind DB files and provide the database path to Wireshark by
using the "Edit --> Preferences --> Name Resolution --> MaxMind database directories" menu.
Once you download and indicate the path, Wireshark will automatically provide GeoIP information
under the IP
protocol details for the matched IP addresses.
15
Up to here, almost all options provided information that contained both versions of the IP addresses.
The statistics menu has two options for narrowing the statistics on packets containing a specific IP
version. Thus, analysts can identify and list all events linked to specific IP versions in a single window
and use it for the event of interest. You can use the "Statistics --> IPvX Statistics" menu to view this
info.
DNS
This option breaks down all DNS packets from the capture file and helps analysts view the findings in a
tree view based on packet counters and percentages of the DNS protocol. Thus analysts can view the
DNS service's overall usage, including rcode, opcode, class, query type, service and query stats and use
it for the event of interest. You can use the "Statistics --> DNS" menu to view this info.
16
HTTP
This option breaks down all HTTP packets from the capture file and helps analysts view the findings
in a tree view based on packet counters and percentages of the HTTP protocol. Thus analysts can
view the HTTP service's overall usage, including request and response codes and the original
requests. You can use the "Statistics --> HTTP" menu to view this info.
17
Bookmarks and Filtering Buttons
We've covered different types of filtering options, operators and functions. It is time to create filters and
save them as bookmarks and buttons for later usage. As mentioned in the previous task, the filter toolbar
has a filter bookmark section to save user-created filters, which helps analysts re-use favourite/complex
filters with a couple of clicks. Similar to bookmarks, you can create filter buttons ready to apply with a
single click.
Creating and using bookmarks.
18
Creating and using display filter buttons.
19
Profiles
Wireshark is a multifunctional tool that helps analysts to accomplish in-depth packet analysis. As we
covered during the room, multiple preferences need to be configured to analyse a specific event of
interest. It is cumbersome to re-change the configuration for each investigation case, which requires a
different set of colouring rules and filtering buttons. This is where Wireshark profiles come into play.
You can create multiple profiles for different investigation cases and use
them accordingly. You can use the "Edit --> Configuration Profiles" menu or the "lower right
bottom of the status bar --> Profile" section to create, modify and change the profile configuration.
Packet Filtering
This type of filter is used to save only a specific part of the traffic. It is set
Capture Filters
before capturing traffic and not changeable during the capture.
Note: You cannot use the display filter expressions for capturing traffic and vice versa.
20
The typical use case is capturing everything and filtering the packets according to the event of interest.
Only experienced professionals use capture filters and sniff traffic. This is why Wireshark supports more
protocol types in display filters.
Protocol: ether, wlan, ip, ip6, arp, rarp, tcp and udp.
You can read more on capture filter syntax from here and here. A quick reference is available under
the "Capture --> Capture Filters" menu.
Wireshark has a built-in option (Display Filter Expression) that stores all supported protocol
structures to help analysts create display filters. We will cover the "Display Filter Expression" menu
later. Now let's understand the
21
fundamentals of the display filter operations. A quick reference is available under the "Analyse -->
Display Filters" menu.
Comparison Operators
You can create display filters by using different comparison operators to find the event of interest.
The primary operators are shown in the table below.
Note: Wireshark supports decimal and hexadecimal values in filtering. You can use any format you
want according to the search you will conduct.
Logical Expressions
Wireshark supports boolean syntax. You can create display filters by using logical operators as well.
22
not ! Logical NOT !([Link] == [Link])
Packet filters have an autocomplete feature to break down protocol details, and each detail is
represented by a "dot".
Protocol Filters
As mentioned in the previous task, Wireshark supports 3000 protocols and allows packet-level
investigation by filtering the protocol fields. This task shows the creation and usage of filters
against different protocol fields.
IP Filters
IP filters help analysts filter the traffic according to the IP level information from the packets
(Network layer of the OSI model). This is one of the most commonly used filters in Wireshark.
These filters filter network-level
23
information like IP addresses, version, time to live, type of service, flags, and checksum values.
The common filters are shown in the given table.
Filter Description
[Link] == [Link]/24 Show all packets containing IP addresses from [Link]/24 subnet.
Note: The [Link] filters the traffic without considering the packet
[Link] vs [Link]/[Link] direction. The [Link]/[Link] filters the packet depending on the packet
direction.
TCP
TCP filters help analysts filter the traffic according to protocol-level information from the packets
(Transport layer of the OSI model). These filters filter transport protocol level information like
source and destination ports, sequence number, acknowledgement number, windows size,
timestamps, flags, length and protocol errors.
Show
[Link] == 1234 Show all TCP packets [Link]== 1234 all UDP packets
originating from port 1234 originating from
port 1234
24
Show
[Link] == 80 Show all TCP packets sent [Link]== 5353
all UDP packets
to port 80
sent to port 5353
Show Show
http dns
all HTTP packets all DNS packets
Show
[Link] Show all DNS "A"
all HTTP POST [Link] == 1
== "POST"
records
requests
25
Display Filter Expressions
Wireshark has a built-in option (Display Filter Expression) that stores all supported protocol
structures to help analysts create display filters. When an analyst can't recall the required filter
for a specific protocol or is unsure about the assignable values for a filter, the Display Filter
Expressions menu provides an easy-to-use display filter builder guide. It is available
under the "Analyse --> Display Filter Expression" menu.
26
Advanced Filtering
So far, you have learned the basics of packet filtering operations. Now it is time to focus on specific
packet details for the event of interest. Besides the operators and expressions covered in the previous
room, Wireshark has advanced operators and functions. These advanced filtering options help the
analyst conduct an in-depth analysis of an event of interest.
Filter: "contains"
Filter contains
List all HTTP packets where packets' "server" field contains the "Apache"
Workflow
keyword.
Filter: "matches"
Filter matches
Type Comparison Operator
27
List all HTTP packets where packets' "host" fields match keywords ".php" or
Workflow
".html".
Usage [Link] matches "\.(php|html)"
Filter: "in"
Filter in
Example Find all packets that use ports 80, 443 or 8080.
List all TCP packets where packets' "port" fields have values 80, 443 or 8080.
Workflow
28
Filter: "upper"
Filter upper
Type Function
Convert all HTTP packets' "server" fields to uppercase and list packets that
Workflow
contain the "APACHE" keyword.
29
Filter: "lower"
Filter lower
Type Function
Convert all HTTP packets' "server" fields info to lowercase and list packets
Workflow
that contain the "apache" keyword.
30
Filter: "string"
Filter string
Type Function
Convert all "frame number" fields to string values, and list frames end with
Workflow
odd values.
31
Wireshark: Traffic Analysis
Nmap Scans
Nmap is an industry-standard tool for mapping networks, identifying live hosts and discovering the
services. As it is one of the most used network scanner tools, a security analyst should identify the
network patterns created with it. This section will cover identifying the most common Nmap scan types.
UDP scans
It is essential to know how Nmap scans work to spot scan activity on the network. However, it is
impossible to understand the scan details without using the correct filters. Below are the base filters to
probe Nmap scan behaviour on the network.
TCP flags in a nutshell.
important.
32
• Only SYN, ACK flags. • SYN
• [Link] == 18 • ([Link] == 1) and ([Link]
and ACK are set. The rest of the
== 1)
bits are not important.
• Only RST flag. • RST flag is
set. The rest of the bits are not • [Link] == 4 • [Link] == 1
important.
• Only RST, ACK flags. • RST
• [Link] == 20 • ([Link] == 1) and ([Link]
and ACK are set. The rest of the
== 1)
bits are not important.
• Only FIN flag • FIN flag is
set. The rest of the bits are • [Link] == 1 • [Link] == 1
not important.
TCP
TCP Connect Scan in a nutshell:
Usually has a windows size larger than 1024 bytes as the request expects some data due to the
nature of the protocol.
• SYN --> • <-- SYN, • SYN --> • <-- SYN, ACK • ACK --> • RST, • SYN --> • <-- RST,
ACK • ACK --> ACK --> ACK
The images below show the three-way handshake process of the open and close TCP ports. Images
and pcap samples are split to make the investigation easier and understand each case's details.
Open TCP port (Connect):
33
Closed TCP port (Connect):
The above images provide the patterns in isolated traffic. However, it is not always easy to spot the
given patterns in big capture files. Therefore analysts need to use a generic filter to view the initial
anomaly patterns, and then it will be easier to focus on a specific traffic point.
The given filter shows the TCP Connect scan patterns in a capture file.
[Link]==1 and [Link]==0 and tcp.window_size > 1024
SYN Scans
TCP SYN Scan in a nutshell:
Doesn't rely on the three-way handshake (no need to finish the handshake process).
privileged users.
Usually have a size less than or equal to 1024 bytes as the request is not finished and it doesn't
expect to receive data.
34
• SYN --> • <-- SYN,ACK • RST--> • SYN --> • <-- RST,ACK
The given filter shows the TCP SYN scan patterns in a capture file.
[Link]==1 and [Link]==0 and tcp.window_size <= 1024
UDP
UDP Scan in a nutshell:
open ports
35
Closed (port no 69) and open (port no 68) UDP ports:
The above image shows that the closed port returns an ICMP error packet. No further information is
provided about the error at first glance, so how can an analyst decide where this error message belongs?
The ICMP error message uses the original request as encapsulated data to show the source/reason of
the packet. Once you expand the ICMP section in the packet details pane, you will see the
encapsulated data and the original request, as shown in the below image.
36
The given filter shows the UDP scan patterns in a capture file.
[Link]==3 and [Link]==3
37
ARP Poisoning & Man In The Middle!
ARP protocol, or Address Resolution Protocol (ARP), is the technology responsible for allowing
devices to identify themselves on a network.
Address Resolution Protocol Poisoning (also known as ARP Spoofing or Man In The Middle
(MITM) attack) is a type of attack that involves network jamming/manipulating by sending
malicious ARP packets to the default gateway. The ultimate aim is to manipulate the "IP to
MAC address table" and sniff the traffic of the target host.
There are a variety of tools available to conduct ARP attacks. However, the mindset of the attack is
static, so it is easy to detect such an attack by knowing the ARP protocol workflow and Wireshark skills.
ARP analysis in a nutshell:
protocol
Common patterns are request & response, announcement and gratuitous packets.
Before investigating the traffic, let's review some legitimate and suspicious ARP packets. The
legitimate requests are similar to the shown
picture: a broadcast request that asks if any of the available hosts use an IP address and a reply from the
host that uses the particular IP address.
38
A suspicious situation means having two different ARP responses (conflict) for a particular IP
address.
In that case, Wireshark's expert info tab warns the analyst. However, it only shows the second
occurrence of the duplicate value to highlight the conflict. Therefore, identifying the malicious
packet from the legitimate one is the analyst's challenge. A possible IP spoofing case is shown in
the picture
below.
39
Here, knowing the network architecture and inspecting the traffic for a specific time frame can help
detect the anomaly. As an analyst, you should take notes of your findings before going further. This will
help you be organised and make it
easier to correlate the further findings.
Look at the given picture; there is a conflict; the MAC address that ends with "b4" crafted an ARP
request with the "[Link]" IP address, then claimed to have the "[Link]" IP address.
• MAC:
Possible IP address match. 1 IP address announced from a
[Link]
MAC address.
• IP: [Link]
• MAC1:
2 MAC addresses claimed the same IP
Possible ARP spoofing [Link]
address ([Link]). The "[Link]"
attempt. • MAC 2:
IP address is a possible gateway address.
[Link]
Let's keep inspecting the traffic to spot any other anomalies. Note that the case is split into multiple
capture files to make the investigation easier.
At this point, it is evident that there is an anomaly. A security analyst cannot ignore a flood of ARP
requests. This could be malicious activity, scan or network problems. There is a new anomaly; the MAC
address that ends with "b4" crafted multiple ARP requests with the "[Link]" IP address. Let's
focus on the source of this anomaly and extend the taken notes.
40
Notes Detection Notes Findings
• MAC:
Possible IP address match. 1 IP address announced from a
[Link] • IP:
MAC address.
[Link]
Up to this point, it is evident that the MAC address that ends with "b4" owns the "[Link]" IP
address and crafted suspicious ARP requests against a range of IP addresses. It also claimed to have the
possible gateway address as well.
Let's focus on other protocols and spot the reflection of this anomaly in the following sections of the
time frame.
There is HTTP traffic, and everything looks normal at the IP level, so there is no linked information with
our previous findings. Let's add the MAC addresses as columns in the packet list pane to reveal the
communication behind the IP addresses.
41
One more anomaly! The MAC address that ends with "b4" is the destination of all HTTP packets! It is
evident that there is a MITM attack, and the attacker is the host with the MAC address that ends with
"b4". All traffic linked to "[Link]" IP addresses is forwarded to the malicious host. Let's
summarise the findings before concluding the investigation.
Detecting these bits and pieces of information in a big capture file is challenging. However, in real-life
cases, you will not have "tailored data" ready for investigation. Therefore you need to have the analyst
mindset, knowledge and
tool skills to filter and detect the anomalies.
Identifying Hosts
When investigating a compromise or malware infection activity, a security analyst should know
how to identify the hosts on the network apart from IP to MAC address match.
One of the best methods is identifying the hosts and users on the network to decide the
investigation's starting point and list the hosts and users associated with the malicious
traffic/activity.
Usually, enterprise networks use a predefined pattern to name users and hosts.
While this makes knowing and following the inventory easier, it has good and bad sides. The good side
is that it will be easy to identify a user or host by looking at the name. The bad side is that it will be easy
to clone that pattern and live in the enterprise network for adversaries. There are multiple solutions to
avoid these kinds of activities, but for a security analyst, it is still essential to have host and
user identification skills.
42
NetBIOS (NBNS) traffic
Kerberos traffic
DHCP
Dynamic Host Configuration Protocol (DHCP), is the technology responsible for managing automatic
IP address and required communication parameters assignment.
DHCP investigation in a nutshell:
the nature of the protocol, only "Option 53" ( request type) • ACK: [Link] == 5 • NAK:
has predefined static values. You should filter the packet [Link] == 6
type first, and then you can filter the rest of the options by
"applying as column" or use the advanced filters like
"contains" and
"matches".
43
NetBIOS (NBNS) Analysis
NetBIOS or Network Basic Input/Output System is the technology responsible for allowing applications
on different hosts to communicate with each other.
NBNS investigation in a nutshell:
44
Kerberos Analysis
Kerberos is the default authentication service for Microsoft Windows domains.
It is responsible for authenticating service requests between two or more computers over the
untrusted network. The ultimate aim is to prove identity securely.
•
User account search: • CNameString: The username. Note: Some packets [Link]
could provide hostname information in this field. To avoid this confusion, contains "keyword" •
filter the "$" value. The values end with "$" are hostnames, and the ones [Link] and !
([Link] contains
without it are user names. "$" )
45
Tunneling Traffic: DNS and ICMP
It can be used for "internet to private networks" and "private networks to internet"
flow/direction.
There is an encapsulation process to hide the data, so the transferred data appear natural for the
case, but it contains private data packets and transfers them to the final destination securely.
Tunnelling provides anonymity and traffic security. Therefore it is highly used by enterprise networks.
However, as it gives a significant level of data encryption, attackers use tunnelling to bypass security
perimeters using the standard and trusted protocols used in everyday traffic like ICMP and DNS.
Therefore, for a security analyst, it is crucial to have the ability to spot ICMP and DNS anomalies.
ICMP Analysis
Internet Control Message Protocol (ICMP) is designed for diagnosing and reporting network
communication issues. It is highly used in error reporting and testing.
As it is a trusted network layer protocol, sometimes it is used for denial of service (DoS) attacks;
also, adversaries use it in data exfiltration and C2
46
tunnelling activities.
As the ICMP packets can transfer an additional data payload, adversaries use this section to
exfiltrate data and establish a C2 connection.
It could be a TCP, HTTP or SSH data. As the ICMP protocols provide a great opportunity to carry
extra data, it also has disadvantages.
Most enterprise networks block custom packets or require administrator privileges to create
custom ICMP packets.
A large volume of ICMP traffic or anomalous packet sizes are indicators of ICMP tunnelling. Still, the
adversaries could create custom packets that match the
regular ICMP packet size (64 bytes), so it is still cumbersome to detect these tunnelling activities.
However, a security analyst should know the normal and the abnormal to spot the possible anomaly and
escalate it for further analysis.
47
DNS Analysis
Domain Name System (DNS) is designed to translate/convert IP domain addresses to IP
addresses.
It is also known as a phonebook of the internet. As it is the essential part of web services, it is
commonly used and trusted, and therefore often ignored. Due to that, adversaries use it in data
exfiltration and C2 activities.
Adversary creates (or already has) a domain address and configures it as a C2 channel. The
malware or the commands executed after exploitation sends DNS queries to the C2 server.
However, these queries are longer than default DNS queries and crafted
for subdomain addresses. Unfortunately, these subdomain addresses are not actual addresses; they
are encoded commands as shown below:
"[Link]"
When this query is routed to the C2 server, the server sends the actual malicious commands to the
host.
As the DNS queries are a natural part of the networking activity, these packets have the chance of
not being detected by network perimeters. A security analyst should know how to investigate the
DNS packet lengths and target addresses to spot these anomalies.
Wireshark
Notes
Filter
Global search • dns
48
Cleartext Protocol Analysis: FTP
FTP Analysis
File Transfer Protocol (FTP) is designed to transfer files with ease, so it focuses on simplicity rather
than security. As a result of this, using this protocol in unsecured environments could create security
issues like:
MITM attacks
49
Malware planting Data
exfiltration
50
Cleartext Protocol Analysis: HTTP
HTTP Analysis
Hypertext Transfer Protocol (HTTP) is a cleartext-based, request-response and client-server
protocol. It is the standard type of network activity to request/serve web pages, and by default, it is
not blocked by any network
perimeter. As a result of being unencrypted and the backbone of web traffic, HTTP is one of the
must-to-know protocols in traffic analysis. Following attacks could be detected with the help of
HTTP analysis:
Phishing pages
Web attacks
Data exfiltration
nutshell:
• [Link] == "GET" •
"HTTP Request Methods" for grabbing the low-hanging fruits: • [Link] ==
51
fruits: • 200 OK: Request successful. • 301 Moved Permanently: 200 • [Link]
== 404 •
Unauthorised: URL needs authorisation (login, etc.). • 403
[Link] ==
Forbidden: No access to the requested URL. • 404 Not Found:
405 • [Link]
Server can't find the requested URL. • 405 Method Not Allowed: == 503
Identifier.
For a security analyst, it is important to spot the anomaly signs on the bits and pieces of the
packets. The "user-agent" field is one of the great resources for spotting anomalies in HTTP
traffic.
In some cases, adversaries successfully modify the user-agent data, which could look super natural.
A security analyst cannot rely only on the user-agent field to spot an anomaly.
52
User agent-based anomaly/threat detection/hunting is an additional data source to check and is
useful when there is an obvious anomaly. If you are unsure about a value, you can conduct a web
search to validate your findings with the default and normal user-agent info (example site).
Log4j Analysis
Log4j Analysis refers to the process of examining and assessing the logs generated by the Apache
Log4j framework in order to identify security vulnerabilities, operational issues, or other relevant
insights within an application or system.
53
A proper investigation starts with prior research on threats and anomalies going to be hunted.
Let's review the knowns on the "Log4j" attack before launching Wireshark.
54
HTTPS uses TLS protocol to encrypt communications, so it is impossible to decrypt the traffic and
view the transferred data without having the encryption/decryption key pairs.
As this protocol provides a good level of security for transmitting sensitive data, attackers and
malicious websites also use HTTPS.
Therefore, a security analyst should know how to use key files to decrypt encrypted traffic and
investigate the traffic activity.
The packets will appear in different colours as the HTTP traffic is encrypted. Also, protocol and info
details (actual URL address and data returned from the server) will not be fully visible. The first image
below shows the HTTP packets encrypted with the TLS protocol. The second and third images
demonstrate filtering HTTP packets without using a key log file.
"HTTPS Parameters" for grabbing the low-hanging fruits: • Request: • [Link] • tls •
Listing all requests • TLS: Global TLS search • TLS Client Request • TLS [Link]
Similar to the TCP three-way handshake process, the TLS protocol has its handshake process.
The first two steps contain "Client Hello" and "Server Hello" messages.
55
The given filters show the initial hello packets in a capture file. These filters are helpful to spot
which IP addresses are involved in the TLS handshake.
56
An encryption key log file is a text file that contains unique key pairs to decrypt the encrypted
traffic session.
These key pairs are automatically created (per session) when a connection is established with an
SSL/TLS-enabled webpage.
As these processes are all accomplished in the browser, you need to configure your system and use a
suitable browser (Chrome and Firefox support this) to save these values as a key log file.
57
To do this, you will need to set up an environment variable and create the SSLKEYLOGFILE,
and the browser will dump the keys to this file as you browse the web.
SSL/TLS key pairs are created per session at the connection time, so it is important to dump the
keys during the traffic capture. Otherwise, it is not possible to create/generate a suitable key log file
to decrypt captured traffic.
You can use the "right-click" menu or "Edit --> Preferences --> Protocols --
> TLS" menu to add/remove key log files.
Adding key log files with the "Edit --> Preferences --> Protocols --> TLS" menu:
58
The above image shows that the traffic details are visible after using the key log file. Note that the
packet details and bytes pane provides the data in different formats for investigation. Decompressed
header info and HTTP2 packet details are available after decrypting the traffic. Depending on the
packet details, you can also have the following data formats:
Frame
Decrypted TLS
TCP
Reassembled SSL
59
Some Wireshark dissectors (FTP, HTTP, IMAP, pop and SMTP) are programmed to extract
cleartext passwords from the capture file. You can view detected credentials using the "Tools -->
Credentials" menu. This
feature works only after specific versions of Wireshark (v3.1 and later). Since the feature works
only with particular protocols, it is suggested to have
manual checks and not entirely rely on this feature to decide if there is a cleartext credential in the
traffic.
Once you use the feature, it will open a new window and provide detected credentials. It will show
the packet number, protocol, username and
additional information. This window is clickable; clicking on the packet
number will select the packet containing the password, and clicking on the username will select the
packet containing the username info. The additional part prompts the packet number that contains
the username.
Actionable Results!
Wireshark is not all about packet details; it can help you to create firewall rules ready to implement
with a couple of clicks.
(iptables)
60
IP Filter (ipfilter) IPFirewall
Tasks:
Task 1: Capturing and Exporting Objects
Submission Requirements:
A detailed report including:
This assignment will help students develop practical skills in network packet analysis using Wireshark.
Good luck!
62