Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More

Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More

Services
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

Database Security

Prevent unauthorized access and exceed compliance requirements.

Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Microsoft Security
Unlock the full power of Microsoft Security
Offensive Security
Solutions to maximize your security ROI
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
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
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.

Figure1

Figure 1. Payloads configured

 

After launching the script, we get these results:

Figure2

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):

Figure3

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

 

 

Another option is by product (“OpenSSH”):

Figure4

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.

Figure5

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.

ABOUT TRUSTWAVE

Trustwave is a globally recognized cybersecurity leader that reduces cyber risk and fortifies organizations against disruptive and damaging cyber threats. Our comprehensive offensive and defensive cybersecurity portfolio detects what others cannot, responds with greater speed and effectiveness, optimizes client investment, and improves security resilience. Learn more about us.

Latest Intelligence

Discover how our specialists can tailor a security program to fit the needs of
your organization.

Request a Demo