Path: blob/master/modules/auxiliary/fuzzers/http/http_get_uri_strings.rb
19567 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'English'6class MetasploitModule < Msf::Auxiliary7include Msf::Exploit::Remote::Tcp8include Msf::Auxiliary::Fuzzer910def initialize(info = {})11super(12update_info(13info,14'Name' => 'HTTP GET Request URI Fuzzer (Fuzzer Strings)',15'Description' => %q{16This module sends a series of HTTP GET request with malicious URIs.17},18'Author' => [ 'nullthreat' ],19'License' => MSF_LICENSE,20'Notes' => {21'Stability' => [CRASH_SERVICE_DOWN],22'SideEffects' => [],23'Reliability' => []24}25)26)27register_options([28Opt::RPORT(80),29OptString.new('VHOST', [false, 'The virtual host name to use in requests']),30OptString.new('URIBASE', [true, 'The base URL to use for the request fuzzer', '/'])31])32end3334def do_http_get(uri = '', opts = {})35@connected = false36connect37@connected = true3839sock.put("GET #{uri} HTTP/1.1\r\nHost: #{datastore['VHOST'] || rhost}\r\n\r\n")40sock.get_once(-1, opts[:timeout] || 0.01)41end4243def run44last_str = nil45last_inp = nil46last_err = nil4748pre = make_http_uri_base49cnt = 05051fuzz_strings do |str|52cnt += 15354# XXX: Encode the string or leave it raw? Best to make a new boolean option to enable/disable this55uri = pre + str5657if (cnt % 100 == 0)58print_status("Fuzzing with iteration #{cnt} using #{@last_fuzzer_input}")59end6061begin62do_http_get(uri, timeout: 0.50)63rescue ::Interrupt64print_status("Exiting on interrupt: iteration #{cnt} using #{@last_fuzzer_input}")65raise $ERROR_INFO66rescue StandardError => e67last_err = e68ensure69disconnect70end7172if !@connected73if last_str74print_status("The service may have crashed: iteration:#{cnt - 1} method=#{last_inp} uri=''#{last_str}'' error=#{last_err}")75else76print_status("Could not connect to the service: #{last_err}")77end78return79end8081last_str = str82last_inp = @last_fuzzer_input83end84end8586def make_http_uri_base87datastore['URIBASE']88end89end909192