4

The use case is this: Imagine you have two systems, A and B. If system A ssh's into system B and begins transferring over files back to A, I want to be able to decrypt the content of the message being sent.

I understand that in SSH, there is a shared symmetric key that can be used for decryption. If I'm at system B, where can I find this symmetric key?

1 Answer 1

6

With SSH, TLS and similar protocols the symmetric key is created during a handshake phase using key exchange protocols like Diffie-Hellman Key Exchange. The generated key is kept in memory for the duration of the session, i.e it is not written to disk. Thus to get access to the key you would need to dump the memory of the client or server or would need to rely on functions to explicitly export the key, if available.

8
  • 1
    Historically, this has not always been done correctly, with some implementations reusing session keys or doing other dumb things with them. Key export in particular seems like a Bad Idea because it's just too easy to violate forward secrecy if that functionality is available.
    – Kevin
    Commented Apr 27, 2017 at 5:08
  • 2
    @Kevin: key export like currently offered by Firefox (but only when compiled with debugging) is just an easier way to get to the keys, which are already on the system but in memory. And its only done when explicitly asked for, i.e. typically only for debugging problems. As for the "not always been done correctly" it would be interesting to get references (i.e. CVE or similar) to determine if these problems are relevant in the context of this question. Commented Apr 27, 2017 at 5:14
  • By "not always done correctly" I really meant that although the idea of FS is quite old, it hasn't really been all that popular until recently (not sure if it was Heartbleed or the NSA, but something convinced everyone to suddenly start caring).
    – Kevin
    Commented Apr 27, 2017 at 6:58
  • 2
    @Kevin: I don't think that FS is really relevant for this question because the question asks where the symmetric keys are stored and not how they are generated or how secure the key exchange is. And with RSA key exchange the generated symmetric key is also not stored on disk but only in memory. Commented Apr 27, 2017 at 7:11
  • 1
    @Josef: sure, if you have access to the private key you can do it. But the OP did not ask how to compute the symmetric key given a sniffed session and the private key. The question was instead where the symmetric key is stored on the system. Commented Apr 27, 2017 at 9:55

You must log in to answer this question.

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