A four-year-old severe vulnerability has been discovered in the Secure Shell (SSH) implementation library known as Libssh that could allow anyone to completely bypass authentication and gain unfettered administrative control over a vulnerable server without requiring a password.The security vulnerability, tracked as CVE-2018-10933, is an authentication-bypass issue that was introduced in Libssh version 0.6 released earlier 2014, leaving thousands of enterprise servers open to hackers for the last four years.
But before you get frightened, you should know that neither the widely used OpenSSH nor Github’s implementation of libssh was affected by the vulnerability.
The vulnerability resides due to a coding error in Libssh and is “ridiculously simple” to exploit.
According to a security advisory published Tuesday, all an attacker needs to do is sending an “SSH2_MSG_USERAUTH_SUCCESS” message to a server with an SSH connection enabled when it expects an “SSH2_MSG_USERAUTH_REQUEST” message.Due to a logical flaw in libssh, the library fails to validate if the incoming “successful login” packet was sent by the server or the client, and also fails to check if the authentication process has been completed or not.
Therefore, if a remote attacker (client) sends this “SSH2_MSG_USERAUTH_SUCCESS” response to libssh, it considers that the authentication has been successful and will grant the attacker access to the server, without needing to enter a password.
Although GitHub uses libssh, it confirms that its official website and GitHub Enterprise are not affected by the vulnerability due to how GitHub uses the library.
“We use a custom version of libssh; SSH2_MSG_USERAUTH_SUCCESS with the libssh server is not relied upon for pubkey-based auth, which is what we use the library for,” a GitHub security official said on Twitter.
“Patches have been applied out of an abundance of caution, but GHE [GitHub Enterprise] was never vulnerable to CVE-2018-10933.”
Shodan search shows that around 6,500 internet-facing servers may be impacted due to the use of Libssh one or the other way.
The security bug was discovered by Peter Winter-Smith from NCC Group, who responsibly disclosed the issue to Libssh.
The Libssh team addressed the issue with the release of its updated libssh versions 0.8.4 and 0.7.6 on Tuesday, and the details of the vulnerability were also released at the same time.
If you have Libssh installed on your website, and mainly if you are using the server component, you are highly recommended to install the updated versions of Libssh as soon as possible.