If you're connecting to servers over the secure shell (SSH) protocol using an OpenSSH client, you should update it immediately. The latest version patches a flaw that could allow rogue or compromised servers to read users' private authentication keys.
The vulnerability stems from an experimental feature known as roaming that allows SSH connections to be resumed. This feature has been enabled by default in OpenSSH clients since version 5.4, released in March 2010, but is not present in the OpenSSH server implementation. As a result only clients are affected.
The vulnerability allows a server to read information from a connecting client's memory, including its private keys. It has been fixed in OpenSSH 7.1p2, released Thursday.
One possible mitigation is to add the undocumented configuration option "UseRoaming no" to the global ssh_config file.
Due to the way SSH works, where the server's identity is cryptographically checked by the client before authentication, man-in-the-middle attackers cannot exploit this vulnerability.
This means that an attacker would either have to convince a user to connect to a rogue server or to compromise a legitimate SSH server and then steal its users' private authentication keys. The latter scenario is a more likely, according to researchers from security firm Qualys who found the vulnerability.
SSH allows authentication based on public-key cryptography and, in fact, this is the most secure and preferred option. The client first generates a private and public key pair. The public key is shared with the server and the private key is only stored on the client and used to prove the user's identity.
The theft of users' private SSH keys through this vulnerability could give attackers persistent access to servers compromised through other means. Even if the initial entry points used by the hackers were to be identified and fixed, they would still have SSH keys to log in as legitimate users.
In addition, some people reuse their SSH keys across multiple servers, just as some people reuse their passwords across multiple websites. This means that the compromise of a user's SSH key could put more than one server at risk.
"This information leak may have already been exploited in the wild by sophisticated attackers, and high-profile sites or users may need to regenerate their SSH keys accordingly," the Qualys researchers said in an advisory.