Forum Thread: Decrypting SSL or TLS Session Traffic with Wireshark

  • Surely on occasion you have used Wireshark (network traffic analyzer: sniffer)

. the traffic between servers is protected via MTLS and from client to server via TLS

  • The problem is given when you want to see why the Lync client does not connect, or what kind of DSCP uses our Lync client when we start a conference, etc ... and we find this ....
  • you will see that the traffic is encrypted and it would be impossible to review anything, so far everything is correct. But of course, if we want to analyze which is the possible problem that we have would be impossible. With Wireshark (and other tools) we can decrypt SSL traffic (decrypting is not equal to "juankear" or similar) to be able to analyze it. For this we need to have the certificate that uses the server to which we want to connect with its private key, so that we have to export it from the server with it. If we do not have the private key we can not do anything, for that we must have access to it. Hence the previous comment that we are not hacking anything at all, since the certificate with its private key is exported by us. This article only describes a procedure that you must follow to analyze the SSL or TLS traffic used by Lync (or any other service) to encrypt communications. Once we have our certificate exported with its corresponding private key

Let's convert the PFX to PEM, which is the format that Wireshark can use and we will use OpenSSL .
https://slproweb.com/products/Win32OpenSSL.html
Once installed we must execute the following commands:

Code: DOS
1- openssl pkcs12 -nodes -in SIP.pfx -out sip.pem -nocerts -nodes
2- openssl rsa -in sip.pem -out sipout.pem

Now you should have a file with the name sipout.pem (each one that puts the name that you want) similar to this one ( without the dots, this I have put it )

----- BEGIN RSA PRIVATE KEY -----
MIIEpAIBAAKCAQEAiFBWj / E7y6MAMUWacV2aeSpt / j2wHzB7xIYBCMnJy0u869eb
...
...
...
...
...
...
...
...
...
...
...
...
ufZSuWUFoiu1XPS6vWPtQ8VRjb0a4hGXSMYDxyupDgEAgRDIMN0jyW1PklbsOZOb
aJWQWC5UQuoWEP4gw + 3aC87UTGrk8U10X0DpQdfyD3Bjwwvai3mEYw ==
---- -END RSA PRIVATE KEY -----

Now we have to configure our Wireshark to use the private key file, for this we open the Wireshark and go to Edit - Preferences (Shift + Ctrl + P).

Open the Protocol option , select SSL and click on Edit ..

Press on New

And we configure the following options:

IP Address : IP of the server where the certificate is installed
Port : 443
Protocol : HTTP
Key File : We chose the file that we previously converted to .PEM

Press OK

And finally we will configure the log file to be created in the decryption processes (very useful information) and press Apply to start the process of decrypting the current captures.

If we now open the LOG file, we will see that they are being processed correctly, so we can see the captured traffic "readable" form

opened again Wireshark, we capture some traffic and click on Follow SSL Stream

Note :
If you choose the option Follow SSL Stream without setting appropriate Wireshark will show the following screen (blank)

we can now see this, of course we can already analyze what may be happening

The power to decipher the traffic is very useful, that is, you must have access to the private key of the certificate. On the other hand, you should not allow the certificates installed on the servers to have the private key as exportable, because if someone has more skill than we can compromise and much the security of our company. This article only represents how you can analyze encrypted traffic with one of the most used tools to analyze network traffic, but you can do it with many others. In principle only has the purpose of solving different problems that may arise in our implementations, as the traffic is encrypted we complicate any diagnosis.

I leave also a very illustrative example of a capture without encrypted traffic, but what if it was encrypted? it could take hours to find out what the problem is

greetings
sam //
mohamed//

Get The Weekly Null Byte Newsletter

Never miss a Null Byte guide.

1 Response

This gets us to decrypt our own traffic right? How would we do this if we want to decrypt others traffic?

Share Your Thoughts

  • Hot
  • Active