Adding the HTTP Trace scanner from CG

Fixes #3390


git-svn-id: file:///home/svn/framework3/trunk@14150 4d416f70-5f16-0410-b530-b9f4589650da
unstable
David Maloney 2011-11-03 20:09:11 +00:00
parent c7f0568769
commit 585a7cc4a2
1 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,60 @@
##
# 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',
'Version' => '$Revision$',
'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")
elsif (res.code == 501)#Not Implemented
print_error("Received #{res.code} TRACE is not enabled for #{target_host}:#{rport}")#IIS
elsif (res.code == 405)#Method Not Allowed
print_error("Received #{res.code} TRACE is not enabled for #{target_host}:#{rport}")#Apache
else
print_status("#{res.code}")
end
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
rescue ::Timeout::Error, ::Errno::EPIPE
end
end
end