โ† Back to list

How to Capture and Decrypt TLS Packets in Wireshark on Kali Linux (Complete Guide)๐Ÿ–ฅ๏ธ๐Ÿ‘จโ€๐Ÿ’ป

A step-by-step guide to analyzing HTTPS certificates by decrypting TLS traffic using Chrome/Chromium ๐Ÿชœ

Taraka Divya Ketha ยท 2026-04-22 14:18 ยท 0 claps ยท 4.7 min read
#kali-linux-on-virtualbox #wireshark-tutorial #tls-decryption #analysis-certificate #https
Open on Medium โ†—
Wiki topics: ๐Ÿ”“ ยท Open Source

How to Capture and Decrypt TLS Packets in Wireshark on Kali Linux (Complete Guide)๐Ÿ–ฅ๏ธ๐Ÿ‘จโ€๐Ÿ’ป

A step-by-step guide to analyzing HTTPS certificates by decrypting TLS traffic using Chrome/Chromium ๐Ÿชœ

As a security researcher or penetration tester, youโ€™ll often need to analyze HTTPS traffic and examine SSL/TLS certificates. However, modern browsers use encryption that makes this challenging. By default, youโ€™ll see โ€œEncrypted Handshakeโ€ messages instead of the actual certificate details.

In this guide, Iโ€™ll show you exactly how to:

  • Install Chromium on Kali Linux
  • Configure your browser to export TLS session keys
  • Set up Wireshark to decrypt TLS traffic using those keys
  • Capture and view certificate packets in plain text

Prerequisites:

  • Kali Linux installed (physical or VM)
  • Root or sudo access
  • Basic familiarity with the terminal

Step 1: Install Chromium Browser ๐ŸŒ

Kali Linux doesnโ€™t come with Chrome or Chromium pre-installed. Letโ€™s install Chromium (open-source version of Chrome) which works perfectly for TLS decryption.

Open a terminal and run:

# Update your package list
sudo apt update
# Install Chromium
sudo apt install chromium -y
# Verify installation
chromium -version

'''Expected output: `Chromium X.X.X` (version number will vary)'''

Why Chromium? : The Firefox version that comes with Kali Linux has TLS key logging disabled for security reasons. Chromium works out-of-the-box.

Step 2: Create a Directory for SSL Keys ๐Ÿ—๏ธ๐Ÿ“‚

We need a place to store the TLS session keys that Chromium will generate.

# Create the directory in your home folder
mkdir -p ~/wireshark-keys

# 2. Create the file manually
touch ~/wireshark-keys/sslkeylog.log

# Set proper permissions
chmod 755 ~/wireshark-keys

# Verify it was created
ls -la ~/wireshark-keys

'''Expected output: drwxr-xr-x 2 kali kali 4096 ... sslkeylog.log'''

Step 3: Launch Chromium with SSL Key Logging Enabled ๐Ÿš€๐Ÿ‘ฉ๐Ÿปโ€๐Ÿ’ป

This is the most important step. Weโ€™ll launch Chromium with an environment variable that tells it to write decryption keys to our file.

# Launch Chromium with key logging enabled
SSLKEYLOGFILE=~/wireshark-keys/sslkeylog.log chromium --disable-quic

Important notes:

  • Keep this terminal window open while capturing traffic
  • The --disable-quic flag forces Chromium to use traditional TLS instead of QUIC
  • Closing this terminal will close Chromium

Whatโ€™s happening? The SSLKEYLOGFILE environment variable tells Chromium to write session keys to the specified file. Wireshark will use these keys to decrypt TLS traffic.

Chromium browser be launched

Chromium browser be launched

Step 4: Verify Keys Are Being Generated ๐Ÿ”๐Ÿ‘€

Open a second terminal and run this command to monitor the key file in real-time:

# Watch the key log file
tail -f ~/wireshark-keys/sslkeylog.log

*Now, in Chromium (the browser window that opened in Step 3), visit any HTTPS website: -Go to โ€œ**https://example.com**โ€

Look at your second terminal. You should see lines appearing like:

CLIENT_HANDSHAKE_TRAFFIC_SECRET 8a3f2b1c9d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a 1a2b3c4d5e6f7a8b9c0d1e2f SERVER_HANDSHAKE_TRAFFIC_SECRET 8a3f2b1c9d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a 5e6f7a8b9c0d1e2f3a4b5c6d

If you see these lines, itโ€™s working! Press โ€œCtrl+Cโ€ to stop the tail command.

Step 5: Install and Launch Wireshark ๐Ÿ‘ฉ๐Ÿปโ€๐Ÿ’ป๐Ÿš€

If you donโ€™t have Wireshark installed:

