Say that A is behind a firewall that logs all packets, communicating with B over a publickey-authenticated SSH connection:

  A <-------- {ssh} --------> B
  [Encrypted packets all logged]

The firewall is unable to inspect the contents of the SSH session due to design of SSH.

What happens if, say a day or two (or maybe an hour) later, the owner of the firewall assumes root control of the SSH server B? I'm assuming it's possible for the owner to extract the server's SSH private key and decrypt the contents of the old SSH session that was saved to fw logs.

Is this possible? If not, what other data would the owner need?

1 Answer 1


Since almost all key exchange methods offered by SSH today use forward secrecy it is not enough to get the private key of the server in order to get to the session secrets and decrypt the traffic. While RSA authentication was used with SSH-1 and is also a proposed standard for SSH-2 it is usually not implemented or enabled (see ssh -Qkex for key exchange algorithms enabled in OpenSSH).

Because of forward secrecy an attacker would need to have access to the internal SSH state of either the client or server at the time the SSH connection still exists. It is not possible to get the necessary data later to decrypt previously sniffed connections.

  • So as I understand it, even if the attacker compromised the private keys of both A and B, they would still not be able to replay the session without parameters that could be gotten only from either party's internal SSH state at the time?
    – Joseph
    Commented Sep 11, 2018 at 4:04
  • @JosephA.: Your question was asking about decrypting which has nothing to do with replaying (the encrypted data). And decryption of previously sniffed data is not possible solely with the private keys of the peers, providing that no RSA key exchange was used (which is a valid assumption for most common use of SSH today). That's the main point of forward secrecy. Commented Sep 11, 2018 at 4:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .