Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/fuzzers/http/http_get_uri_long.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::Tcp7include Msf::Auxiliary::Fuzzer89def initialize(info = {})10super(update_info(info,11'Name' => 'HTTP GET Request URI Fuzzer (Incrementing Lengths)',12'Description' => %q{13This module sends a series of HTTP GET request with incrementing URL lengths.14},15'Author' => [ 'nullthreat' ],16'License' => MSF_LICENSE17))18register_options([19Opt::RPORT(80),20OptInt.new("MAXLENGTH", [true, "The longest string length to try", 16384] ),21OptString.new("URIBASE", [true, "The base URL to use for the request fuzzer", "/"]),22OptString.new("VHOST", [false, "The virtual host name to use in requests"])23])24end2526def do_http_get(uri='',opts={})27@connected = false28connect29@connected = true3031sock.put("GET #{uri} HTTP/1.1\r\nHost: #{datastore['VHOST'] || rhost}\r\n\r\n")32sock.get_once(-1, opts[:timeout] || 0.01)33end3435def run36last_str = nil37last_inp = nil38last_err = nil3940pre = make_http_uri_base41cnt = 042431.upto(datastore['MAXLENGTH'].to_i) do |len|44cnt += 14546str = fuzzer_gen_string(len)4748# XXX: Encode the string or leave it raw? Best to make a new boolean option to enable/disable this49uri = pre + str5051if(cnt % 100 == 0)52print_status("Fuzzing with iteration #{cnt} using string length #{len}")53end5455begin56r = do_http_get(uri,:timeout => 0.25)57rescue ::Interrupt58print_status("Exiting on interrupt: iteration #{cnt} using string length #{len}")59raise $!60rescue ::Exception => e61last_err = e62ensure63disconnect64end6566if(not @connected)67if(last_str)68print_status("The service may have crashed: iteration:#{cnt-1} len=#{len} uri=''#{last_str}'' error=#{last_err}")69else70print_status("Could not connect to the service: #{last_err}")71end72return73end7475last_str = str76last_inp = @last_fuzzer_input77end78end7980def make_http_uri_base81datastore['URIBASE']82end83end848586