# HTTPS Traffic

{% file src="<https://419616584-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQc-qafULj_SmngFsFG%2F-MQctZZTAOrzvK3t8LLB%2F-MQcuSwwK8_wbKqyIb6c%2Fsnakeoil2.zip?alt=media&token=1b76b00d-23de-458e-b6cd-c7c13c36ef5d>" %}
HTTPS PCAP
{% endfile %}

HTTPS or Hypertext Transfer Protocol Secure can be one of the most annoying protocols to understand from a packet analysis perspective and can be confusing to understand the steps needed to take in order to analyze HTTPS packets.

HTTPS Traffic Overview

Before sending encrypted information the client and server need to agree upon various steps in order to make a secure tunnel.

1. Client and server agree on a protocol version
2. Client and server select a cryptographic algorithm
3. The client and server can authenticate to each other; this step is optional
4. Creates a secure tunnel with a public key

We can begin analyzing HTTPS traffic by looking at packets for the handshake between the client and the server. Below is a Client Hello packet showing the SSLv2 Record Layer, Handshake Type, and SSL Version.

![](https://i.imgur.com/kGAE9d1.png)

Below is the Server Hello packet sending similar information as the Client Hello packet however this time it includes session details and SSL certificate information

![](https://i.imgur.com/NSNta13.png)

Below is the Client Key Exchange packet, this part of the handshake will determine the public key to use to encrypt further messages between the Client and Server.

![](https://i.imgur.com/dqfO5Vb.png)

In the next packet, the server will confirm the public key and create the secure tunnel, all traffic after this point will be encrypted based on the agreed-upon specifications listed above.

![](https://i.imgur.com/kdGa5jQ.png)

The traffic between the Client and the Server is now encrypted and you will need the secret key in order to decrypt the data stream being sent between the two hosts.

![](https://i.imgur.com/AsTGRDO.png)

Practical HTTPS Packet Analysis

In order to practice and get hands-on with HTTPS packets, we can analyze the snakeoil2\_070531 PCAP and decryption key set provided by Wireshark. Download the needed files from this task or directly from the [Wireshark website](https://wiki.wireshark.org/SampleCaptures#SSL_with_decryption_keys).

We first need to load the PCAP into Wireshark. Navigate to File > Open and select the snakeoil2 PCAP.

![](https://i.imgur.com/6Yzemo7.png)

From looking at the above packet capture we can see that all of the requests are encrypted. Looking closer at the packets we can see the HTTPS handshake as well as the encrypted requests themselves. Let's take a closer look at one of the encrypted requests: Packet 11.

![](https://i.imgur.com/8SilLRR.png)

We can confirm from the packet details that the Application Data is encrypted. You can use an RSA key in Wireshark in order to view the data unencrypted. In order to load an RSA key navigate to Edit > Preferences > Protocols > TLS >  \[+], you will need to fill in the various sections on the menu with the following preferences:

IP Address: 127.0.0.1

Port: start\_tls

Protocol: http

Keyfile: RSA key location

![](https://i.imgur.com/8Ju87lp.png)

Now that we have an RSA key imported into Wireshark, if we go back to the packet capture we can see that the data stream is now unencrypted.

![](https://i.imgur.com/u7R45SF.png)

We can now see the HTTP requests in unencrypted data streams. Looking further at one of the details of the packet we can see the unencrypted data stream closer.&#x20;

![](https://i.imgur.com/uROI7hu.png)

Looking at the packet details we can see some very important information such as the request URI and the User-Agent which can be very useful in practical applications of Wireshark such as threat hunting and network administration.

We can now use other features in order to organize the data stream, like using the export HTTP object feature, to access this feature navigate to File > Export Objects > HTTP

![](https://i.imgur.com/qtW4JL6.png)\
&#x20;

Looking at the data stream what is the full request URI for packet 31?&#x20;

Looking at the data stream what is the full request URI for packet 50?&#x20;

What is the User-Agent listed in packet 50? \\
