Join Trustwave at the 2023 Gartner Security & Risk Management Summit in London, September 26-28. Learn More

Join Trustwave at the 2023 Gartner Security & Risk Management Summit in London, September 26-28. Learn More

Managed Detection & Response

Eradicate cyberthreats with world-class intel and expertise

Managed Security Services

Expand your team’s capabilities and strengthen your security posture

Consulting & Professional Services

Tap into our global team of tenured cybersecurity specialists

Penetration Testing

Subscription- or project-based testing, delivered by global experts

Database Security

Get ahead of database risk, protect data and exceed compliance requirements

Email Security & Management

Catch email threats others miss with layered security & maximum control

Co-Managed SOC (SIEM)

Eliminate alert fatigue, focus your SecOps team, stop threats fast, and reduce cyber risk

Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
The Trustwave Approach
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Platform
SpiderLabs Fusion Center
Security Operations Centers
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats

Fingerprinting FreeBSD OS Versions using OpenSSH

In the past, we’ve described how to fingerprint Ubuntu OS Version using OpenSSH. This time, I’ll explain how to Fingerprint FreeBSD.

The basic theory is the same:

  1. We’ll grab the Banner from the SSH port (usually port 22)
  2. Determine if it’s an OpenSSH banner
  3. Map out the SSH Comment to a list of banners we have and determine the FreeBSD version.

The big difference from the Ubuntu post is how to map the FreeBSD banners. I’ll explain that next.


Translate Banners to FreeBSD Versions

OpenSSH FreeBSD banners look like “SSH-2.0-OpenSSH_7.3 FreeBSD-20170902”, “SSH-2.0-OpenSSH_5.4p1_hpn13v11 FreeBSD-20100308”, etc. It’s not easy to determine the FreeBSD version from the banner.

I did some research, but I could not find a resource similar to Ubuntu’s Launchpad entries, with information that could allow me to determine the relationship between OpenSSH version, build version, patch version and FreeBSD version or something similar.

However, I was able to find that FreeBSD’s man page does have the default value in the “VersionAddendum” section. For example, FreeBSD 10.0-Release has the default value of FreeBSD-20131111.

Using a small script or a web proxy, we can get a list of all the default values and the FreeBSD version. I used Burp to obtain the valid FreeBSD versions from the man page and then used them as payload as shown in Figure 1.


Figure 1. Payloads configured


After launching the script, we get these results:


Figure 2. Results and list of FreeBSD version and FreeBSD banner


Those results could be saved in a CSV file and then analyzed. It is also important to mention that old versions of OpenSSH (for example, FreeBSD 4.7 and earlier) did not include the parameter and were not included for review. However, those versions have been end-of-life for a few years now.


Comparing the list of banners vs banners in the wild

Now that we have a list of banners and the corresponding FreeBSD version, we should check that we have a match for most of the banners out "in the wild".

It is not required to authenticate to the device in order to get the banner. A simple TCP connection is the only thing needed. This means, that this information is available for any FreeBSD machine on the Internet running OpenSSH.

I used Shodan to get a list of banners so we can verify we’re catching most of them. There are a couple of ways to do the next query. One option is to query by port (the default port of SSH is 22):


Figure 3. Total results of Shodan search by port and Freebsd text



Another option is by product (“OpenSSH”):


Figure 4. Total results of Shodan search by OpenSSH and Freebsd text


In both cases, I added “freebsd” to only show banners that are related to FreeBSD.

I exported 50,000 results in JSON format for analysis. I grouped the results by unique banner, and I got about 180 unique banners. Over 90% of them were matched with the fingerprint information I generated earlier. Most of the non-matching banners are edge cases, either someone who modified the banner or an OS that uses FreeBSD as a base (for example TrustOS). Figure 3 shows a graph of the exported results.


Figure 5. Graph of FreeBSD versions based on how common it was in the banners analyzed


We have updated TrustKeeper scan engine’s operating system fingerprint with the data obtained.