2011-11-03 20:09:11 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2011-11-03 20:09:11 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
# Exploit mixins should be called first
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
include Msf::Auxiliary::WmapScanServer
|
|
|
|
# Scanner mixin should be near last
|
|
|
|
include Msf::Auxiliary::Scanner
|
2011-11-03 20:09:11 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
2015-09-02 17:26:45 +00:00
|
|
|
'Name' => 'HTTP Cross-Site Tracing Detection',
|
2015-09-02 16:19:08 +00:00
|
|
|
'Description' => 'Checks if the host is vulnerable to Cross-Site Tracing (XST)',
|
2015-09-02 16:27:22 +00:00
|
|
|
'Author' =>
|
|
|
|
[
|
2015-09-02 16:19:08 +00:00
|
|
|
'Jay Turla <@shipcod3>' , #Cross-Site Tracing (XST) Checker
|
|
|
|
'CG' #HTTP TRACE Detection
|
|
|
|
],
|
2013-08-30 21:28:54 +00:00
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
|
|
|
end
|
2011-11-03 20:09:11 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def run_host(target_host)
|
2011-11-03 20:09:11 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
begin
|
|
|
|
res = send_request_raw({
|
2015-09-02 16:19:08 +00:00
|
|
|
'uri' => '/<script>alert(1337)</script>', #XST Payload
|
2013-08-30 21:28:54 +00:00
|
|
|
'method' => 'TRACE',
|
2015-09-02 16:19:08 +00:00
|
|
|
})
|
2011-11-03 20:09:11 +00:00
|
|
|
|
2015-09-02 17:48:53 +00:00
|
|
|
unless res
|
|
|
|
vprint_error("#{rhost}:#{rport} did not reply to our request")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
if res.body.to_s.index('/<script>alert(1337)</script>')
|
|
|
|
print_good("#{rhost}:#{rport} is vulnerable to Cross-Site Tracing")
|
2015-09-02 16:19:08 +00:00
|
|
|
report_vuln(
|
2015-09-02 17:48:53 +00:00
|
|
|
:host => rhost,
|
2013-08-30 21:28:54 +00:00
|
|
|
:port => rport,
|
2015-09-02 17:48:53 +00:00
|
|
|
:proto => 'tcp',
|
2013-08-30 21:28:54 +00:00
|
|
|
:sname => (ssl ? 'https' : 'http'),
|
2015-09-02 17:48:53 +00:00
|
|
|
:info => "Vulnerable to Cross-Site Tracing",
|
2013-08-30 21:28:54 +00:00
|
|
|
)
|
|
|
|
else
|
2015-09-02 17:48:53 +00:00
|
|
|
vprint_error("#{rhost}:#{rport} returned #{res.code} #{res.message}")
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
|
|
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
|
|
|
end
|
|
|
|
end
|
2011-11-03 20:09:11 +00:00
|
|
|
end
|