billfeller.github.io icon indicating copy to clipboard operation
billfeller.github.io copied to clipboard

Using Wireshark to decode packets on HTTP/2 over TLS in Chrome on Window/Mac OS X

Open billfeller opened this issue 8 years ago • 1 comments

Ref: https://blog.cloudflare.com/tools-for-debugging-testing-and-using-http-2/

The popular Wireshark packet analyzer added decoding on HTTP/2 in version 1.12.0 and fully decodes HTTP/2 frames. Unfortunately most HTTP/2 is sent over TLS which means that, by default, Wireshark will not be able to decrypt the packets to be able to get to the HTTP/2 for decoding.

Fortunately, there is a workaround if you are using Google Chrome for testing. It is possible to get Chrome to save the symmetric cryptographic key used for TLS connections to a file and Wireshark is able to read that file to decode TLS connections.

This is done by setting the SSLKEYLOGFILE environment variable before running Chrome. I'm running on Mac OS X and use Google Chrome Canary for testing so I run:

Mac OS X

% export SSLKEYLOGFILE=`pwd`/sslkey.log
% /Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary

Google Chrome will then write session keys to that file. In Wireshark I configure it to read the file by going to Preferences, expanding the Protocols list.

image

Then I find SSL and set the Pre-Master-Secret log filename to point to the same file.

image

Then Wireshark can decode the TLS connections made by that browser. Here's the beginning of a connection between Google Chrome Canary and the experimental server https://http2.cloudflare.com/.

image

The Same As Windows except the evironment setting difference as below

Windows image

billfeller avatar Aug 20 '16 08:08 billfeller

This isn't working on my Mac.

surfd4wg avatar May 13 '21 19:05 surfd4wg