2011-11-03 20:09:11 +00:00
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
|
|
|
# Exploit mixins should be called first
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
# Scanner mixin should be near last
|
|
|
|
include Msf::Auxiliary::Scanner
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'HTTP TRACE Detection',
|
2011-11-14 16:40:11 +00:00
|
|
|
'Version' => '$Revision: $',
|
2011-11-03 20:09:11 +00:00
|
|
|
'Description' => 'Test if TRACE is actually enabled. 405 (Apache) 501(IIS) if its disabled, 200 if it is',
|
|
|
|
'Author' => ['CG'],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(target_host)
|
|
|
|
|
|
|
|
begin
|
|
|
|
res = send_request_raw({
|
|
|
|
'version' => '1.0',
|
|
|
|
'uri' => '/',
|
|
|
|
'method' => 'TRACE',
|
|
|
|
'headers' =>
|
|
|
|
{
|
|
|
|
'Cookie' => "did you echo me back?",
|
|
|
|
},
|
|
|
|
}, 10)
|
|
|
|
|
|
|
|
if res.nil?
|
|
|
|
print_error("no repsonse for #{target_host}")
|
|
|
|
elsif (res.code == 200)
|
|
|
|
print_good("#{target_host}:#{rport}-->#{res.code}")
|
|
|
|
print_good("Response Headers:\n #{res.headers}")
|
|
|
|
print_good("Response Body:\n #{res.body}")
|
|
|
|
print_good("TRACE appears to be enabled on #{target_host}:#{rport} \n")
|
2011-11-14 11:10:53 +00:00
|
|
|
report_note(
|
2011-11-14 16:40:11 +00:00
|
|
|
:host => target_host,
|
|
|
|
:port => rport,
|
|
|
|
:proto => 'tcp',
|
|
|
|
:sname => (ssl ? 'https' : 'http'),
|
|
|
|
:type => 'service.http.method.trace',
|
|
|
|
:data => "TRACE method is enabled for this service",
|
|
|
|
:update => :unique_data
|
|
|
|
)
|
2011-11-03 20:09:11 +00:00
|
|
|
elsif (res.code == 501)#Not Implemented
|
2011-11-14 16:40:11 +00:00
|
|
|
print_error("Received #{res.code} TRACE is not enabled for #{target_host}:#{rport}") #IIS
|
2011-11-03 20:09:11 +00:00
|
|
|
elsif (res.code == 405)#Method Not Allowed
|
2011-11-14 16:40:11 +00:00
|
|
|
print_error("Received #{res.code} TRACE is not enabled for #{target_host}:#{rport}") #Apache
|
2011-11-03 20:09:11 +00:00
|
|
|
else
|
|
|
|
print_status("#{res.code}")
|
|
|
|
end
|
|
|
|
|
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
|
|
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|