Home

Awesome

"HASSH" - a Profiling Method for SSH Clients and Servers.

<p align="center"> <img src="images/logo.png" width="850" title="hassh"> </p>

NOTE: This Corelight repository was created so that it can be actively maintained, as per a request from Salesforce whose original repository is not being maintained.

"HASSH" is a network fingerprinting standard which can be used to identify specific Client and Server SSH implementations. The fingerprints can be easily stored, searched and shared in the form of an MD5 fingerprint.

License: BSD 3-Clause License

What can HASSH help with:

How does HASSH work:

"hassh" and "hasshServer" are MD5 hashes constructed from a specific set of algorithms that are supported by various SSH Client and Server Applications. These algorithms are exchanged after the initial TCP three-way handshake as clear-text packets known as "SSH_MSG_KEXINIT" messages, and are an integral part of the setup of the final encrypted SSH channel. The existence and ordering of these algorithms can be unique enough such that it can be used as a fingerprint to help identify the underlying Client and Server application or unique implementation, regardless of higher level ostensible identifiers such as "Client" or "Server" strings.

<p align="center"> <img src="images/packet_sequence.png" width="700" title="Packet sequence"> </p>

Example 1: Client Fingerprinting - the "hassh"

For the "Cyberduck" SFTP client SSH-2.0-Cyberduck/6.7.1.28683 (Mac OS X/10.13.6) (x86_64) , the set of supported algorithms is as follows :

FunctionAlgorithms seen in SSH_MSG_KEXINIT packets
Key Exchange methodscurve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group14-sha256,diffie-hellman-group15-sha512,diffie-hellman-group16-sha512,diffie-hellman-group17-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256@ssh.com,diffie-hellman-group15-sha256,diffie-hellman-group15-sha256@ssh.com,diffie-hellman-group15-sha384@ssh.com,diffie-hellman-group16-sha256,diffie-hellman-group16-sha384@ssh.com,diffie-hellman-group16-sha512@ssh.com,diffie-hellman-group18-sha512@ssh.com
Encryptionaes128-cbc,aes128-ctr,aes192-cbc,aes192-ctr,aes256-cbc,aes256-ctr,blowfish-cbc,blowfish-ctr,cast128-cbc,cast128-ctr,idea-cbc,idea-ctr,serpent128-cbc,serpent128-ctr,serpent192-cbc,serpent192-ctr,serpent256-cbc,serpent256-ctr,3des-cbc,3des-ctr,twofish128-cbc,twofish128-ctr,twofish192-cbc,twofish192-ctr,twofish256-cbc,twofish256-ctr,twofish-cbc,arcfour,arcfour128,arcfour256
Message Authenticationhmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96,hmac-sha2-256,hmac-sha2-512
Compressionzlib@openssh.com,zlib,none

Concatenating these algorithms together with a delimiter of ";" gives the hasshAlgorithms, which is useful for detailed analysis.
curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group14-sha256,diffie-hellman-group15-sha512,diffie-hellman-group16-sha512,diffie-hellman-group17-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256@ssh.com,diffie-hellman-group15-sha256,diffie-hellman-group15-sha256@ssh.com,diffie-hellman-group15-sha384@ssh.com,diffie-hellman-group16-sha256,diffie-hellman-group16-sha384@ssh.com,diffie-hellman-group16-sha512@ssh.com,diffie-hellman-group18-sha512@ssh.com;aes128-cbc,aes128-ctr,aes192-cbc,aes192-ctr,aes256-cbc,aes256-ctr,blowfish-cbc,blowfish-ctr,cast128-cbc,cast128-ctr,idea-cbc,idea-ctr,serpent128-cbc,serpent128-ctr,serpent192-cbc,serpent192-ctr,serpent256-cbc,serpent256-ctr,3des-cbc,3des-ctr,twofish128-cbc,twofish128-ctr,twofish192-cbc,twofish192-ctr,twofish256-cbc,twofish256-ctr,twofish-cbc,arcfour,arcfour128,arcfour256;hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96,hmac-sha2-256,hmac-sha2-512;zlib@openssh.com,zlib,none

Finally the hassh is simply the MD5 of hasshAlgorithms, and is used for storage, searching and sharing. Some examples follow:

de30354b88bae4c2810426614e1b6976  Powershell Renci.SshNet.SshClient.0.0.1 (used by Empire exploit modules)
fafc45381bfde997b6305c4e1600f1bf  Ruby/Net::SSH_5.0.2 x86_64-linux (used by Metasploit exploit modules)
b5752e36ba6c5979a575e43178908adf  Python Paramiko_2.4.1 (used by Metasploit exploit modules) 
16f898dd8ed8279e1055350b4e20666c  Dropbear_2012.55 (used in IOT embedded systems)  
8a8ae540028bf433cd68356c1b9e8d5b  CyberDuck Version 6.7.1 (28683)  
06046964c022c6407d15a27b12a6a4fb  OpenSSH_7.7p1 Ubuntu-4

Example 2: Server Fingerprinting - the "hasshServer"

For a standard SSH-2.0-OpenSSH_5.3 SSH server, the set of supported algorithms is as follows :

FunctionAlgorithms seen in SSH_MSG_KEXINIT packets
Key Exchange methodsdiffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
Encryptionaes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
Message Authenticationhmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
Compressionnone,zlib@openssh.com

Concatenating these algorithms together with a delimiter of ";" gives the hasshServerAlgorithms, which is useful for detailed analysis.
diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1;aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se;hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96;none,zlib@openssh.com

Finally the hasshServer is simply the MD5 of hasshServerAlgorithms, some examples follow:

c1c596caaeb93c566b8ecf3cae9b5a9e  SSH-2.0-dropbear_2016.74	  
d93f46d063c4382b6232a4d77db532b2  SSH-2.0-dropbear_2016.72	  
2dd9a9b3dbebfaeec8b8aabd689e75d2  SSH-2.0-AWSCodeCommit  
696e7f84ac571fdf8fa5073e64ee2dc8  SSH-2.0-FTP

Options

By default, the raw algorithm string and the key algorithm are logged, and can be controlled by setting these boolean variables in the script.

option log_raw_hasshAlgorithms = T;
option log_key_algorithm = T;

References:

Credits:

hassh and hasshServer were conceived and developed by Ben Reardon within the Detection Cloud Team at Salesforce, with inspiration and contributions from Adel Karimi (@0x4d31) and the JA3 crew.