Updated the report format to match new syntax
git-svn-id: file:///home/svn/framework3/trunk@8566 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
0a8696436e
commit
0ba3d18032
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
##
|
##
|
||||||
# This file is part of the Metasploit Framework and may be subject to
|
# This file is part of the Metasploit Framework and may be subject to
|
||||||
# redistribution and commercial restrictions. Please see the Metasploit
|
# redistribution and commercial restrictions. Please see the Metasploit
|
||||||
# Framework web site for more information on licensing and terms of use.
|
# Framework web site for more information on licensing and terms of use.
|
||||||
# http://metasploit.com/framework/
|
# http://metasploit.com/framework/
|
||||||
|
@ -8,91 +8,95 @@
|
||||||
|
|
||||||
|
|
||||||
require 'msf/core'
|
require 'msf/core'
|
||||||
require 'rex/socket/ssl_tcp'
|
|
||||||
|
|
||||||
|
|
||||||
class Metasploit3 < Msf::Auxiliary
|
class Metasploit3 < Msf::Auxiliary
|
||||||
|
|
||||||
include Msf::Exploit::Remote::HttpClient
|
include Msf::Exploit::Remote::Tcp
|
||||||
include Msf::Auxiliary::WMAPScanServer
|
include Msf::Auxiliary::WMAPScanServer
|
||||||
include Msf::Auxiliary::Scanner
|
include Msf::Auxiliary::Scanner
|
||||||
include Msf::Auxiliary::Report
|
include Msf::Auxiliary::Report
|
||||||
|
|
||||||
include Rex::Socket::Comm
|
include Rex::Socket::Comm
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
super(
|
super(
|
||||||
'Name' => 'HTTP SSL Certificate tester',
|
'Name' => 'HTTP SSL Certificate Information',
|
||||||
'Version' => '$Revision$',
|
'Version' => '$Revision$',
|
||||||
'Description' => 'Display vhost associated to server using SSL certificate and check for signature algorithm',
|
'Description' => 'Parse the server SSL certificate to obtain the common name and signature algorithm',
|
||||||
'Author' => 'et',
|
'Author' => 'et',
|
||||||
'License' => MSF_LICENSE
|
'License' => MSF_LICENSE
|
||||||
)
|
)
|
||||||
|
register_options([
|
||||||
|
Opt::RPORT(443)
|
||||||
|
], self.class)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Fingerprint a single host
|
# Fingerprint a single host
|
||||||
def run_host(ip)
|
def run_host(ip)
|
||||||
if !datastore['SSL']
|
|
||||||
print_error("SSL set to false")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
ssock = Rex::Socket::SslTcp.create(
|
|
||||||
'PeerHost' => wmap_target_host,
|
|
||||||
'PeerPort' => wmap_target_port,
|
|
||||||
'Proxies' => datastore['PROXIES']
|
|
||||||
)
|
|
||||||
|
|
||||||
cert = OpenSSL::X509::Certificate.new(ssock.peer_cert)
|
connect
|
||||||
|
|
||||||
|
cert = OpenSSL::X509::Certificate.new(sock.peer_cert)
|
||||||
|
|
||||||
|
disconnect
|
||||||
|
|
||||||
ssock.close
|
|
||||||
|
|
||||||
if cert
|
if cert
|
||||||
print_status("[#{ip}:#{datastore['RPORT']}] Subject: #{cert.subject} Signature Alg: #{cert.signature_algorithm}")
|
print_status("#{ip}:#{rport} Subject: #{cert.subject} Signature Alg: #{cert.signature_algorithm}")
|
||||||
alg = cert.signature_algorithm
|
alg = cert.signature_algorithm
|
||||||
|
|
||||||
if alg.downcase.include? "md5"
|
if alg.downcase.include? "md5"
|
||||||
print_status("[#{ip}:#{datastore['RPORT']}] WARNING: Signature algorithm using MD5 (#{alg})")
|
print_status("#{ip}:#{rport} WARNING: Signature algorithm using MD5 (#{alg})")
|
||||||
end
|
end
|
||||||
|
|
||||||
sub = cert.subject.to_a
|
vhostn = nil
|
||||||
|
cert.subject.to_a.each do |n|
|
||||||
vhostn = 'EMPTY'
|
vhostn = n[1] if n[0] == 'CN'
|
||||||
sub.each do |n|
|
|
||||||
#print_line "#{n[0]}"
|
|
||||||
if n[0] == 'CN'
|
|
||||||
#print_line "> #{n[1]}"
|
|
||||||
vhostn = n[1]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if vhostn
|
if vhostn
|
||||||
print_status("[#{ip}:#{datastore['RPORT']}] is host #{vhostn}")
|
print_status("#{ip}:#{rport} has common name #{vhostn}")
|
||||||
|
|
||||||
|
# Store the virtual hostname for HTTP
|
||||||
report_note(
|
report_note(
|
||||||
:host => ip,
|
:host => ip,
|
||||||
:proto => 'HTTP',
|
|
||||||
:port => rport,
|
:port => rport,
|
||||||
:type => 'VHOST',
|
:proto => 'tcp',
|
||||||
:data => "#{vhostn}"
|
:type => 'http.vhost',
|
||||||
|
:data => {:name => vhostn}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Store the SSL certificate itself
|
||||||
report_note(
|
report_note(
|
||||||
:host => ip,
|
:host => ip,
|
||||||
:proto => 'HTTP',
|
:proto => 'tcp',
|
||||||
:port => rport,
|
:port => rport,
|
||||||
:type => 'X509',
|
:type => 'ssl.certificate',
|
||||||
:data => "Subject: #{cert.subject} Algorithm: #{cert.signature_algorithm}"
|
:data => {
|
||||||
|
:cn => vhostn,
|
||||||
|
:subject => cert.subject.to_a,
|
||||||
|
:algorithm => alg
|
||||||
|
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Update the server hostname if necessary
|
||||||
|
if vhostn !~ /localhost|snakeoil/i
|
||||||
|
report_host(
|
||||||
|
:host => ip,
|
||||||
|
:name => vhostn
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print_status("[#{ip}:#{datastore['RPORT']}] No certificate subject or CN found")
|
print_status("#{ip}:#{rport}] No certificate subject or common name found")
|
||||||
end
|
end
|
||||||
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
||||||
rescue ::Timeout::Error, ::Errno::EPIPE
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue