2015-04-03 06:30:03 +00:00
|
|
|
##
|
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
2016-03-07 19:19:55 +00:00
|
|
|
class Metasploit3 < Msf::Auxiliary
|
2015-04-03 06:30:03 +00:00
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
include Msf::Auxiliary::Scanner
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'F5 BigIP HTTP Virtual Server Scanner',
|
|
|
|
'Description' => %q{
|
2015-05-08 19:46:08 +00:00
|
|
|
This module scans for BigIP HTTP virtual servers using banner grabbing. BigIP system uses
|
|
|
|
different HTTP profiles for managing HTTP traffic and these profiles allow to customize
|
|
|
|
the string used as Server HTTP header. The default values are "BigIP" or "BIG-IP" depending
|
|
|
|
on the BigIP system version.
|
2015-04-03 06:30:03 +00:00
|
|
|
},
|
|
|
|
'Author' =>
|
|
|
|
[
|
|
|
|
'Denis Kolegov <dnkolegov[at]gmail.com>',
|
2015-05-10 06:59:57 +00:00
|
|
|
'Oleg Broslavsky <ovbroslavsky[at]gmail.com>',
|
|
|
|
'Nikita Oleksov <neoleksov[at]gmail.com>'
|
2015-04-03 06:30:03 +00:00
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'URL', 'https://www.owasp.org/index.php/SCG_D_BIGIP'],
|
|
|
|
]
|
|
|
|
))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
2015-05-08 19:46:08 +00:00
|
|
|
OptString.new('PORTS', [true, 'Ports to scan (e.g. 80-81,443,8080-8090)', '80,443']),
|
|
|
|
OptInt.new('TIMEOUT', [true, 'The socket connect/read timeout in seconds', 1]),
|
2015-04-03 06:30:03 +00:00
|
|
|
], self.class)
|
|
|
|
|
2015-05-08 19:46:08 +00:00
|
|
|
deregister_options('RPORT')
|
2015-04-03 06:30:03 +00:00
|
|
|
end
|
|
|
|
|
2015-05-08 19:46:08 +00:00
|
|
|
def bigip_http?(ip, port, ssl)
|
2015-04-03 06:30:03 +00:00
|
|
|
begin
|
2015-05-08 19:46:08 +00:00
|
|
|
res = send_request_raw(
|
2015-05-08 20:23:08 +00:00
|
|
|
{
|
|
|
|
'method' => 'GET',
|
|
|
|
'uri' => '/',
|
|
|
|
'rport' => port,
|
2015-05-10 06:59:57 +00:00
|
|
|
'SSL' => ssl,
|
2015-05-08 20:23:08 +00:00
|
|
|
},
|
|
|
|
datastore['TIMEOUT'])
|
2015-05-08 19:46:08 +00:00
|
|
|
return false unless res
|
|
|
|
server = res.headers['Server']
|
|
|
|
return true if server =~ /BIG\-IP/ || server =~ /BigIP/
|
|
|
|
rescue ::Rex::ConnectionRefused
|
|
|
|
vprint_error("#{ip}:#{port} - Connection refused")
|
|
|
|
rescue ::Rex::ConnectionError
|
|
|
|
vprint_error("#{ip}:#{port} - Connection error")
|
|
|
|
rescue ::OpenSSL::SSL::SSLError
|
|
|
|
vprint_error("#{ip}:#{port} - SSL/TLS connection error")
|
2015-04-03 06:30:03 +00:00
|
|
|
end
|
2015-05-08 19:46:08 +00:00
|
|
|
|
|
|
|
false
|
2015-04-03 06:30:03 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(ip)
|
|
|
|
ports = Rex::Socket.portspec_crack(datastore['PORTS'])
|
2015-05-08 19:46:08 +00:00
|
|
|
|
|
|
|
if ports.empty?
|
|
|
|
print_error('PORTS options is invalid')
|
|
|
|
return
|
2015-04-03 06:30:03 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
ports.each do |port|
|
2015-05-08 20:29:30 +00:00
|
|
|
|
|
|
|
unless port == 443 # Skip http check for 443
|
|
|
|
if bigip_http?(ip, port, false)
|
|
|
|
print_good("#{ip}:#{port} - BigIP HTTP virtual server found")
|
|
|
|
next
|
|
|
|
end
|
2015-04-03 06:30:03 +00:00
|
|
|
end
|
|
|
|
|
2015-05-08 20:29:30 +00:00
|
|
|
unless port == 80 # Skip https check for 80
|
|
|
|
if bigip_http?(ip, port, true)
|
|
|
|
print_good("#{ip}:#{port} - BigIP HTTPS virtual server found")
|
|
|
|
end
|
2015-05-08 19:46:08 +00:00
|
|
|
end
|
|
|
|
end
|
2015-04-03 06:30:03 +00:00
|
|
|
end
|
2015-05-08 19:18:13 +00:00
|
|
|
end
|