#install wireshark if havent yet
sudo apt install wireshark -y

#launch wireshark
sudo wireshark

Step 6: Configure Wireshark to Use the Key File ๐Ÿ‘ฉ๐Ÿปโ€๐Ÿ’ปโš™๏ธ

Now weโ€™ll tell Wireshark where to find our decryption keys.

1. In Wireshark, go to Edit โ†’ Preferences (or press Ctrl+Shift+P)

2. In the left sidebar, expand Protocols

3. Scroll down and select TLS(or SSL in older versions)

4. In the right panel, find the field labeled: (Pre)-Master-Secret log filename

5. Enter the path to your key file: /home/YOUR_USERNAME/wireshark-keys/sslkeylog.log Alternative: Click the Browse button and navigate to the file manually

6. Click OK to save

Step 7: Start Capturing Traffic ๐Ÿ“ท๐Ÿ“„

1. Click on your network interface (usually eth0 for wired, wlan0 for WiFi)

2. Click the shark fin icon (๐Ÿ”ด) in the top-left to start capturing

3. In Chromium (still running from Step 3), visit an HTTPS website: https://example.com

4. Let the page load completely, then stop the capture by clicking the red square (๐ŸŸฅ)

Step 8: Filter and View TLS Packets ๐Ÿค–๐Ÿ“

Now letโ€™s find our decrypted packets.

View all TLS traffic: tls

View only certificate packets: tls.handshake.type == 11

View the complete TLS handshake: tls.handshake

To see the decrypted certificate details:

1. Find a packet labeled โ€Certificateโ€ in the packet list 2. Click on it 3. In the middle panel (packet details), expand: โ€” Transport Layer Security โ€” TLSv1.3 Record Layer: Handshake Protocol: Certificate โ€” Certificate List โ€” Click on a Certificate entry 4. Youโ€™ll now see: โ€” Issuer information โ€” Validity dates โ€” Subject Common Name (CN) โ€” Public key details

Step 9: Follow the Complete TLS Stream

To see the entire decrypted conversation:

1. Right-click on any TLS packet 2. Select Followโ†’ TLS Stream 3. A new window will open showing the decrypted HTTP traffic in plain text

Youโ€™ll now see the actual HTTP requests and responses that were previously hidden under encryption.

Troubleshooting ๐Ÿ”จ๐Ÿ”จ

No keys are being generated

  • Make sure youโ€™re visiting HTTPS sites, not HTTP
  • Verify Chromium was launched with the SSLKEYLOGFILE variable
  • Check that you didnโ€™t close the terminal that launched Chromium

*Wireshark isnโ€™t decrypting packets??

  • Double-check the key file path in Wireshark preferences
  • Restart Wireshark after setting the path
  • Ensure youโ€™re capturing on the correct interface*

Why This Works ๐Ÿค”โ‰๏ธ

Modern TLS (TLS 1.2 and 1.3) encrypts certificate packets by default. The SSLKEYLOGFILE environment variable tells your browser to write the session keys to a file. Wireshark reads these keys and uses them to decrypt the TLS traffic in real-time, allowing you to see certificates and other handshake details in plain text.

*This technique is essential for:

  • Security research
  • Certificate analysis
  • Debugging HTTPS issues
  • Learning how TLS works under the hood*

Conclusion ๐Ÿ˜Š

Youโ€™ve successfully set up TLS decryption on Kali Linux! You can now: โ€” Capture and decrypt HTTPS traffic โ€” View certificate details in Wireshark โ€” Follow TLS streams to see decrypted HTTP content

This setup is invaluable for anyone learning about TLS, analyzing certificates, or performing security research.

**๐Ÿ‘ฉโ€๐ŸซFurther Reading **:

- Wireshark TLS Documentation

Happy analyzing! ๐Ÿคฉ๐ŸŽ‰

โ€”-uff my first blog๐Ÿ˜‰


๋ฉ”ํƒ€๋ฐ์ดํ„ฐ
post_id
5dd07d385a26
slug
how-to-capture-and-decrypt-tls-packets-in-wireshark-on-kali-linux-complete-guide-๏ธ-5dd07d385a26
url
https://medium.com/@tarakadivyaketha/how-to-capture-and-decrypt-tls-packets-in-wireshark-on-kali-linux-complete-guide-%EF%B8%8F-5dd07d385a26
canonical_url
https://medium.com/@tarakadivyaketha/how-to-capture-and-decrypt-tls-packets-in-wireshark-on-kali-linux-complete-guide-%EF%B8%8F-5dd07d385a26
author_url
https://medium.com/@tarakadivyaketha
status
ok
fetched_at
2026-07-28 08:31:12