0

Imagine you get hold of someone's private SSH key, which is encrypted. Now imagine you also get hold of the unencrypted key (e.g., because some SSH client stores it after decryption).

Can you determine the encryption passphrase using this information?

(I am asking because the passphrase to one of my own keys, which I did not have to type for months now, stopped working. I might recover the key from the registry, but I also want to know why the passphrase that I believe I remember correctly stopped working.)

1
  • 2
    If you have a rough idea of how the passphrase was structured, it might be possible to efficiently crack it.
    – amon
    Jul 14, 2021 at 7:12

1 Answer 1

2

This type of attack is known as Known-plaintext attack in which the attacker has both encrypted and plaintext part which can used to get further information such as secret keys via Cryptanalysis.

The passphrase is used to encrypt the private part of ssh key, which is actually a symmetric encryption. This symmetric key wraps the private part of ssh keys.

Today's (modern) symmetric encryption such as AES is known to be resistance to this attack. So, if you are using modern cipher such as AES for encrypting the ssh keys, it is infeasible to get the secret from encrypted and plaintext part.

3
  • I think your answer misses the fact that the attacker also has the encrypted key file - this qualifies for known-plaintext attacks, I guess.
    – bers
    Jul 14, 2021 at 7:18
  • @bers Yes, I've missed the part. Thanks. I've updated the answer.
    – saurabh
    Jul 14, 2021 at 7:56
  • Not just a known plain text attack, it is a total break (i.e. key recovery) under known plain text attack. And given only one plaintext-cipher text pairs at that. This scheme if possible would be as insecure as it gets. Furthermore the attacker needs to perform pre-image attack on the passphrase hashing function after getting the key to get A valid passphrase. Jul 14, 2021 at 13:11

You must log in to answer this question.

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