+1 (512) 588 6950

Decrypting HTTPS Traffic as A Hacker

Home/Decrypting HTTPS Traffic as A ...
Decrypting HTTPS Traffic as A Hacker
Decrypting HTTPS Traffic as A Hacker bez0x January 23, 2023

Photo by FLY:D on Unsplash


All information below is for educational purposes only, the author is in no way responsible for any misuse of the information.

The word “Hack” or “Hacking” that is used on this site shall be regarded as “Ethical Hack” or “Ethical Hacking” respectively.

HTTPS stands for HTTP with secure or HTTP over SSL/TLS, and it means that the data are sent with an encryption mechanism.

Https uses a hybrid encryption mechanism, asymmetric encryption for sending the session key, and using symmetric encryption for transferring data.

The picture above tells us that the session key was transmitted using asymmetric encryption (private and public key), then data was encrypted by the session key.
So how to decrypt the traffic?

Today I will explain to you how to decrypt HTTPS traffic. Imagine you have access directly to the victim machine, then you could set the user environment variable and record the traffic with Wireshark or tcpdump.

  1. Capture the session key by setting the SSLKEYLOGFILE in the env variable.
setting env variable

2. Restarting the chrome and just checking the sslkeylog.log seem like the picture below.

3. Try to access a website and make sure your sslkeylog.log exist and there is some random number there.

SSLkey log

4. Power up the Wireshark or tcpdump and listen to the network traffic, in this explanation I use Wireshark for simply the user interface.

5. Collect the pcap file, and import it to the Wireshark.

6. For a better view, you can use these Wireshark columns preferences.

Wireshark column config

7. Put your sslkeylog.log in Preferences -> Protocols -> TLS -> (Pre)-Master-Secret log filename

Setting up the pre-master-secret key

8. All HTTPS traffic is decrypted.

before and after

I was opening before, and it appears in the Wireshark below.


If something says secure, don’t trust it. More protection like tunneling your connection is a good idea if you are using a public network.

This explanation can use for the defender, maybe the attacker has been transferring the malware over HTTPS traffic, as a defender you could decrypt that traffic and export the packet/malicious files.

Leave a Reply