1

I got the following error connecting to my server via ssh:

The authenticity of host '[ip address]:port ([ip address]:port)' can't be established.
ECDSA key fingerprint is SHA256:[thefingerprintwhichichanged].

I connected anyway and am reasonably confident I know the reason for the changed fingerprint.

But suppose I was being MitM'd...

Scenario

I usually use key pair to connect to my with password login disabled. I connected via SSH, fingerprint did not match but I used the previously used key pair to connect. While connected over SSH I logged into database and changed some entries. I then logged out.

Questions

  • How would that attack work and what could the attacker learn or do?
  • Can he read data sent to server, can he read data sent by server?
  • Can he change any data?
  • Can he perform commands on server that I did not?
  • Can he ever login again?
  • Can he ever redo the actions I performed while I was being MitM'd?
1
  • 1
    openssh had, in the past, bugs in the client that allowed a malicious server to do bad things (steal client's private key, execute code). No reason to think no such bugs exists in current versions. Example for stealing keys: openssh.com/txt/release-7.1p2
    – Z.T.
    Nov 21, 2016 at 3:44

3 Answers 3

1

Well, there is a lot of things the "bad server" can do to you:

How would that attack work and what could the attacker learn or do?

The attacker makes you connect to his server instead of your by modifying DNS answers or other mangling with packets. I you would use passwords, he would get your password and could connect to a real server anytime (and do the bad things there). If you are using only keys, there is possibility to forward the original server challenge to you and let you sign it, which will grant the "bad server" access to your real server. All this can be made transparent so you would also do the stuff on the real server to minimize your suspicion.

Can he read data sent to server, can he read data sent by server?

Yes

Can he change any data?

Yes

Can he perform commands on server that I did not?

Yes

Can he ever login again?

Only if you send a password. The private keys prevents this use case.

Can he ever redo the actions I performed while I was being MitM'd?

If he does not close the connection, he can do the actions later.

The other chapter is what the "bad server" can do with your client:

  • If you are using X11 forwarding by default, the "bad server" has (usually) full access to your X server -- he can take a screenshots of your desktop, listen to all keystrokes, and so on.
  • Id you didn't patch out Roaming feature from your OpenSSH client, the server can basically force you to send some of the private keys (in some cases).
  • probably others ...
0

If the fingerprint doesn't match, it could be much worse than a passive eavesdropping - it often means it's an entirely different machine. If you start transferring sensitive files onto an attacker's machine, or typing sudo passwords, then he has access to them. He can replace common commands with alternatives that do slightly different things that will expose sensitive data. He can do essentially anything that he wants, because it is his machine, not yours.

1
  • You're essentially describing advanced social engineering. It would be interesting to hear about security implications beyond that.
    – Arminius
    Nov 21, 2016 at 4:16
0

If the authenticity cannot be proven, it means just:

  • you're not talking to a host you're supposed to: worst case scenraio it's an be evil twin
  • host has changed it's keys, but if it's your server and you don't remember doing so, that's questionable.

You must log in to answer this question.

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