HTTP SSL Certificate Checker - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/http/cert metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: HTTP SSL Certificate Checker
Module: auxiliary/scanner/http/cert
Source code: modules/auxiliary/scanner/http/cert.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: -
This module will check the certificate of the specified web servers to ensure the subject and issuer match the supplied pattern and that the certificate is not expired.
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/cert
msf auxiliary(cert) > show options
... show and set options ...
msf auxiliary(cert) > set RHOSTS ip-range
msf auxiliary(cert) > exploit
Other examples of setting the RHOSTS option:
Example 1:
msf auxiliary(cert) > set RHOSTS 192.168.1.3-192.168.1.200
Example 2:
msf auxiliary(cert) > set RHOSTS 192.168.1.1/24
Example 3:
msf auxiliary(cert) > 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 is a useful administrative scanner that allows you to cover a subnet to check whether or not server http certificates are expired. Using this scanner, you can uncover issuer of certificate, issue and expiry date.
Verification Steps
- Do:
use auxiliary/scanner/http/cert
- Do:
set RHOSTS [IP]
- Do:
set THREADS [number of threads]
- Do:
run
Scenarios
msf > use auxiliary/scanner/http/cert
msf auxiliary(cert) > set RHOSTS 192.168.1.0/24
RHOSTS => 192.168.1.0/24
msf auxiliary(cert) > set THREADS 254
THREADS => 254
msf auxiliary(cert) > run
[*] 192.168.1.11 - '192.168.1.11' : 'Sat Sep 25 07:16:02 UTC 2010' - 'Tue Sep 22 07:16:02 UTC 2020'
[*] 192.168.1.10 - '192.168.1.10' : 'Wed Mar 10 00:13:26 UTC 2010' - 'Sat Mar 07 00:13:26 UTC 2020'
[*] 192.168.1.201 - 'localhost' : 'Tue Nov 10 23:48:47 UTC 2009' - 'Fri Nov 08 23:48:47 UTC 2019'
[*] Scanned 255 of 256 hosts (099% complete)
[*] Scanned 256 of 256 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(cert) >
Confirming
The following are other industry tools which can also be used. Note that the targets are not the same as those used in the previous documentation.
nmap
# nmap -p 443 192.168.2.137 -sV --script=ssl-cert
Starting Nmap 7.60 ( https://nmap.org ) at 2018-02-24 13:20 EST
Nmap scan report for ubuntu (192.168.2.137)
Host is up (0.0029s latency).
PORT STATE SERVICE VERSION
443/tcp open ssl/http Apache httpd 2.4.18 ((Ubuntu))
|_http-server-header: Apache/2.4.18 (Ubuntu)
| ssl-cert: Subject: commonName=ubuntu
| Issuer: commonName=ubuntu
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2018-01-26T21:38:21
| Not valid after: 2028-01-24T21:38:21
| MD5: d2a7 364d 636a 6eee c3e1 7af9 05f7 8c5b
|_SHA-1: a5bf f783 2514 90ee 365a 3ee4 9b6c 23f6 24af dbfa
MAC Address: 00:0C:29:5B:CF:75 (VMware)
sslscan
# sslscan 192.168.2.137
Version: 1.11.11-static
OpenSSL 1.0.2-chacha (1.0.2g-dev)
Connected to 192.168.2.137
Testing SSL server 192.168.2.137 on port 443 using SNI name 192.168.2.137
...snip...
Subject: ubuntu
Issuer: ubuntu
Not valid before: Jan 26 21:38:21 2018 GMT
Not valid after: Jan 24 21:38:21 2028 GMT
Go back to menu.
Msfconsole Usage
Here is how the scanner/http/cert auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/http/cert
msf6 auxiliary(scanner/http/cert) > show info
Name: HTTP SSL Certificate Checker
Module: auxiliary/scanner/http/cert
License: Metasploit Framework License (BSD)
Rank: Normal
Provided by:
nebulus
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
ISSUER .* yes Show a warning if the Issuer doesn't match this regex
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 443 yes The target port (TCP)
SHOWALL false no Show all certificates (issuer,time) regardless of match
THREADS 1 yes The number of concurrent threads (max one per host)
Description:
This module will check the certificate of the specified web servers
to ensure the subject and issuer match the supplied pattern and that
the certificate is not expired.
Module Options
This is a complete list of options available in the scanner/http/cert auxiliary module:
msf6 auxiliary(scanner/http/cert) > show options
Module options (auxiliary/scanner/http/cert):
Name Current Setting Required Description
---- --------------- -------- -----------
ISSUER .* yes Show a warning if the Issuer doesn't match this regex
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 443 yes The target port (TCP)
SHOWALL false no Show all certificates (issuer,time) regardless of match
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/cert auxiliary module:
msf6 auxiliary(scanner/http/cert) > show advanced
Module advanced options (auxiliary/scanner/http/cert):
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/cert module can do:
msf6 auxiliary(scanner/http/cert) > show actions
Auxiliary actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the scanner/http/cert auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/http/cert) > 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.
<IP> No certificate subject or CN found
Here is a relevant code snippet related to the "<IP> No certificate subject or CN found" error message:
35: connect(true, {"SSL" => true}) #Force SSL
36: cert = OpenSSL::X509::Certificate.new(sock.peer_cert)
37: disconnect
38:
39: if(not cert)
40: print_status("#{ip} No certificate subject or CN found")
41: return
42: end
43: sub = cert.subject.to_a
44:
45: before = Time.parse("#{cert.not_before}")
Error: '<IP>' '<E.CLASS>' '<E>' '<E.BACKTRACE>'
Here is a relevant code snippet related to the "Error: '<IP>' '<E.CLASS>' '<E>' '<E.BACKTRACE>'" error message:
102:
103:
104: rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
105: rescue ::Timeout::Error, ::Errno::EPIPE
106: rescue ::OpenSSL::SSL::SSLError => e
107: return if(e.to_s.match(/^SSL_connect /) ) # strange errors / exception if SSL connection aborted
108: rescue ::Exception => e
109: return if(e.to_s =~ /execution expired/)
110: print_error("Error: '#{ip}' '#{e.class}' '#{e}' '#{e.backtrace}'")
111: end
112: end
Go back to menu.
Related Pull Requests
- #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
- #5380 Merged Pull Request: PageantJacker (POST Module)
- #5915 Merged Pull Request: Fixes bug where "cert.rb:47: warning: flags ignored" happens due to s…
- #5688 Merged Pull Request: Remove msfcli, please use msfconsole -x instead
- #3186 Merged Pull Request: changed option from string to regex
- #2525 Merged Pull Request: Change module boilerplate
- #1228 Merged Pull Request: MSFTIDY cleanup #1 - auxiliary
Go back to menu.
See Also
Check also the following modules related to this module:
- auxiliary/admin/dcerpc/icpr_cert
- auxiliary/gather/ldap_esc_vulnerable_cert_finder
- auxiliary/scanner/http/smt_ipmi_static_cert_scanner
- auxiliary/scanner/ike/cisco_ike_benigncertain
- exploit/linux/local/vmware_workspace_one_access_certproxy_lpe
- exploit/windows/http/hp_pcm_snac_update_certificates
Authors
nebulus
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.