OpenSSH Username Enumeration Vulnerability

Greetings,

First of all, forgive me if I'm not in the right FreeBSD forum. Feel free to redirect me to the proper channel.

I have this vulnerability on one of my production web servers which is failing a PCI compliance test. I've been searching and reading but haven't found a solution yet. I'm running FreeBSD 11.3-RELEASE-p2 with the latest version of OpenSSH 7.9.

Running ssh towards my server yields:
$ ssh -V
OpenSSH_7.9p1, LibreSSL 2.7.3

Running netcat on my sever yields:
$ echo "Hello" | nc localhost 59
SSH-2.0-OpenSSH_7.5 FreeBSD-20170903
Protocol mismatch.

I provide no banner path but I still get the above mismatch. It is this message that is making my tests to fail. Could you please help me to fix this?

************************************************************************************************
THREAT:
OpenSSH (OpenBSD Secure Shell) is a set of computer programs providing encrypted communication sessions over a computer network using the SSH protocol.
A username enumeration vulnerability exists in OpenSSH, that a remote attacker could leverage to enumerate valid users on a targeted system. The attacker could try to enumerate users by transmitting malicious packets. Due to the vulnerability, if a username does not exist, then the server sends a SSH2_MSG_USERAUTH_FAILURE message to the attacker. If the username exists, then the server sends a SSH2_MSG_SERVICE_ACCEPT before calling fatal() and closes the connection.

Affected Versions:
OpenSSH through 7.7

QID Detection Logic:
Authenticated: Vulnerable OpenSSH versions are detected by running ssh -V command.
Unauthenticated: Vulnerable OpenSSH versions are detected from the banner exposed.

IMPACT:
Successful exploitation allows an attacker to enumerate usernames on a targeted system.

SOLUTION:
Customers are advised to upgrade to OpenSSH 7.8 or later versions to remediate this vulnerability.

Patch:
Following are links for downloading patches to fix the vulnerabilities:
OpenSSH 7.8 or later

RESULT:
Vulnerable SSH-2.0-OpenSSH_7.5 FreeBSD-20170903 detected on port 59 over TCP.
************************************************************************************************

Thank you,
 
Code:
uname -a FreeBSD shadow 11.3-STABLE FreeBSD 11.3-STABLE #8 r351087: Fri Aug 16 16:03:59 AEST 2019
     root:/usr/obj/usr/src/sys/MACMINI  amd64

$ ssh -V
OpenSSH_7.5p1, OpenSSL 1.0.2s-freebsd  28 May 2019

$ echo "Hello" | nc localhost 59
$

/etc/make.conf contains DEFAULT_VERSIONS+=ssl=openssl
 
Code:
uname -a FreeBSD shadow 11.3-STABLE FreeBSD 11.3-STABLE #8 r351087: Fri Aug 16 16:03:59 AEST 2019
     root:/usr/obj/usr/src/sys/MACMINI  amd64

$ ssh -V
OpenSSH_7.5p1, OpenSSL 1.0.2s-freebsd  28 May 2019

$ echo "Hello" | nc localhost 59
$

/etc/make.conf contains DEFAULT_VERSIONS+=ssl=openssl

Hi trev,

It seems you don't get the protocol mismatch I get. You are running FreeBSD 11.3-STABLE and I'm running FreeBSD 11.3-RELEASE-p2. You are running OpenSSL 1.0.2 and I'm running LibreSSL 2.7.3. The thing is that I didn't installed LibreSSL but rather OpenSSL. I don't recall seeing this package as a dependency from other packages. I need to look into both 11.3-RELEASE vs 11.3-STABLE and LibreSSL vs OpenSSL.

Code:
$ pkg info | grep -Ei 'ssl'
jbigkit-2.1_1                  Lossless compression for bi-level images such as scanned pages, faxes
liblz4-1.9.1,1                 LZ4 compression library, lossless and very fast
openssl-devel-1.1.0i_1         SSL and crypto library (1.1.x)
p5-IO-Socket-SSL-2.066         Perl5 interface to SSL sockets
p5-Net-SSLeay-1.85             Perl5 interface to SSL
php70-openssl-7.0.32           The openssl shared extension for php

Code:
$ uname -a
FreeBSD 11.3-RELEASE-p2 FreeBSD 11.3-RELEASE-p2 #0: Tue Aug  6 05:07:20 UTC 2019     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

$ ssh -V
OpenSSH_7.9p1, LibreSSL 2.7.3

$ echo "Hello" | nc localhost 59
SSH-2.0-OpenSSH_7.5 FreeBSD-20170903
Protocol mismatch.
 
OK, found it, https://nvd.nist.gov/vuln/detail/CVE-2018-15473.

Looks like it was reported, but probably wasn't deemed serious enough.

Hi yuripv,

I'm glad you found the CVE number. I should have put it in my original message. This CVE is not classified as a vulnerability but a potential vulnerability. Nonetheless, its presence makes my PCI compliance test to fail.
PCI COMPLIANCE STATUS
PCI Severity: MED

