Trustwave SpiderLabs Uncovers Ov3r_Stealer Malware Spread via Phishing and Facebook Advertising. Learn More

Trustwave SpiderLabs Uncovers Ov3r_Stealer Malware Spread via Phishing and Facebook Advertising. Learn More

Services
Capture
Managed Detection & Response

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

twi-managed-portal-color
Co-Managed SOC (SIEM)

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

twi-briefcase-color-svg
Advisory & Diagnostics

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

tw-laptop-data
Penetration Testing

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

twi-database-color-svg
Database Security

Prevent unauthorized access and exceed compliance requirements.

twi-email-color-svg
Email Security

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

tw-officer
Digital Forensics & Incident Response

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

tw-network
Firewall & Technology Management

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

Solutions
BY TOPIC
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
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
SpiderLabs Blog

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.

Latest SpiderLabs Blogs

Trustwave SpiderLabs: Insights and Solutions to Defend Educational Institutions Against Cyber Threats

Security teams responsible for defending educational institutions at higher education and primary school levels often find themselves facing harsh lessons from threat actors who exploit the numerous...

Read More

Breakdown of Tycoon Phishing-as-a-Service System

Just weeks after Trustwave SpiderLabs reported on the Greatness phishing-as-a-service (PaaS) framework, SpiderLabs’ Email Security team is tracking another PaaS called Tycoon Group.

Read More

Trustwave SpiderLabs Uncovers Ov3r_Stealer Malware Spread via Phishing and Facebook Advertising

During an Advanced Continual Threat Hunt (ACTH) investigation that took place in early December 2023, Trustwave SpiderLabs discovered Ov3r_Stealer, an infostealer distributed using Facebook...

Read More