SSH Version Scanner - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/ssh/ssh_version metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: SSH Version Scanner
Module: auxiliary/scanner/ssh/ssh_version
Source code: modules/auxiliary/scanner/ssh/ssh_version.rb
Disclosure date: -
Last modification time: 2020-12-07 01:01:47 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 22
List of CVEs: -
Detect SSH Version.
Module Ranking and Traits
Module Ranking:
- normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.
Basic Usage
This module is a scanner module, and is capable of testing against multiple hosts.
msf > use auxiliary/scanner/ssh/ssh_version
msf auxiliary(ssh_version) > show options
... show and set options ...
msf auxiliary(ssh_version) > set RHOSTS ip-range
msf auxiliary(ssh_version) > exploit
Other examples of setting the RHOSTS option:
Example 1:
msf auxiliary(ssh_version) > set RHOSTS 192.168.1.3-192.168.1.200
Example 2:
msf auxiliary(ssh_version) > set RHOSTS 192.168.1.1/24
Example 3:
msf auxiliary(ssh_version) > set RHOSTS file:/tmp/ip_list.txt
Required Options
- RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Knowledge Base
Description
SSH, Secure SHell, is an encrypted network protocol used to remotely interact with an Operating System at a command line level. SSH is available on most every system, including Windows, but is mainly used by *nix administrators.
This module identifies the version of SSH service in use by the server based on the server's banner. Any SSH server should return this information.
Vulnerable Application
This module is tested on several different SSH services, such as:
- Virtual testing environment: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.8
github.com
: SSH-2.0-babeld-38be96bcgitlab.com
: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.8
Verification Steps
- Do:
use auxiliary/scanner/ssh/ssh_version
- Do:
set rhosts [ips]
- Do:
run
Scenarios
SSH-2.0 on GitHub
msf5 auxiliary(scanner/ssh/ssh_version) > use auxiliary/scanner/ssh/ssh_version
msf5 auxiliary(scanner/ssh/ssh_version) > set RHOSTS github.com
RHOSTS => github.com
msf5 auxiliary(scanner/ssh/ssh_version) > run
[+] 140.82.118.4:22 - SSH server version: SSH-2.0-babeld-38be96bc
[*] github.com:22 - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
Go back to menu.
Msfconsole Usage
Here is how the scanner/ssh/ssh_version auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/ssh/ssh_version
msf6 auxiliary(scanner/ssh/ssh_version) > show info
Name: SSH Version Scanner
Module: auxiliary/scanner/ssh/ssh_version
License: Metasploit Framework License (BSD)
Rank: Normal
Provided by:
Daniel van Eeden <[email protected]>
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 22 yes The target port (TCP)
THREADS 1 yes The number of concurrent threads (max one per host)
TIMEOUT 30 yes Timeout for the SSH probe
Description:
Detect SSH Version.
References:
http://en.wikipedia.org/wiki/SecureShell
Module Options
This is a complete list of options available in the scanner/ssh/ssh_version auxiliary module:
msf6 auxiliary(scanner/ssh/ssh_version) > show options
Module options (auxiliary/scanner/ssh/ssh_version):
Name Current Setting Required Description
---- --------------- -------- -----------
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 22 yes The target port (TCP)
THREADS 1 yes The number of concurrent threads (max one per host)
TIMEOUT 30 yes Timeout for the SSH probe
Advanced Options
Here is a complete list of advanced options supported by the scanner/ssh/ssh_version auxiliary module:
msf6 auxiliary(scanner/ssh/ssh_version) > show advanced
Module advanced options (auxiliary/scanner/ssh/ssh_version):
Name Current Setting Required Description
---- --------------- -------- -----------
CHOST no The local client address
CPORT no The local client port
ConnectTimeout 10 yes Maximum number of seconds to establish a TCP connection
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
SSL false no Negotiate SSL/TLS for outgoing connections
SSLCipher no String for SSL cipher - "DHE-RSA-AES256-SHA" or "ADH"
SSLVerifyMode PEER no SSL verification method (Accepted: CLIENT_ONCE, FAIL_IF_NO_PEER_CERT, NONE, PEER)
SSLVersion Auto yes Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
ShowProgress true yes Display progress messages during a scan
ShowProgressPercent 10 yes The interval in percent that progress should be shown
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Auxiliary Actions
This is a list of all auxiliary actions that the scanner/ssh/ssh_version module can do:
msf6 auxiliary(scanner/ssh/ssh_version) > show actions
Auxiliary actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the scanner/ssh/ssh_version auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/ssh/ssh_version) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
TCP::max_send_size 0 no Maxiumum tcp segment size. (0 = disable)
TCP::send_delay 0 no Delays inserted before every send. (0 = disable)
Go back to menu.
Error Messages
This module may fail with the following error messages:
Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.
No response
Here is a relevant code snippet related to the "No response" error message:
45: connect
46:
47: resp = sock.get_once(-1, timeout)
48:
49: if ! resp
50: vprint_warning("No response")
51: return Exploit::CheckCode::Unknown
52: end
53:
54: ident, first_message = resp.split(/[\r\n]+/)
55: info = ""
Was not SSH -- <RESP.SIZE> bytes beginning with <VALUE>
Here is a relevant code snippet related to the "Was not SSH -- <RESP.SIZE> bytes beginning with <VALUE>" error message:
53:
54: ident, first_message = resp.split(/[\r\n]+/)
55: info = ""
56:
57: if /^SSH-\d+\.\d+-(.*)$/ !~ ident
58: vprint_warning("Was not SSH -- #{resp.size} bytes beginning with #{resp[0, 12]}")
59: return Exploit::CheckCode::Safe(details: { ident: ident })
60: end
61:
62: banner = $1
63:
Timed out after <TIMEOUT> seconds. Skipping.
Here is a relevant code snippet related to the "Timed out after <TIMEOUT> seconds. Skipping." error message:
89: end
90: rescue EOFError, Rex::ConnectionError => e
91: vprint_error(e.message) # This may be a little noisy, but it is consistent
92: Exploit::CheckCode::Unknown
93: rescue Timeout::Error
94: vprint_warning("Timed out after #{timeout} seconds. Skipping.")
95: Exploit::CheckCode::Unknown
96: ensure
97: disconnect
98: end
99: end
Go back to menu.
Related Pull Requests
- #14446 Merged Pull Request: Add Oracle Solaris SunSSH PAM parse_user_name() exploit (CVE-2020-14871)
- #8716 Merged Pull Request: Print_Status -> Print_Good (And OCD bits 'n bobs)
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #6526 Merged Pull Request: Peers for the peer god
- #5876 Merged Pull Request: Correct the storage of ssh banners in service.info
- #5538 Merged Pull Request: Cleanup and enhance ssh_version
- #2525 Merged Pull Request: Change module boilerplate
- #1228 Merged Pull Request: MSFTIDY cleanup #1 - auxiliary
References
See Also
Check also the following modules related to this module:
- auxiliary/fuzzers/ssh/ssh_version_15
- auxiliary/fuzzers/ssh/ssh_version_2
- auxiliary/gather/ibm_sametime_version
- auxiliary/scanner/db2/db2_version
- auxiliary/scanner/etcd/version
- auxiliary/scanner/ftp/ftp_version
- auxiliary/scanner/h323/h323_version
- auxiliary/scanner/http/coldfusion_version
- auxiliary/scanner/http/docker_version
- auxiliary/scanner/http/emby_version_ssrf
- auxiliary/scanner/http/http_version
- auxiliary/scanner/http/joomla_version
- auxiliary/scanner/http/sap_businessobjects_version_enum
- auxiliary/scanner/http/ssl_version
- auxiliary/scanner/imap/imap_version
- auxiliary/scanner/ipmi/ipmi_version
- auxiliary/scanner/lotus/lotus_domino_version
- auxiliary/scanner/memcached/memcached_udp_version
- auxiliary/scanner/mysql/mysql_version
- auxiliary/scanner/oracle/tnslsnr_version
- auxiliary/scanner/pop3/pop3_version
- auxiliary/scanner/postgres/postgres_version
- auxiliary/scanner/printer/printer_version_info
- auxiliary/scanner/sap/sap_mgmt_con_version
- auxiliary/scanner/scada/digi_addp_version
- auxiliary/scanner/scada/digi_realport_version
- auxiliary/scanner/smb/smb_version
- auxiliary/scanner/smtp/smtp_version
- auxiliary/scanner/snmp/aix_version
- auxiliary/scanner/telnet/lantronix_telnet_version
- auxiliary/scanner/telnet/telnet_version
- auxiliary/scanner/vmware/vmauthd_version
- auxiliary/scanner/vxworks/wdbrpc_version
- post/multi/gather/enum_software_versions
Authors
- Daniel van Eeden <metasploit[at]myname.nl>
Version
This page has been produced using Metasploit Framework version 6.1.27-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.