Skip to content

Commit 074ea7d

Browse files
author
jvazquez-r7
committed
Merge branch 'ssl' of https://github.com/luh2/metasploit-framework into luh2-ssl
2 parents 87f8451 + 8e80f5e commit 074ea7d

File tree

1 file changed

+20
-1
lines changed
  • modules/auxiliary/scanner/http

1 file changed

+20
-1
lines changed

modules/auxiliary/scanner/http/ssl.rb

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def initialize
2424
[
2525
'et', #original module
2626
'Chris John Riley', #additions
27+
'Veit Hailperin <[email protected]>', # checks for public key size, valid time
2728
],
2829
'License' => MSF_LICENSE
2930
)
@@ -47,6 +48,10 @@ def run_host(ip)
4748
print_status("#{ip}:#{rport} Subject: #{cert.subject}")
4849
print_status("#{ip}:#{rport} Issuer: #{cert.issuer}")
4950
print_status("#{ip}:#{rport} Signature Alg: #{cert.signature_algorithm}")
51+
public_key_size = cert.public_key.n.num_bytes * 8
52+
print_status("#{ip}:#{rport} Public Key Size: #{public_key_size} bits")
53+
print_status("#{ip}:#{rport} Not Valid Before: #{cert.not_before}")
54+
print_status("#{ip}:#{rport} Not Valid After: #{cert.not_after}")
5055

5156
# Checks for common properties of self signed certificates
5257
caissuer = (/CA Issuers - URI:(.*?),/i).match(cert.extensions.to_s)
@@ -71,6 +76,17 @@ def run_host(ip)
7176
cert.subject.to_a.each do |n|
7277
vhostn = n[1] if n[0] == 'CN'
7378
end
79+
if public_key_size == 1024
80+
print_status("#{ip}:#{rport} WARNING: Public Key only 1024 bits")
81+
elsif public_key_size < 1024
82+
print_status("#{ip}:#{rport} WARNING: Weak Public Key: #{public_key_size} bits")
83+
end
84+
if cert.not_after < Time.now
85+
print_status("#{ip}:#{rport} WARNING: Certificate not valid anymore")
86+
end
87+
if cert.not_before > Time.now
88+
print_status("#{ip}:#{rport} WARNING: Certificate not valid yet")
89+
end
7490

7591
if vhostn
7692
print_status("#{ip}:#{rport} has common name #{vhostn}")
@@ -93,7 +109,10 @@ def run_host(ip)
93109
:data => {
94110
:cn => vhostn,
95111
:subject => cert.subject.to_a,
96-
:algorithm => alg
112+
:algorithm => alg,
113+
:valid_from => cert.not_before,
114+
:valid_after => cert.not_after,
115+
:key_size => public_key_size
97116

98117
}
99118
)

0 commit comments

Comments
 (0)