HTTP SSL Certificate Information - Metasploit


This page contains detailed information about how to use the auxiliary/scanner/http/ssl metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: HTTP SSL Certificate Information
Module: auxiliary/scanner/http/ssl
Source code: modules/auxiliary/scanner/http/ssl.rb
Disclosure date: -
Last modification time: 2017-07-24 06:26:21 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 443
List of CVEs: -

Parse the server SSL certificate to obtain the common name and signature algorithm

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/http/ssl
msf auxiliary(ssl) > show options
    ... show and set options ...
msf auxiliary(ssl) > set RHOSTS ip-range
msf auxiliary(ssl) > exploit

Other examples of setting the RHOSTS option:

Example 1:

msf auxiliary(ssl) > set RHOSTS 192.168.1.3-192.168.1.200 

Example 2:

msf auxiliary(ssl) > set RHOSTS 192.168.1.1/24

Example 3:

msf auxiliary(ssl) > 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


This module queries a host or range of hosts and pull the SSL certificate information if one is installed.

Verification Steps


  1. Do: use auxiliary/scanner/http/ssl
  2. Do: set RHOSTS [IP]
  3. Do: set THREADS [num of threads]
  4. Do: run

Scenarios


msf > use auxiliary/scanner/http/ssl
msf auxiliary(ssl) > set RHOSTS 192.168.1.200-254
RHOSTS => 192.168.1.200-254
msf auxiliary(ssl) > set THREADS 20
THREADS => 20
msf auxiliary(ssl) > run

[*] Error: 192.168.1.205: OpenSSL::SSL::SSLError SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A
[*] Error: 192.168.1.206: OpenSSL::SSL::SSLError SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A
[*] 192.168.1.208:443 Subject: /C=--/ST=SomeState/L=SomeCity/O=SomeOrganization/OU=SomeOrganizationalUnit/CN=localhost.localdomain/[email protected] Signature Alg: md5WithRSAEncryption
[*] 192.168.1.208:443 WARNING: Signature algorithm using MD5 (md5WithRSAEncryption)
[*] 192.168.1.208:443 has common name localhost.localdomain
[*] 192.168.1.211:443 Subject: /C=--/ST=SomeState/L=SomeCity/O=SomeOrganization/OU=SomeOrganizationalUnit/CN=localhost.localdomain/[email protected] Signature Alg: sha1WithRSAEncryption
[*] 192.168.1.211:443 has common name localhost.localdomain
[*] Scanned 13 of 55 hosts (023% complete)
[*] Error: 192.168.1.227: OpenSSL::SSL::SSLError SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A
[*] 192.168.1.223:443 Subject: /CN=localhost Signature Alg: sha1WithRSAEncryption
[*] 192.168.1.223:443 has common name localhost
[*] 192.168.1.222:443 WARNING: Signature algorithm using MD5 (md5WithRSAEncryption)
[*] 192.168.1.222:443 has common name MAILMAN
[*] Scanned 30 of 55 hosts (054% complete)
[*] Scanned 31 of 55 hosts (056% complete)
[*] Scanned 39 of 55 hosts (070% complete)
[*] Scanned 41 of 55 hosts (074% complete)
[*] Scanned 43 of 55 hosts (078% complete)
[*] Scanned 45 of 55 hosts (081% complete)
[*] Scanned 46 of 55 hosts (083% complete)
[*] Scanned 53 of 55 hosts (096% complete)
[*] Scanned 55 of 55 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(ssl) >

Go back to menu.

Msfconsole Usage


Here is how the scanner/http/ssl auxiliary module looks in the msfconsole:

msf6 > use auxiliary/scanner/http/ssl

