Recently I have been testing a new tool created by the people at Salesforce. The tool is called JARM and what it does is query TLS instances (HTTPS servers and services) to create a fingerprint of their TLS configuration. Much like analyzing the nuances of network traffic can be used to fingerprint the operating system and version of a server, JARM fingerprints TLS instances to create a fingerprint which can be used to compare one TLS service to another.
The JARM repository on github provides two executable files. The first jarm.py can be used to create a fingerprint for any TLS enabled service. The second jarm.sh is used to automate a JARM scan across a range of IPs. For example the fingerprint for isc.sans.edu can be generated as follows:
$ python3 jarm.py isc.sans.edu Domain: isc.sans.edu Resolved IP: 126.96.36.199 JARM: 29d29d00029d29d00041d41d0000005d86ccb1a0567e012264097a0315d7a7
JARM can be used for a number of purposes. As the Salesforce blog post says:
“JARM fingerprints can be used to:
- Quickly verify that all servers in a group have the same TLS configuration.
- Group disparate servers on the internet by configuration, identifying that a server may belong to Google vs. Salesforce vs. Apple, for example.
- Identify default applications or infrastructure.
- Identify malware command and control infrastructure and other malicious servers on the Internet.”
Shodan has integrated JARM and has generated JARM fingerprints for all TLS instances they have discovered and integrated them into a Shodan facet. You can query Shodan’s JARM results from the Shodan web tool, or from any Linux with Python installed you can use the Shodan command line, or use the Shodan API, to query fingerprints
So how can this be used to detect malware deployments? Well it turns out that the when malware deploys a TLS enabled service the fingerprints tend to stay the same across multiple deployments. The JARM developers have given us the fingerprints for a number of common malware families.
Using this information you could create a script to run across your address space and compare the computed fingerprints to the known malware fingerprints or you could just use Shodan to do this comparison. In this example below I am using the Shodan command line to query the JARM results for AS209 and comparing the result to the fingerprint for Cobalt Strike (a red team tool often dropped by emotet and other malware onto compromised servers).
$ shodan search asn:as209 ssl.jarm:07d14d16d21d21d07c42d41d00041d24a458a375eef0c576d23a7bab9a9fb1 188.8.131.52 443 HTTP/1.1 403 ForbiddenrnContent-Length: 310rnContent-Type: text/htmlrnConnection: Closernrn 184.108.40.206 443 71-37-172-120.lsv2.qwest.net HTTP/1.1 403 ForbiddenrnContent-Length: 316rnContent-Type: text/htmlrnConnection: Closernrn 220.127.116.11 443 71-37-172-123.lsv2.qwest.net HTTP/1.1 403 ForbiddenrnContent-Length: 316rnContent-Type: text/htmlrnConnection: Closernrn 18.104.22.168 443 97-122-203-173.hlrn.qwest.net HTTP/1.1 403 ForbiddenrnContent-Length: 303rnContent-Type: text/htmlrnConnection: Closernrn 22.214.171.124 443 174-16-120-233.hlrn.qwest.net HTTP/1.1 403 ForbiddenrnContent-Length: 309rnContent-Type: text/htmlrnConnection: Closernrn 126.96.36.199 443 mail.strataproducts.com HTTP/1.1 403 ForbiddenrnContent-Length: 314rnContent-Type: text/htmlrnConnection: Closernrn 188.8.131.52 443 HTTP/1.1 200 OKrnCache-Control: privaternContent-Type: text/html; charset=utf-8rnServer: Microsoft-IIS/7.5rnSet-Cookie: ASP.NET_SessionId=vpxjjrrzezdnobjeacvfff45; path=/; HttpOnlyrnX-AspNet-Version: 2.0.50727rnX-Powered-By: ASP.NETrnDate: Sun, 22 Nov 2020 02:31:11 GMTrnContent-Length: 47074rnrn 184.108.40.206 443 HTTP/1.1 403 ForbiddenrnContent-Length: 352rnContent-Type: text/htmlrnConnection: Closernrn 220.127.116.11 443 71-222-37-196.lsv2.qwest.net HTTP/1.1 403 ForbiddenrnContent-Length: 316rnContent-Type: text/htmlrnConnection: Closernrn
I have to believe there have to be some false positives in the results, but it gives you a place to start.
For more information on JARM, please check out the Salesforce JARM blog post
For downloading, JARM can be found on github.
— Rick Wanner MSISE – rwanner at isc dot sans dot edu – http://namedeplume.blogspot.com/ – Twitter:namedeplume (Protected)
(c) SANS Internet Storm Center. https://isc.sans.edu Creative Commons Attribution-Noncommercial 3.0 United States License.