3

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?

4

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.

  • 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 Apr 27 '17 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. – Steffen Ullrich Apr 27 '17 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 Apr 27 '17 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. – Steffen Ullrich Apr 27 '17 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. – Steffen Ullrich Apr 27 '17 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.