Have you ever wondered what happens behind the scenes when you visit a website over TLS? TLS (Transport Layer Security) is a protocol that encrypts the communication between your browser and the web server, ensuring that no one can eavesdrop on your data. But how does it work exactly? And how can you see it in action?
Well, the good news is that it's easier than you might think. In this article, we'll show you how to use a simple tool called Wireshark to capture and analyze the traffic between your browser and a web server. We'll use a live example and provide commentary along the way, so you can see exactly what's happening step by step.
Before we dive into the details, let's start with a simple example. Open your browser and go to https://www.google.com. This is a web page served over TLS, so your browser and the web server will perform a series of complex handshakes to establish a secure channel for communication. But what does that look like in practice?
To find out, we'll use Wireshark to capture the traffic between your browser and google.com. Wireshark is a free and open-source network protocol analyzer that lets you capture and analyze packets in real-time. You can download it from the official website and install it on your computer.
Once you've installed Wireshark, launch it and select the interface that corresponds to your internet connection (e.g., Ethernet, Wi-Fi). Then, start a new capture by clicking on the "Capture" menu and choosing "Start". You should see a list of packets scrolling by in real-time.
Now, go back to your browser and navigate to https://www.google.com. As you're loading the page, you'll see a lot of packets being captured by Wireshark. Most of them are irrelevant for our purposes, but some of them contain important information about the TLS handshake. We'll focus on those.
Once the page is fully loaded, stop the capture by clicking on the "Capture" menu and choosing "Stop". You should see a list of all the packets that were captured during the capture session. Find the one that corresponds to the TLS handshake by looking for a packet with the protocol "TLS" and the info "Handshake Protocol: Client Hello".
Click on that packet to see its details in the lower pane. You should see a lot of information, but the most important one is the "Handshake Protocol" section, which shows the four steps of the TLS handshake:
By analyzing these four steps, we can see the details of the TLS handshake and how it establishes a secure channel between the client and the server.
While the above example is interesting, it might not be practical for everyone. After all, not everyone wants to go through the trouble of capturing packets and analyzing them in Wireshark. So, here are some practical tips and personal anecdotes to help you get started:
Curated by Team Akash.Mittal.Blog
Share on Twitter Share on LinkedIn