Warm tip: This article is reproduced from serverfault.com, please click

Decoding ssl packets with cipher TLS_ECDHE_RSA in wireshark

发布于 2021-03-08 04:46:10

I am trying to decode ssl packets in a packet capture using wireshark. I am able to successfully decode the packets with server key when the cipher selected by the server during TLS handshake is TLS_RSA_WITH_AES_256_CBC_SHA256.I just mention the server ip/port/protocol(http)/server.key in edit->preferences->Protocols->ssl. But it doesnot work when the cipher used is TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 I am using Wireshark Version 2.0.2. Is there any other way to decode ?

Questioner
user3049437
Viewed
0
the-wabbit 2017-08-18 22:24:33

The answer to your question is

No, because of ECDHE_RSA.

Now let us see why this is so. Let's look at the entire ciphersuite specification TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 in detail:

  • TLS - the protocol
  • ECDHE_RSA - authentication and key exchange algorithms
  • WITH_AES_128 - the encryption/decryption algorithm
  • GCM - the mode used for scrambling the data so it can be securely used with the algorithm
  • SHA256 - message authentication code algorithm

The key exchange algorithm is specifying how keys for the bulk encryption/decryption cipher are exchanged. And there is something special about the Diffie-Hellman key exchange used in ECDHE_RSA:

DHE_RSA offers something known as Perfect Forward Secrecy, a pompous name for the following property: if your server gets thoroughly hacked, to the point that the attacker obtains a copy of the server private key, then he will also be able to decrypt past TLS sessions (which he recorded) if these sessions used RSA, while he will not be able to do so if these sessions used DHE_RSA.

stolen from an answer on security.SE

In other words, with (EC)DHE, the AES key used for encryption and decryption cannot be retrieved from the TLS ciphertext conversation, not even if you have the server's private key.

This is different when solely relying on RSA for key exchange: in this operation mode, the bulk cipher key to be used is generated by the client, RSA-encrypted with the server's public key and sent to the server. If an eavesdropping third party has the server's private key, it simply can decrypt the RSA ciphertext of the key exchange, get at the bulk cipher key and decrypt eveything else. This is exactly what Wireshark is doing when decoding a TLS stream for you.

So, what works for RSA-based key exchanges, won't do for DHE-based ones.