msf6 auxiliary(scanner/http/ssl) > show info

       Name: HTTP SSL Certificate Information
     Module: auxiliary/scanner/http/ssl
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  et <[email protected]>
  Chris John Riley
  Veit Hailperin <[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    443              yes       The target port (TCP)
  THREADS  1                yes       The number of concurrent threads (max one per host)

Description:
  Parse the server SSL certificate to obtain the common name and 
  signature algorithm

Module Options


This is a complete list of options available in the scanner/http/ssl auxiliary module:

msf6 auxiliary(scanner/http/ssl) > show options

Module options (auxiliary/scanner/http/ssl):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   RHOSTS                    yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RPORT    443              yes       The target port (TCP)
   THREADS  1                yes       The number of concurrent threads (max one per host)

Advanced Options


Here is a complete list of advanced options supported by the scanner/http/ssl auxiliary module:

msf6 auxiliary(scanner/http/ssl) > show advanced

Module advanced options (auxiliary/scanner/http/ssl):

   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/http/ssl module can do:

msf6 auxiliary(scanner/http/ssl) > show actions

Auxiliary actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the scanner/http/ssl auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 auxiliary(scanner/http/ssl) > 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.

Not Valid Before: <CERT.NOT_BEFORE>


Here is a relevant code snippet related to the "Not Valid Before: <CERT.NOT_BEFORE>" error message:

50:	        public_key_size = 0
51:	        if cert.public_key.respond_to? :n
52:	          public_key_size = cert.public_key.n.num_bytes * 8
53:	          print_status("Public Key Size: #{public_key_size} bits")
54:	        end
55:	        print_status("Not Valid Before: #{cert.not_before}")
56:	        print_status("Not Valid After: #{cert.not_after}")
57:	
58:	        # Checks for common properties of self signed certificates
59:	        caissuer = (/CA Issuers - URI:(.*?),/i).match(cert.extensions.to_s)
60:	

Not Valid After: <CERT.NOT_AFTER>


Here is a relevant code snippet related to the "Not Valid After: <CERT.NOT_AFTER>" error message:

51:	        if cert.public_key.respond_to? :n
52:	          public_key_size = cert.public_key.n.num_bytes * 8
53:	          print_status("Public Key Size: #{public_key_size} bits")
54:	        end
55:	        print_status("Not Valid Before: #{cert.not_before}")
56:	        print_status("Not Valid After: #{cert.not_after}")
57:	
58:	        # Checks for common properties of self signed certificates
59:	        caissuer = (/CA Issuers - URI:(.*?),/i).match(cert.extensions.to_s)
60:	
61:	        if caissuer.to_s.empty?

WARNING: Certificate not valid anymore


Here is a relevant code snippet related to the "WARNING: Certificate not valid anymore" error message:

84:	          elsif public_key_size < 1024
85:	            print_status("WARNING: Weak Public Key: #{public_key_size} bits")
86:	          end
87:	        end
88:	        if cert.not_after < Time.now
89:	          print_status("WARNING: Certificate not valid anymore")
90:	        end
91:	        if cert.not_before > Time.now
92:	          print_status("WARNING: Certificate not valid yet")
93:	        end
94:	

WARNING: Certificate not valid yet


Here is a relevant code snippet related to the "WARNING: Certificate not valid yet" error message:

87:	        end
88:	        if cert.not_after < Time.now
89:	          print_status("WARNING: Certificate not valid anymore")
90:	        end
91:	        if cert.not_before > Time.now
92:	          print_status("WARNING: Certificate not valid yet")
93:	        end
94:	
95:	        if vhostn
96:	          print_status("Has common name #{vhostn}")
97:	

No certificate subject or common name found


Here is a relevant code snippet related to the "No certificate subject or common name found" error message:

129:	            )
130:	          end
131:	
132:	        end
133:	      else
134:	        print_status("No certificate subject or common name found")
135:	      end
136:	    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
137:	    rescue ::Timeout::Error, ::Errno::EPIPE
138:	    end
139:	  end

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • et
  • Chris John Riley
  • Veit Hailperin <hailperv[at]gmail.com>

Version


This page has been produced using Metasploit Framework version 6.2.29-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.