2008-11-23 19:42:42 +00:00
|
|
|
##
|
2009-12-13 06:56:01 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2008-11-23 19:42:42 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2008-11-23 19:42:42 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
2009-12-13 06:56:01 +00:00
|
|
|
|
2008-11-23 19:42:42 +00:00
|
|
|
# Exploit mixins should be called first
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
2012-02-03 21:43:21 +00:00
|
|
|
include Msf::Auxiliary::WmapScanServer
|
2008-11-23 19:42:42 +00:00
|
|
|
# Scanner mixin should be near last
|
|
|
|
include Msf::Auxiliary::Scanner
|
2009-04-15 04:15:25 +00:00
|
|
|
include Msf::Auxiliary::Report
|
2008-11-23 19:42:42 +00:00
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'HTTP Options Detection',
|
|
|
|
'Description' => 'Display available HTTP options for each system',
|
2009-01-08 01:57:28 +00:00
|
|
|
'Author' => ['CG'],
|
2011-03-25 17:03:16 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2005-3398'],
|
|
|
|
[ 'CVE', '2005-3498'],
|
|
|
|
[ 'OSVDB', '877'],
|
|
|
|
[ 'BID', '11604'],
|
|
|
|
[ 'BID', '9506'],
|
|
|
|
[ 'BID', '9561']
|
|
|
|
]
|
2008-11-23 19:42:42 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2009-04-15 04:15:25 +00:00
|
|
|
def run_host(target_host)
|
2008-11-23 19:42:42 +00:00
|
|
|
|
|
|
|
begin
|
|
|
|
res = send_request_raw({
|
|
|
|
'version' => '1.0',
|
2009-12-13 06:56:01 +00:00
|
|
|
'uri' => '/',
|
2008-11-23 19:42:42 +00:00
|
|
|
'method' => 'OPTIONS'
|
|
|
|
}, 10)
|
|
|
|
|
|
|
|
if (res and res.headers['Allow'])
|
2009-04-15 04:15:25 +00:00
|
|
|
print_status("#{target_host} allows #{res.headers['Allow']} methods")
|
2008-11-23 19:42:42 +00:00
|
|
|
|
2009-04-15 04:15:25 +00:00
|
|
|
report_note(
|
2009-11-25 06:08:28 +00:00
|
|
|
:host => target_host,
|
2011-02-04 01:54:32 +00:00
|
|
|
:proto => 'tcp',
|
2012-02-18 04:59:48 +00:00
|
|
|
:sname => (ssl ? 'https' : 'http'),
|
2009-11-25 06:08:28 +00:00
|
|
|
:port => rport,
|
|
|
|
:type => 'HTTP_OPTIONS',
|
|
|
|
:data => res.headers['Allow']
|
|
|
|
)
|
2009-04-15 04:15:25 +00:00
|
|
|
|
2009-12-13 06:56:01 +00:00
|
|
|
if(res.headers['Allow'].index('TRACE'))
|
2011-05-15 22:19:00 +00:00
|
|
|
print_status "#{target_host}:#{rport} - TRACE method allowed."
|
2010-02-02 23:11:18 +00:00
|
|
|
report_vuln(
|
2009-12-13 06:56:01 +00:00
|
|
|
:host => target_host,
|
|
|
|
:port => rport,
|
2011-02-04 01:54:32 +00:00
|
|
|
:proto => 'tcp',
|
2012-02-18 04:59:48 +00:00
|
|
|
:sname => (ssl ? 'https' : 'http'),
|
2012-06-18 04:39:20 +00:00
|
|
|
:name => "HTTP Trace Method Allowed",
|
|
|
|
:info => "Module #{self.fullname} detected TRACE access through the Allow header: #{res.headers['Allow']}",
|
2011-05-15 22:19:00 +00:00
|
|
|
:refs => self.references,
|
|
|
|
:exploited_at => Time.now.utc
|
2009-12-13 06:56:01 +00:00
|
|
|
)
|
|
|
|
end
|
2008-11-23 19:42:42 +00:00
|
|
|
end
|
2009-12-13 06:56:01 +00:00
|
|
|
|
2008-11-23 19:42:42 +00:00
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
|
|
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|