VULNERABILITY DETAILS
CVSS Base Score: 5 AV:N/AC:L/Au:N/C:P/I:N/A:N
CVSS Temporal Score: 3.7 E:POC/RL:OF/RC:UR
Severity: 3
QID: 38726
Category: General remote services
CVE ID: CVE-2018-15473
Vendor Reference: OpenBSDH OpenSSH
Bugtraq ID: 105140
Last Update: 08/06/2019

I'm running my SSH service on a non-default port; 59 in this virtual machine.
 
I don't understand ...

Running ssh towards my server yields:
$ ssh -V
OpenSSH_7.9p1, LibreSSL 2.7.3
That tells you NOTHING about your server. It tells you that the ssh CLIENT you are running is version 7.9p1.

Running netcat on my sever yields:
$ echo "Hello" | nc localhost 59
SSH-2.0-OpenSSH_7.5 FreeBSD-20170903
That tells you that the ssh SERVER (a.k.a. sshd) is version 7.5. You can get the same result by running "sshd -X" (or substitute any invalid option flag for X), which tells you the version of you sshd. By the way, just as an observation: On my machine (which is not built from source, but kept up to date) I get sshd version "OpenSSH_7.5p1, OpenSSL 1.0.2s-freebsd 28 May 2019" from this incantation, and the same "SSH-2.0-OpenSSH_7.5 FreeBSD-20170903" when doing "echo Hello | nc ...".

There is not really a mismatch; the versions of the ssh client and server don't have to be identical.

Your problem is much simpler: You are running a version of the OpenSSH server (a.k.a. daemon a.k.a. sshd) that is too old. Unfortunately, it is also the up-to-date version that is distributed with packages. To fix this, you probably have to find and download a more up-to-date version of sshd and build it. I don't know whether a more up-to-date version can be found in ports.

P.S. The "protocol mismatch" message is because the word "Hello" is a violation of the ssh protocol.
 
...
Your problem is much simpler: You are running a version of the OpenSSH server (a.k.a. daemon a.k.a. sshd) that is too old. Unfortunately, it is also the up-to-date version that is distributed with packages.
...
Are you sure? I just checked pkg install openssh-portable
Code:
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
    openssh-portable: 8.0.p1_1,1
    ldns: 1.7.1_1

Number of packages to be installed: 2

The process will require 7 MiB more space.
1 MiB to be downloaded.

Proceed with this action? [y/N]: n

I set my pkg config to track LATEST.

My FreeBSD 12.0-RELEASE-p10 got in the base system OpenSSH_7.8p1, OpenSSL 1.1.1a-freebsd 20 Nov 2018

victord, why don’t you simply use freebsd-update -r 12.0-RELEASE upgrade? This 12-RELEASE update had a minor quirk on some of my machines because of the newly added ntp user. However, that was easy to fix, and everything else went smooth. For the records, here is my update log: FreeBSD 12.0 has been released - an update log from December 2018 - https://obsigna.com/articles/1544562042.html
 
I don't understand ...


That tells you NOTHING about your server. It tells you that the ssh CLIENT you are running is version 7.9p1.


That tells you that the ssh SERVER (a.k.a. sshd) is version 7.5. You can get the same result by running "sshd -X" (or substitute any invalid option flag for X), which tells you the version of you sshd. By the way, just as an observation: On my machine (which is not built from source, but kept up to date) I get sshd version "OpenSSH_7.5p1, OpenSSL 1.0.2s-freebsd 28 May 2019" from this incantation, and the same "SSH-2.0-OpenSSH_7.5 FreeBSD-20170903" when doing "echo Hello | nc ...".

There is not really a mismatch; the versions of the ssh client and server don't have to be identical.

Your problem is much simpler: You are running a version of the OpenSSH server (a.k.a. daemon a.k.a. sshd) that is too old. Unfortunately, it is also the up-to-date version that is distributed with packages. To fix this, you probably have to find and download a more up-to-date version of sshd and build it. I don't know whether a more up-to-date version can be found in ports.

P.S. The "protocol mismatch" message is because the word "Hello" is a violation of the ssh protocol.

Thank you ralphbsz

You are absolutely right about everything you've said. How could I be such a fool by misinterpreting results? I gotta say, sometimes one needs another person's perspective.

You have helped me identify the solution to this simple problem.

Much appreciated,
 
Are you sure? I just checked ...
Oops, you are right, I was wrong. The version of sshd that victord and I have is not from packages, but is distributed as part of the base system.

BTW, I like your solution of just upgrading the whole OS to 12.X. That's a good thing in general.
 
To everyone in this thread, thank you!

Although upgrading the OS to 12 is a great idea (which I will do by the end of this year), it requires more planning. Thus, I only installed the latest version of OpenSSH via
Code:
pkg install openssh-portable
and made some minor modifications to
Code:
rc.conf
and
Code:
sshd_config
. Now I'm PCI compliant. :D

Have a great morning,
 
Back
Top