5

Are there conditions under which an attacker with control over the server could gain access to and initiate actions on the client? I realize the attacker could plant trojans on the server in the hope that the user behind the SSH client hauls one in (either manually or by running a script), but are there other vectors of attack too?

I'm specifically interested in scenarios where no passwords are involved and only public key authentication is used, possibly with the same user credentials on both sides of the connection.

3

Plain SSH client is generally safe from anything on the server at least for as long as no security vulnerabilities are found in it. But the following SSH features will pose security problems:

  1. Remote port forwarding (with -R). The person/malware on the remote system will gain access to the local port.
  2. Tunnel device forwarding (with -w). The person/malware on the remote system will be able to send traffic through the tunnel.
  3. Authentication agent connection forwarding (-A). The person/malware on the remote system will be able to use your ssh-agent keyring to authenticate with other SSH servers you have keys for.
  4. X11 forwarding (-X or -Y). As others have noted X11 protocol was designed with trusted clients in mind. The malicious software may read content of other windows, send keystrokes or simply show a window asking for a password.

Another thing to take account of is the terminal emulator you are using. Most probably it's a GUI one like konsole or GNOME's Terminal. If it is vulnerable it can also be exploited with a program on the compromised server (e.g. the remote server could send a character sequence which causes a buffer overflow and allows the attacker to execute code on your client computer).

I've never heard of a worm or an automated attacking software use these attack vectors, but if it's a targeted attack, these (especially the Agent Forwarding) may be used against you.

2

There are (I believe only) theoretical attacks using X forwarding that could do this.

X essentially requires fully trusting all clients (applications), and can scrape data off your client using an invisible window.

Also, if you enable agent forwarding to that host an attacker could use that combined with any "known hosts" files already on the compromised host to potentially extend their reach.

2

Intrinsically this does not pose any security threat (except insofar as you are using a compromised machine), unless you are using X forwarding also (X windows are not sandboxed).

However, if it happens that someone has a vector for exploiting some bug in your SSH client through the action of the server to which you connect, you could be somehow compromised. For instance, an attack might exploit a buffer overflow in the key negotiation process or something.

This sort of thing is purely theoretical. While it's certainly possible for something like that to exist, I've never heard of it.

1

I'm not sure exactly what your question is so feel free to update it if that is not the answer you're looking for.

If you're asking whether logging into a compromised server with a public key will the private key on the client to be compromised then the answer is no: the private key always stay on your machine and is only used to sign the authentication token you sent to the server.

That doesn't means it has no consequences, though: once you're logged on into a compromised machine, everything you do during this session is potentially compromised as well. for instance, if you use a private key stored on that server to access another server, that key will potentially be compromised . In fact, if you perform any other kind of login from within the SSH session, then the credentials used are potentially compromised.

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.